Create XPath from Child Elements

gatsolinjqm

New Member
I want to add an \[code\]XPath\[/code\] attribute to all \[code\]<definition>\[/code\] tags in my XML document. The XPath's value will come from a nested tag \[code\]<term>Test123</term>\[/code\] inside each \[code\]<definition>\[/code\] tag. I'm using the \[code\]import org.w3c.dom.Document;\[/code\] object. When I run this line with my really long XML file then it tells me that there are 539 instances of the \[code\]<definition>\[/code\] tag:\[code\]System.out.println(inputDOM.getDocumentElement().getElementsByTagName("definition"));\[/code\]So the end result is that there must be a \[code\]Document\[/code\] object that has set all the definition tags from the term tags, for example \[code\]<definition XPath="Test123"> <term>Test123</term> </definition>\[/code\]
 
Back
Top