Hi,
If I have something like:
<myfamily>
<member>Father Brian</member>
<member>Mother Elisabeth</member>
<member>Sister Judy</member>
<member>brother Lathan</member>
</myfamily>
and I want to update the <member>Sister Judy</member> element only,
based on the fact that I want to update only the element that has the
word "Sister" in it's text content. (Let's say I want to change the name
of my Sister so what I want as a result is <member>Sister Elisa</member>
and I still want to keep all the other <member/> elements as they are).
I use the XML::LibXML library more specifically: XML::LibXML::Document,
XML::LibXML::Node, XML::LibXML ::Element.
How do I do that?
I tried to use the findNodes (myfamily/member) (in XML::LibXML::Node)
method to extract into an array the list of nodes that follow the xpath
expression: myfamily/member. Then I looped through my array until I
found the element with the word Sister in it's text context. Once
found, I created a new node using new('Sister Elisa')
(inXML::LibXML::Element) then I used $oldNode->replaceNode($newNode) (in
XML::LibXML::Node). It seems to change the value but my xml document is
not being updated...
Melanie
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
- How do I update a single instance of a repeatable element ... Melanie Rouette
- How do I update a single instance of a repeatable ele... Melanie Rouette
- Re: How do I update a single instance of a repeatable... Melanie Rouette