Windows Vista Forums
Vista Forums Home Join Vista Forums Webcasts Windows 7 Forum Vista Tutorials Tags

Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
Register at Vista forums...the world biggest Windows Vista resource Join Vista Forums Now

Go Back   Vista Forums > Microsoft Technical Newsgroups > PowerShell

Error while reading XML file having DOCTYPE

Update your Vista Drivers Update Your Drivers Now!!
Closed Thread
 
Thread Tools Display Modes
Old 03-13-2007   #1 (permalink)
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
Old 03-13-2007   #2 (permalink)
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
Old 03-13-2007   #3 (permalink)
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
Old 03-13-2007   #4 (permalink)
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
Old 03-13-2007   #5 (permalink)
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
Closed Thread

Thread Tools
Display Modes



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to bypass DOCTYPE when loading xml document Garios PowerShell 2 08-20-2008 03:27 PM
reading coma seperated text file error Daz VB Script 2 06-11-2008 07:08 AM
error reading file Richard Bell Vista music pictures video 0 04-15-2008 04:57 PM
RE: Reading XML Patch File for ESX in PowerShell RichS PowerShell 8 02-01-2008 05:49 PM
Doctype in XmlTextWriter Arto Viitanen PowerShell 2 02-21-2007 01:41 AM


Vistax64.com is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media 2005-2008

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51