How to convert Word Bookmarks to XML nodes. RRS feed

  • Question

  • Hello Everyone,

    I have a Word Bookmarked document, where i have some paragraphs which are bookmarked with some naming conventions. Now, I want to create a XML document based on the bookmark name in such a way that it should create a parent child relationship between each other using Bookmark ranges.

    Does any one knows any Algorithm for that?


    Shahab Abbasi

    Monday, November 18, 2013 2:57 PM

All replies

  • Do these bookmarks have any rules?



    And should named like:








    The relationship and algorithm are based on your rules.

    Nice day. : )

    remember make the reply as answer and vote the reply as helpful if it helps.

    Tuesday, November 19, 2013 8:24 AM
  • Thanks for the reply.
    Sorry for late responding.

    No, we don't have any rules defined. Every bookmark starts with "_bk" + Number. Lets say, it starts with "_bk01", "_bk02", "_bk03" and so on. Yes, we do have one information available in a separate XML file where we can have schema context defined for each bookmark.

    Like for "_bk01" - > doc/docID

    "_bk02" - > doc/Name

    "_bk03" - > doc/Name/First_Name

    "_bk04" - > doc/Name/Last_Name

    "_bk05" - > doc/Address

    This way we can have all the parent child relationships defined. Now what type of Algorithm we need to create. I am very confused in that.

    Let me know, if you need any input from me !


    Shahab Abbasi

    Tuesday, November 26, 2013 1:57 PM
  • Hi Shahab

    IN order for code to be able to do something like you envision there needs to be a recognizable pattern to work with. If you have no rules defined for the bookmark naming, how can the code know what bookmarks are "parents" and which are "child nodes"? You first need to explain that logic to us before we can make any suggestions...

    Please also tell us which programming language you're using and what version of Word has created these documents.

    Cindy Meister, VSTO/Word MVP, my blog

    Saturday, December 7, 2013 12:49 PM