Converting Word ML to XML
-
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-
-
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-
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.
-
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.
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?"
-
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?"
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.
-
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.
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