[bdbxml] Replacing and inserting nodes
Sebastian Ley <[email protected]>
| Newsgroups | gmane.comp.db.dbxml.general |
|---|---|
| Message-ID | <[email protected]> |
Hello, while searching for a free XML database for my diploma thesis, I came across bdbxml, which I like a lot. However I am missing a certain behaviour with respect to updating and creating nodes in a document. I am using the Java API and the class in question is of course XmlModify. What I need to do is the following: In a document, locate a specific node and then replace that node with content I have as a String. For example I have the following document: <foo> <bar value="1"> data </bar> <bar value="2"> moredata </bar> </foo> Now I want to replace the node specified by the XPath Query /foo/bar[@value="1"] with the following node: <bar value="15"> randomdata </bar> It seems that there is no method of XmlModify which elegantly handles such a situation. It only allows for modification of node contens with addUpdateStep. Even the insert methods are not satisfactory for that example, because they can't take the whole String as a new node, but require creation of an additional node by specifying name and node Type. Am I missing somethig or do I really need to do something like this: 1) Strip the root from the string to insert 2) insert a new node, with type = element, name = name of the stripped node and content of the remaining insert string 3) remove the node I wanted to replace. I hope my explanations are not too confusing ;-) Regards, Sebastian -- PGP-Key: http://www.mmweg.rwth-aachen.de/~sebastian.ley/public.key Fingerprint: A46A 753F AEDC 2C01 BE6E F6DB 97E0 3309 9FD6 E3E6 ------------------------------------------ To remove yourself from this list, send an email to [email protected]