By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,213 Members | 1,086 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,213 IT Pros & Developers. It's quick & easy.

Error opening xml file

P: n/a
I'm attempting to use XmlTextReader. When I call the Read() method I get the following error
"The data at the root level is invalid. Line 1, position 1.

The xml is formatted fine. The first entry in the xml file is a valid tag

What does this error trying to tell me. I can read the file using a TextReader class just fine

Nov 12 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
br****@novell.com wrote:
I'm attempting to use XmlTextReader. When I call the Read() method I get the following error:
"The data at the root level is invalid. Line 1, position 1."

The xml is formatted fine. The first entry in the xml file is a valid tag.

What does this error trying to tell me. I can read the file using a TextReader class just fine.


Sounds like the XML isn't well-formed. Make sure you can open it in IE.

--
Oleg Tkachenko [XML MVP]
http://blog.tkachenko.com
Nov 12 '05 #2

P: n/a
I think you need an xml header.
<?xml version="1.0" encoding="utf-16" ?>
"br****@novell.com" <an*******@discussions.microsoft.com> wrote in message
news:A5**********************************@microsof t.com...
I can open the file just fine in IE. It is straight XML code without any header information.
Here's the file contents:
<fileReply><fileInfo><getFileInfo><rightsInfo><tru steeList></trusteeList><in
heritedRightsFilter><read/><write/><create/><erase/><accessControl/><fileSca
n/><modify/><supervisor/><salvage/><secure/></inheritedRightsFilter><effecti
veRights><read/><write/><create/><erase/><accessControl/><fileScan/><modify/<supervisor/></effectiveRights><result value="0"><description>success</description></result></rightsInfo><standardI
nfo><id>2432</id><parentID>133</parentID><logicalEOF>274039</logicalEOF><phy
sicalEOF>274432</physicalEOF><attributes></attributes></standardInfo><timeIn
fo><createdTime><utc>1077120240</utc><string>20040218090400</string></create
dTime><archivedTime><utc>0</utc><string>00000000000000</string></archivedTim
e><modifiedTime><utc>881856162</utc><string>19971211090242</string></modifie
dTime><accessedTime><utc>1084215475</utc><string>20040510125755</string></ac
cessedTime><metaDataModifiedTime><utc>1077120240</utc><string>20040218090400
</string></metaDataModifiedTime></timeInfo><idInfo><creator><name>.[Supervis
or].</name><id>00000003-0000-0000-00-00-000000000000</id></creator><archiver<name>Unknown

User</name><id>00000000-0000-0000-00-00-000000000000</id></archiver><modifie
r><name>.[Supervisor].</name><id>00000003-0000-0000-00-00-000000000000</id><
/modifier><metaDataModifier><name>.[Supervisor].</name><id>00000003-0000-000
0-00-00-000000000000</id></metaDataModifier></idInfo><result
value="0"><description>success</description></result></getFileInfo></fileInf
o><result value="0"><description>zOK</description></result></fileReply>
Nov 12 '05 #3

P: n/a
br****@novell.com wrote:
I can open the file just fine in IE. It is straight XML code without any header information.

Here's the file contents:
<fileReply><fileInfo><getFileInfo><rightsInfo><tru steeList></trusteeList><inheritedRightsFilter><read/><write/><create/><erase/><accessControl/><fileScan/><modify/><supervisor/><salvage/><secure/></inheritedRightsFilter><effectiveRights><read/><write/><create/><erase/><accessControl/><fileScan/><modify/><supervisor/></effectiveRights><result value="0"><description>success</description></result></rightsInfo><standardInfo><id>2432</id><parentID>133</parentID><logicalEOF>274039</logicalEOF><physicalEOF>274432</physicalEOF><attributes></attributes></standardInfo><timeInfo><createdTime><utc>107712024 0</utc><string>20040218090400</string></createdTime><archivedTime><utc>0</utc><string>00000000000000</string></archivedTime><modifiedTime><utc>881856162</utc><string>19971211090242</string></modifiedTime><accessedTime><utc>1084215475</utc><string>20040510125755</string></accessedTime><metaDataModifiedTime><utc>1077120240 </utc><string>20040218090400</string></metaDataModifiedTime></t

imeInfo><idInfo><creator><name>.[Supervisor].</name><id>00000003-0000-0000-00-00-000000000000</id></creator><archiver><name>Unknown User</name><id>00000000-0000-0000-00-00-000000000000</id></archiver><modifier><name>.[Supervisor].</name><id>00000003-0000-0000-00-00-000000000000</id></modifier><metaDataModifier><name>.[Supervisor].</name><id>00000003-0000-0000-00-00-000000000000</id></metaDataModifier></idInfo><result value="0"><description>success</description></result></getFileInfo></fileInfo><result value="0"><description>zOK</description></result></fileReply>
I can't repoduce the problem. I can read that XML with XmlTextReader
just fine. Show us your code.

--
Oleg Tkachenko [XML MVP]
http://blog.tkachenko.com
Nov 12 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.