Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

XPath query on multiple namespace XML document

843834Jul 22 2008 — edited Jul 23 2008
Hi,
I am trying to locate an element in a WordML XML document using XPath.
The structure looks like:
...
<w:body>
	<wx:sect>
		<aml:annotation aml:id="0" w:type="Word.Bookmark.Start" w:name="DOC0000966"/>
...
So I use the following expression
"/wordDocument//body/sect"
wich gives me a list with the <w:sect> nodes.
Then I search for
"annotation[@type='Word.Bookmark.Start']"
starting from each <w:sect> node. This yields the <aml:annotation> elem.

So far so good.
Now I have to handle a second case as well.
...
<w:body>
	<wx:sect>
	<w:p>
		<aml:annotation aml:id="0" w:type="Word.Bookmark.Start" w:name="DOC0000966"/>
...
As you can see the <aml:annotation> is nested inside a <w:p> elem.
My intention was to use the expression
"//annotation[@type='Word.Bookmark.Start']"
to handle both cases, but this expression does not match neither.

I have tried several different alternatives with expressions and NamingContext implementations, none working.

What am I missing?

Thanks in advance,

Mariano.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 20 2008
Added on Jul 22 2008
1 comment
798 views