Deploy custom templates - How to read and write to the XML-file?


  • Hi,

    Im deploying custom templates in word 2007. using this article:
    this is working really well. but I have alot of custom templates that needs to be sorted in different categories.
    Managing this takes a long time, so i wanted to create a Office add-in using Visual Studio to read and write to the xml-files.

    This is the xml-code im trying to read:
    <?xml version="1.0" encoding="utf-8"?>
    <o:featuredcontent lcid="1033" xmlns:o="urn:schemas-microsoft-com:office:office">
        <o:application id="WD">
            <o:featuredtemplates startdate="2007-01-01" enddate="2009-03-02">
                <!-- TEMPLATE 1 -->
                <o:featuredtemplate title="Template 1" source="\\server1\public\templates\Contoso\Source\1.dotx" >
                    <o:media mediatype="gif" filename="1.gif" source="\\server1\public\templates\Contoso\media\1.gif" />
                    <o:preview filename="1big.gif" source="\\server1\public\templates\Contoso\preview\1.gif" />

    But when im trying to read the xml-file using  XmlTextReader or any other ways of reading xml in C# I get this error:

    '.', hexadecimal value 0x00, is an invalid character. Line 2, position 1.

    Is this because its not a valid XML-file?

    Any other way to read the file? except reading it as a textfile

    Hope anyone can help me, or point me in the right direction. this is really bugging me...

    Thursday, April 16, 2009 7:20 AM

All replies