I have a pretty straightforward ODF document that I want to parse with nokogiri.
The XML looks like this:
<office:body>
<office:text>
<text:sequence-decls>
...
</text:sequence-decls>
<text:section text:name="categorylevel1" text:style-name="Sect1">
<text:p text:style-name="Title">[CATEGORY_LEVEL_1_NAME]</text:p>
</text:section>
</office:text>
Currently I'm trying to select the categorylevel1
section of the document. The library I'm using generates the XPath automatically and yields
".//text:section[@text:name='categorylevel1']"
which is correct. Now the problem is the library (nokogiri) seems to accept this path under MRI but not under JRuby (throws a SyntaxError). Apparently the Java version of the library does not support namespace attributes.
Is there an alternative way to reference the section of the document? For example just by using the text:name
attribute? Is there a way to ignore the namespace? The section's text:name
attribute value will be unique for the whole document so miss-referencing would not be an issue.