Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. XML / XSL
  4. Converting Word ML to XML

Converting Word ML to XML

Scheduled Pinned Locked Moved XML / XSL
xmlhtmlasp-netwpfcom
5 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    Tejabhiram
    wrote on last edited by
    #1

    Hey everyone When i save a word document as an XML file it write a large amount of data into the xml document. I have used an XSL file to only capture the required data from the wordML to my own xml file. This customized xml file should have only the tags specified in the xslt. Look into the file below <?xml version="1.0" encoding="UTF-8" standalone="yes" ?> - <pkg:package xmlns:pkg="http://schemas.microsoft.com/office/2006/xmlPackage"> - <pkg:part pkg:name="/_rels/.rels" pkg:contentType="application/vnd.openxmlformats-package.relationships+xml" pkg:padding="512"> - pkg:xmlData - <Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"> <Relationship Id="rId3" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties" Target="docProps/app.xml" /> <Relationship Id="rId2" Type="http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties" Target="docProps/core.xml" /> <Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" Target="word/document.xml" /> </Relationships> </pkg:xmlData> </pkg:part> - <pkg:part pkg:name="/word/_rels/document.xml.rels" pkg:contentType="application/vnd.openxmlformats-package.relationships+xml" pkg:padding="256"> - pkg:xmlData - <Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"> <Relationship Id="rId3" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/webSettings" Target="webSettings.xml" /> <Relationship Id="rId2" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/settings" Target="settings.xml" /> <Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles" Target="styles.xml" /> <Relationship Id="rId5" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme" Target="theme/theme1.xml" /> <Relationship Id="rId4" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/fontTable" Target="fontTable.xml" /> </Relationships> </pkg:xmlData> </pkg:part> - <pkg:part pkg:name="/word/document.xml" pkg:contentType="application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml"> - pkg:xmlData - <w:document xmlns:ve="http://schemas.openxmlformats.org/markup-

    L 1 Reply Last reply
    0
    • T Tejabhiram

      Hey everyone When i save a word document as an XML file it write a large amount of data into the xml document. I have used an XSL file to only capture the required data from the wordML to my own xml file. This customized xml file should have only the tags specified in the xslt. Look into the file below <?xml version="1.0" encoding="UTF-8" standalone="yes" ?> - <pkg:package xmlns:pkg="http://schemas.microsoft.com/office/2006/xmlPackage"> - <pkg:part pkg:name="/_rels/.rels" pkg:contentType="application/vnd.openxmlformats-package.relationships+xml" pkg:padding="512"> - pkg:xmlData - <Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"> <Relationship Id="rId3" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties" Target="docProps/app.xml" /> <Relationship Id="rId2" Type="http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties" Target="docProps/core.xml" /> <Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" Target="word/document.xml" /> </Relationships> </pkg:xmlData> </pkg:part> - <pkg:part pkg:name="/word/_rels/document.xml.rels" pkg:contentType="application/vnd.openxmlformats-package.relationships+xml" pkg:padding="256"> - pkg:xmlData - <Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"> <Relationship Id="rId3" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/webSettings" Target="webSettings.xml" /> <Relationship Id="rId2" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/settings" Target="settings.xml" /> <Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles" Target="styles.xml" /> <Relationship Id="rId5" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme" Target="theme/theme1.xml" /> <Relationship Id="rId4" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/fontTable" Target="fontTable.xml" /> </Relationships> </pkg:xmlData> </pkg:part> - <pkg:part pkg:name="/word/document.xml" pkg:contentType="application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml"> - pkg:xmlData - <w:document xmlns:ve="http://schemas.openxmlformats.org/markup-

      L Offline
      L Offline
      Lee Humphries
      wrote on last edited by
      #2

      Tejabhiram wrote:

      But to convert WordML to XML i need a convertor

      Do you mean something to read the WordML as XML to feed it to your XSLT, or do you mean something to actually run your XSLT? For the former, use something like 7-zip to extract the source files from inside the docx - I'm guessing that you're already doing this though. For the latter you can use the msxml commandline tool, or if you want to code it I'd use the .Net XSL compiled transform in your code. Or Saxon if you need something in the Java domain

      I just love Koalas - they go great with Bacon.

      T 1 Reply Last reply
      0
      • L Lee Humphries

        Tejabhiram wrote:

        But to convert WordML to XML i need a convertor

        Do you mean something to read the WordML as XML to feed it to your XSLT, or do you mean something to actually run your XSLT? For the former, use something like 7-zip to extract the source files from inside the docx - I'm guessing that you're already doing this though. For the latter you can use the msxml commandline tool, or if you want to code it I'd use the .Net XSL compiled transform in your code. Or Saxon if you need something in the Java domain

        I just love Koalas - they go great with Bacon.

        T Offline
        T Offline
        Tejabhiram
        wrote on last edited by
        #3

        Hey Lee, Ok let me explain it to u i detail. I need to write a .NET application which can help me open a normal xml file in word. Then when the user modifies the content, i need to store the modified content back to the original xml file. In order to do this, first i am writing a xslt to convert my xml file to word file. Then when the modification is done,I am saving the Word Document as WordML, writing another inverse xsl file to convert WordMl to the original xml format. In the XML to word process, the word itself is taking care of the conversion process. But in the reverse process, I am not able to figure out how to convert the file back to a normal xml file. From you questions I analyuze that i am trying to do the latter part, i.e run my xsl. Now to do that, you have suggested me to use the .NET XSL compiled transform i my code. How do i do that? Where can I find information regarding this? Please help me out Thanks in Advance Teja "Why to be a MAN when you can be a SUCCESS?"

        L 1 Reply Last reply
        0
        • T Tejabhiram

          Hey Lee, Ok let me explain it to u i detail. I need to write a .NET application which can help me open a normal xml file in word. Then when the user modifies the content, i need to store the modified content back to the original xml file. In order to do this, first i am writing a xslt to convert my xml file to word file. Then when the modification is done,I am saving the Word Document as WordML, writing another inverse xsl file to convert WordMl to the original xml format. In the XML to word process, the word itself is taking care of the conversion process. But in the reverse process, I am not able to figure out how to convert the file back to a normal xml file. From you questions I analyuze that i am trying to do the latter part, i.e run my xsl. Now to do that, you have suggested me to use the .NET XSL compiled transform i my code. How do i do that? Where can I find information regarding this? Please help me out Thanks in Advance Teja "Why to be a MAN when you can be a SUCCESS?"

          L Offline
          L Offline
          Lee Humphries
          wrote on last edited by
          #4

          OK, Sorry for the shameless plug, but get the code for my article - Introduction to XPS[^] this includes code to use .Net Compiled Transform. Don't worry if you're a VBer I'm sure you can figure out the C#.

          I just love Koalas - they go great with Bacon.

          T 1 Reply Last reply
          0
          • L Lee Humphries

            OK, Sorry for the shameless plug, but get the code for my article - Introduction to XPS[^] this includes code to use .Net Compiled Transform. Don't worry if you're a VBer I'm sure you can figure out the C#.

            I just love Koalas - they go great with Bacon.

            T Offline
            T Offline
            Tejabhiram
            wrote on last edited by
            #5

            Hey Lee ya i googled it from ur earlier reply and was able to find the VB code and i just tested it for transformation. It worked. wow, i have these so called senior developers on my side and it dint strike them when i asked them for this transformation tool. K thanks a million. Regards Teja

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups