revAddXMLNode - how to specify a parent node if multiple?

Tiemo Hollmann TB toolbook at kestner.de
Wed Aug 8 10:09:37 EDT 2012


Hello,

perhaps somebody with some XML experience can help me. I want to create a
xml file where some parent nodes exist multiple times with different child
contents. My problem is to add the child nodes to the correct (last) parent
nodes. The file should look like this:

                <productidentifier>

                               <b221>02</b221>

                               <b244>3000013121</b244>

                </productidentifier>

                <productidentifier>

                               <b221>03</b221>

                               <b244>9783000013126</b244>

                </productidentifier>

After having closed the first parent node <productidentifier>, I create the
next parent <productidentifier>. Up to here, everything is ok, it looks like
this:

                <productidentifier>

                               <b221>02</b221>

                               <b244>3000013121</b244>

                </productidentifier>

                <productidentifier>

                </productidentifier>

But when adding the next child node, it appends to the first parent node
<productidentifier> and not sequential to the last one, so that the output
looks like this:

                <productidentifier>

                               <b221>02</b221>

                               <b244>3000013121</b244>

                               <b221>03</b221>

                               <b244>9783000013126</b244>

                </productidentifier>

                <productidentifier>

                </productidentifier>

revAddXMLNode treeID, parentNode,nodeName,nodeContents, [location within the
parent node] has no more parameters to control that. I can't work with
attributes, because the content of the XML file is given. Where does LC
appends a new child? Always to the first found parent? Do I have to fiddle
around with revXMLNextSibling(treeID,siblingNode) or is there a more
straightforward approach to this?

Any experience welcome

Tiemo

 




More information about the use-livecode mailing list