Windows Vista Forums

Error while reading XML file having DOCTYPE
  1. #1


    Nikhil R. Bhandari Guest

    Re: Error while reading XML file having DOCTYPE

    Still getting the same error for line 1



    Cannot convert value "System.Object[]" to type "System.Xml.XmlDocument".
    Error: "'>' is an unexpected token. The expected token is '"' or '''. Line
    1, position 58." At line:1 char:28
    + [xml]$FileContents <<<< = Get-Content -read 10kb "C:\test.xml"


    "Jean" <repondre@groupe.svp> wrote in message
    news:mn.6b527d73069f0c24.56820@windows...
    >> It is not parsing the <!DOCTYPE QXML PUBLIC '-//ABC//DTD XML QBD
    >> 2.0//EN'> line. If I remove this then the XML is properly read.

    >
    > doctype *must be* the first line
    >
    > regards,
    >
    > --
    > Jean - JMST
    > Belgium
    >
    >




      My System SpecsSystem Spec

  2. #2


    Nikhil R. Bhandari Guest

    Error while reading XML file having DOCTYPE

    I am getting following error while reading a XML file.

    PS> [xml]$FileContents = Get-Content -read 10kb "C:\test.xml"
    Cannot convert value "System.Object[]" to type "System.Xml.XmlDocument".
    Error: "'>' is an unexpected token. The expected token is '"' or '''. Line
    2, position 58."At line:1 char:28
    + [xml]$FileContents <<<< = Get-Content -read 10kb "C:\test.xml"


    Here are the contents of my test.xml file

    <?xml version="1.0" ?>
    <!DOCTYPE QXML PUBLIC '-//ABC//DTD XML QBD 2.0//EN'>
    <QXML>
    <XMLMsgsRq onError="continueOnError">
    <Rq requestID="11002_Add">
    <Add>
    <Name>Cust1</Name>
    <FirstName>First</FirstName>
    <OpenBalance>456.12</OpenBalance>
    </Add>
    </Rq>
    </XMLMsgsRq>
    </QXML>


    It is not parsing the <!DOCTYPE QXML PUBLIC '-//ABC//DTD XML QBD 2.0//EN'>
    line. If I remove this then the XML is properly read.

    Is this the way the XML should be read? Or there is some problem with
    PowerShell cmdlet?

    Thanks,
    Nikhil



      My System SpecsSystem Spec

  3. #3


    Jean Guest

    Re: Error while reading XML file having DOCTYPE

    > It is not parsing the <!DOCTYPE QXML PUBLIC '-//ABC//DTD XML QBD 2.0//EN'>
    > line. If I remove this then the XML is properly read.


    doctype *must be* the first line

    regards,

    --
    Jean - JMST
    Belgium



      My System SpecsSystem Spec

  4. #4


    Marco Shaw Guest

    Re: Error while reading XML file having DOCTYPE


    "Nikhil R. Bhandari" <nikhilbhandari@hotmail.com> wrote in message
    news:%23w4Au2WZHHA.2436@TK2MSFTNGP06.phx.gbl...
    >I am getting following error while reading a XML file.


    You might want to view this thready from March 5th: "System.Net.WebClient
    and XML"

    Marco



      My System SpecsSystem Spec

  5. #5


    The Other Nice Man Guest

    Re: Error while reading XML file having DOCTYPE

    On 13 Mar, 12:35, "Nikhil R. Bhandari" <nikhilbhand...@hotmail.com>
    wrote:
    > Still getting the same error for line 1
    >
    > Cannot convert value "System.Object[]" to type "System.Xml.XmlDocument".
    > Error: "'>' is an unexpected token. The expected token is '"' or '''. Line
    > 1, position 58." At line:1 char:28
    > + [xml]$FileContents <<<< = Get-Content -read 10kb "C:\test.xml"
    >
    > "Jean" <repon...@groupe.svp> wrote in message
    >
    > news:mn.6b527d73069f0c24.56820@windows...
    >
    >
    >
    > >> It is not parsing the <!DOCTYPE QXML PUBLIC '-//ABC//DTD XML QBD
    > >> 2.0//EN'> line. If I remove this then the XML is properly read.

    >
    > > doctype *must be* the first line

    >
    > > regards,

    >
    > > --
    > > Jean - JMST
    > > Belgium- Hide quoted text -

    >
    > - Show quoted text -


    Should you use " rather than ' in Doctype?

    Try <!DOCTYPE QXML PUBLIC "-//ABC//DTD XML QBD 2.0//EN">



      My System SpecsSystem Spec

Error while reading XML file having DOCTYPE problems?

Similar Threads
Thread Thread Starter Forum Replies Last Post
DOCTYPE in XML (strange behaviour) wofat68 PowerShell 0 15 Sep 2009
Find hidden file, Reading from txt file niva VB Script 3 07 Nov 2008
reading coma seperated text file error Daz VB Script 2 11 Jun 2008
error reading file Richard Bell Vista music pictures video 0 15 Apr 2008
Doctype in XmlTextWriter Arto Viitanen PowerShell 2 21 Feb 2007