Say I have an XmlDocument with the XML:
<office:body>
<text:p>One</text:p>
<text:p>two
<text:span>three
<text:line-break/>four
<text:line-break/>five
<text:line-break/>six
</text:span>seven
</text:p>
<text:p>eight</text:p>
<table:table>
<table:table-column>
<table:table-column>
<table:table-row>
<table:table-cell>
<text:p>
<text:span>nine</text:span>
</text:p>
</table:table-cell>
<table:table-cell>
<text:p>
<text:span>ten</text:span>
</text:p>
</table:table-cell>
</table:table-row>
</table:table>
</office:body>
How can I extract just the words, one at a time?
You can do it with an
XMLReader, like this:You need to add a root tag to deal with XML namespaces, and fix the well-formedness error in your XML for this to work.