could this xml layout be used with xmldocument.loadxml in .net somehow

Last post 04-07-2006 1:12 PM by clean. 1 replies.

Sort Posts:

  • could this xml layout be used with xmldocument.loadxml in .net somehow

    04-07-2006, 10:46 AM
    • Member
      455 point Member
    • clean
    • Member since 02-09-2006, 10:22 AM
    • Posts 91

    i fairly new to all of this

    listed below is the format of a dynamic xml file that i create on the fly and what i am trying to do with this dynamically created xml file is the following

    XmlDocument docXml = new XmlDocument();
    docXml.LoadXml(sb.ToString()); *sb contains the contents of the xml file
    XslCompiledTransform docXsl = new XslCompiledTransform();
    docXsl.Load(Server.MapPath("items.xsl"));
    System.IO.StringWriter strStringWriter = new System.IO.StringWriter();
    docXsl.Transform(docXml, null, strStringWriter);

    and it fails abviously because its not formatted properly, but i read somewhere that you could include an ELEMENTS tag at the begining of the file which would read the xml file properly but it did not work and it gave me the following error: 'ELEMENT' is an unexpected token. The expected token is 'DOCTYPE'. Line 1, position 3.

    Could anybody provide any feedback on how to make the xml file listed below function properly with my xml commands above?

     <ROOTITEMS>
    <ITEM>
    <PONUMBER></PONUMBER>
    <LOCATION></LOCATION>
    <CODE></CODE>
    <QUANTITY></QUANTITY>
    <DATE></DATE>
    </ITEM>
    <ITEM>
    <PONUMBER></PONUMBER>
    <LOCATION></LOCATION>
    <CODE></CODE>
    <QUANTITY></QUANTITY>
    <DATE></DATE>
    </ITEM>
    <SHIPPINGINFORMATION>
    <COMPANYNAME></COMPANYNAME>
    <ADDRESS></ADDRESS>
    <CITY></CITY>
    <PROVINCE></PROVINCE>
    <STATE></STATE>
    <CONTACT></CONTACT>
    <PHONENUMBER></PHONENUMBER>
    <FAXNUMBER></FAXNUMBER>
    <CONTACTEMAIL></CONTACTEMAIL>
    </SHIPPINGINFORMATION>
    </ROOTITEMS

  • Re: could this xml layout be used with xmldocument.loadxml in .net somehow

    04-07-2006, 1:12 PM
    • Member
      455 point Member
    • clean
    • Member since 02-09-2006, 10:22 AM
    • Posts 91

    never mind i figured out what i had to do.

    I created a dtd file called po.dtd and put the ELEMENTS tag in the code above into the dtd file.

    Then in my dynmically created xml file i inputted the following:

    <!DOCTYPE rootitems SYSTEM '"

    + Server.MapPath("po.dtd") + "'>

    and it all worked out just great.

Page 1 of 1 (2 items)