Alternative Syntax for an XPath in nokogiri, parsing an ODF



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).


Is there an alternative way to reference the section of the document? The section's text:name will be unique for the whole document so miss-referencing would not be an issue.


No comments:

Post a Comment