dbTalk Databases Forums  

Weird behavior of XML DB when inserting new elements and trying to read them again

comp.databases.berkeley-db comp.databases.berkeley-db


Discuss Weird behavior of XML DB when inserting new elements and trying to read them again in the comp.databases.berkeley-db forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Andi
 
Posts: n/a

Default Weird behavior of XML DB when inserting new elements and trying to read them again - 01-18-2006 , 10:05 PM






Hi,

I have run into a very strange and frustrating problem that I just
haven't been able to nail down. I'm hoping very much that someone can
offer some enlightenment or advice. Apologies in advance for the long
post but I wanted to include all the relevant information.

I'm using the Java interface for the XML DB. I'm creating some very
simple XML structures to keep track of user profiles. When the profile
gets created, some default 'contexttypes' are automatically inserted.
The users can then specify additional contexttypes as they go along.
These additional types will be appended to the default ones.

The problem I've run into is that as long as no new types are added,
I'm getting back the 5 default types. However as soon as I add 1 new
type and query again, then I only get back that new type, i.e. the
other 5 default types aren't returned.
However when I use the 'dbxml' command line tool, I can see that all 6
types are now in the profile but for some reason, only the last one is
returned. Even when I query in the dbxml tool, I only get back the last
type.

In the following example, for user 1, I've added 2 new types and user 2
still only has all default types:

=============================
</profiles>
<profile>
<userid>1</userid>
....
<contexttypes>
<contexttype>Work</contexttype>
<contexttype>Sport</contexttype>
<contexttype>Study</contexttype>
<contexttype>Fun</contexttype>
<contexttype>Other</contexttype><contexttype>test</contexttype><contexttype>Other</contexttype>
</contexttypes>
</profile><profile>
<userid>2</userid>
....
<contexttypes>
<contexttype>Work</contexttype>
<contexttype>Sport</contexttype>
<contexttype>Study</contexttype>
<contexttype>Fun</contexttype>
<contexttype>Other</contexttype>
</contexttypes>
</profile>
</profiles>
=============================

Queries in 'dbxml' command line tool:
------------------------------------------------
dbxml> query
'collection("test.dbxml")/profiles/profile[userid=2]/contexttypes'
1 objects returned for eager expression
'collection("test.dbxml")/profiles/profile[userid=2]/contexttypes'

dbxml> print
<contexttypes>
<contexttype>Work</contexttype>
<contexttype>Sport</contexttype>
<contexttype>Study</contexttype>
<contexttype>Fun</contexttype>
<contexttype>Other</contexttype>
</contexttypes>


------------------------------------------------
dbxml> query
'collection("test.dbxml")/profiles/profile[userid=2]/contexttypes/contexttype'
5 objects returned for eager expression
'collection("test.dbxml")/profiles/profile[userid=2]/contexttypes/contexttype'

dbxml> print
<contexttype>Work</contexttype>
<contexttype>Sport</contexttype>
<contexttype>Study</contexttype>
<contexttype>Fun</contexttype>
<contexttype>Other</contexttype>


------------------------------------------------
dbxml> query
'collection("test.dbxml")/profiles/profile[userid=1]/contexttypes'
1 objects returned for eager expression
'collection("test.dbxml")/profiles/profile[userid=1]/contexttypes'

dbxml> print
<contexttypes>
<contexttype>Work</contexttype>
<contexttype>Sport</contexttype>
<contexttype>Study</contexttype>
<contexttype>Fun</contexttype>
<contexttype>Other</contexttype><contexttype>test</contexttype><contexttype>Other</contexttype>
</contexttypes>


------------------------------------------------
dbxml> query
'collection("test.dbxml")/profiles/profile[userid=1]/contexttypes/contexttype'
2 objects returned for eager expression
'collection("test.dbxml")/profiles/profile[userid=1]/contexttypes/contexttype'

dbxml> print
<contexttype>test</contexttype>
<contexttype>Other</contexttype>
------------------------------------------------

In the above, why does it only query the last 2 context types? It just
doesn't make sense at all to me.

I hope someone has some ideas.


Reply With Quote
  #2  
Old   
George Feinberg
 
Posts: n/a

Default Re: Weird behavior of XML DB when inserting new elements and trying to read them again - 01-19-2006 , 10:42 AM






Andi,

This is George Feinberg, with Sleepycat. Rather than discuss
this issue in this group, which is mostly Berkeley DB focused,
it'd be easier to handle it offline.

The simplest thing is to email me your test program that exhibits this
behavior, if that's possible. If not, let me know and we can discuss
alternatives.

Regards,

George


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.