Okay, I can see it is my day for sending silly emails. I see that the issue is much more involved due to nesting in other elements such as tables....
Cheers, Ian ---------- Forwarded message ---------- From: Ian <[email protected]> Date: Sun, May 27, 2012 at 5:22 PM Subject: Number of paragraphs To: [email protected] Hi All, I am using the ODFDOM code to poke around looking into the structure of ODF documents. I am still trying to figure out much of the detail but hit a possible design issue with the SimpleAPI. I was simply trying to derive the number of paragraphs in my almost "Hello World" document. I knew how many I expected. But struggled a little to get the number from the API. My first attempt was to use OdfElement paraContainer = document.getParagraphContainerElement(); NodeList paras = paraContainer.getChildNodes(); And get the number of nodes. Because of the <text:sequence-decls> in my document the number was too high. What I really need is. NodeList realPs = paraContainer.getElementsByTagName("text:p"); If the aim of the Simple API is to avoid users needing to know XML etc then I think we need to add a numberOfParagraphs function or equivalent. I assume this also applies in other cases too. Then again it may only be me that is interested in quantifying the contents of a document? And if it where added where would we stop? The additional variations could be huge, effectively providing a query interface and count function. I am also sending this to see how many folks there are out in the ether, active on ODFDOM. I am still getting my head around the details of how it hangs together and the code generation templates etc. But will be happy to help where I can. Cheers, Ian
