473,378 Members | 1,493 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

The data at the root level is invalid. Line 1, position 2. -- using LoadXML - Help?

I've discovered I need to use LoadXML instead of Load for an xml
string versus an xml file.

HOWEVER, I get the above message when .net goes to load the string.
The string comes from an xmlDoc.OuterXML save resulting in:

<?xml version="1.0"?>
<WorkFlow> etc., etc.

So, when I save this xmlDoc.outerxml to a database field, do I need to
remove that first? If so, wouldn't it not work when I then load the
string as xml again?

Also, I can't figure out how to delete that particular node...

Any clues appreciated...as always.

Thanks,

Kathy
Nov 11 '05 #1
1 5365
It works for me:
string xmlString = "<?xml version='1.0'?><WorkFlow><Test
test='test'/></WorkFlow>";

XmlDocument xmlDoc = new XmlDocument();

xmlDoc.LoadXml(xmlString);

Console.WriteLine(xmlDoc.DocumentElement.OuterXml) ;

Can you be more precise what doesn't work in your case?
(Simple repro will be appreciated :-)
Thanks.
Sergey
--
This posting is provided "AS IS" with no warranties, and confers no rights.

"KathyB" <Ka**********@attbi.com> wrote in message
news:75**************************@posting.google.c om...
I've discovered I need to use LoadXML instead of Load for an xml
string versus an xml file.

HOWEVER, I get the above message when .net goes to load the string.
The string comes from an xmlDoc.OuterXML save resulting in:

<?xml version="1.0"?>
<WorkFlow> etc., etc.

So, when I save this xmlDoc.outerxml to a database field, do I need to
remove that first? If so, wouldn't it not work when I then load the
string as xml again?

Also, I can't figure out how to delete that particular node...

Any clues appreciated...as always.

Thanks,

Kathy

Nov 11 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Alan Wang | last post by:
Hi there, I got this message ("The data at the root level is invalid. Line 1, position 1.") when I moved the application from my workstation to Windows 2003 web server. But the wired thing the...
9
by: MR | last post by:
I get the following Exception "The data at the root level is invalid. Line 1, position 642" whenever I try to deserialize an incoming SOAP message. The incoming message is formed well and its...
0
by: XML newbie: Urgent pls help! | last post by:
I am using VB.Net. Asset List is a long array of AssetIds. I declare it as: Dim AssetList(0) As Long AssetList(0) = 47288 Now, I pass an array of AssetIDs as long from here into the...
2
by: =?Utf-8?B?am1ncm8=?= | last post by:
I created a web service in visual studio 2003, tested it with a sample.xml file from a vendor we are using, and it worked exactly like it should. I depoloyed it to our server, created a project...
1
by: paulnamroud | last post by:
Hi all, I wrote a stored procedure with ms sql 2005 which returns a string parameter. This parameter contains differents xml elements and it's well formated. First, its works fine when i call...
4
by: johnsonkt | last post by:
hi all , when m trying to validate my xml using xsd file it gives me the following error "Data at the root level is invalid. Line 1, position 1" i tried to open the XML file using IE and there...
1
by: ayemyat | last post by:
Hi All, I have a remoting service which consumes the web service in another server. I have the following exception throw by the web service. System.Xml.XmlException: The data at the root level...
2
by: Cirene | last post by:
My ASP.NET project builds fine (VS2008). I added a new web deployment project. When I try to build it I get: Data at the root level is invalid. Line1, position 1. (The file is web.config,...
3
by: Hamayun Khan | last post by:
Hi I get the following error Server Error in '/teachnetwork' Application. -------------------------------------------------------------------------------- Parser Error Description: An...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.