We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Problem navigating through a document nodecollection

EDIT: i had the old library version wrong (typo)
Hi,

following the advice of your live support i'm opening this thread to report an issue i'm having with the aspose.words library.
A client of mine who is in posion of a regular licence for aspose 11.8 has decided to have me try the latest version (14.8) of the library, in order to test compatibilities.
To this end he required a 30day evaluation licence, which i'm using.
Basically i need to loop through a document nodecollection and extract the one that presents a given tag. This used to work perfectly with the old version of the library, but it's not working with the latest one.
I've followed the code with the debugger and i found that, even though the nodecollection is popolated correctly, every loop i try to use is simply skipped.


Here is the snippet of code i'm using. To test it you can just use any document with tags.

Since it is a function, i've stripped the header just for clarity. I've included both ways i tried to navigate the document, even though with the former library i was using the for.


Document curr = new Document("document.docx");
StructuredDocumentTag resultSDT = null;
NodeCollection nc = this.mQuestionDocument.getChildNodes(NodeType.STRUCTURED_DOCUMENT_TAG, true);
for (Object n : nc) {
StructuredDocumentTag s = (StructuredDocumentTag) n;
if (s.getTag().contains("given_tag")) {
return s;
}
}
while (nc.iterator().hasNext()) {
StructuredDocumentTag s = (StructuredDocumentTag) nc.iterator().next();
if (s.getTag().contains("given_tag")) {
return s;
}
}
return resultSDT;


thanks a lot for any help!

Alberto

Hi Alberto,


Thanks for your inquiry. Did you manage to fix the issue on your side with the latest version of Aspose.Words 14.9.0 or are you still in need of assistance?

Best regards,

Hi,


thanks for the quick answer.
I tried updating to 14.9 but the problem still remains…

Thanks

Alberto

Also, i tried using an older version amongst the one downloadable on your site (13.10), but still the problem remains.

Could it be something related to the license?

Allright, i think i found the problem.

I’m using netbeans as my current IDE, and with it you can import various libraries in the current project and the select a posteriori which one to actually activate.
Turns out that the version i was using (11.8) didn’t mind having other “inactive” aspose versions in the project, but the most recent ones did.
To make it work i simply deleted completely the references to those libraries.

I hope this helps!

Alberto

Hi Alberto,


Thanks for the additional information. It is great you were able to find what you were looking for. Please let us know any time you have any further queries.

Best regards,