Finding and returning a list of tags from a document

Hello,

I’m a beginner with Aspose Words. Can someone point me in the right direction with this?

I am trying to parse a document which will contain various “tags” in the form of “[[TAG_NAME]]” (sans quotes). What I want do currently is to be able to fetch a list of all the tags that a document contains. Eg if a document was:

------------------------------------------------------------------------
Hello [[NAME]], how are you today? From [[FROM]].
-------------------------------------------------------------------------

I would want my tag fetcher method to return a list of 2 strings, NAME and FROM.

Any advice and pointers on how to do this would be very appreciated!

Hi Adam,

Thanks for your inquiry. First of all, please note that Aspose.Words is quite different from the Microsoft Word’s Object Model in that it represents the document as a tree of objects more like an XML DOM tree. When you load a Word document into Aspose.Words, it builds its DOM and all document elements and formatting are simply loaded into memory. Please read the following articles for more information on DOM:
https://docs.aspose.com/words/java/aspose-words-document-object-model/
https://docs.aspose.com/words/java/logical-levels-of-nodes-in-a-document/

Regarding your query, extract specific text from document, I suggest you to read following articles for your kind reference.
https://docs.aspose.com/words/java/find-and-replace/

Please feel free to ask if you have any question about Aspose.Words, we will be happy to help you.