473,324 Members | 2,166 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,324 software developers and data experts.

Error loading an XML file into XMLDocument

Hi, I have pasted the xml file below. When I try to load this xmlfile into an instance of xml document, it gives "Root element missing ".
I tried to check the well formedness and xpath queries in xmlspy and things looked fine to me.
<?xml version="1.0" encoding="utf-8" ?>
<Tasks>
<Task Name="My Task" Prime="2" Description="Some name">
<Server>SMSPAP1171M:8080</Server>
<Server>SMSPAP1171M:8180</Server>
</Task>
</Tasks>

Please tell whats wrong with this xml file.
Additionally, when I need to add a new task from the UI, how to I add it as the last element(I need to keep the all the existing ones and add this new task at the end of the file before </Tasks>) using xml writer?????
May 11 '07 #1
2 1224
I believe you need to make the Task Name line a single entity node.(correct term?) Try:
<?xml version="1.0" encoding="utf-8" ?>
<Tasks>
<Task Name="My Task" Prime="2" Description="Some name" />
<Server>SMSPAP1171M:8080</Server>
<Server>SMSPAP1171M:8180</Server>
</Tasks>

<?xml version="1.0" encoding="utf-8" ?>
<Tasks>
<Task Name="My Task" Prime="2" Description="Some name">
<Server>SMSPAP1171M:8080</Server>
<Server>SMSPAP1171M:8180</Server>
</Task>
</Tasks>
May 11 '07 #2
But then, Task is supposed to be an element with those attaributes(Name, prime, description) and child nodes Server, occurance unbounded.


I believe you need to make the Task Name line a single entity node.(correct term?) Try:
<?xml version="1.0" encoding="utf-8" ?>
<Tasks>
<Task Name="My Task" Prime="2" Description="Some name" />
<Server>SMSPAP1171M:8080</Server>
<Server>SMSPAP1171M:8180</Server>
</Tasks>
May 11 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Mark | last post by:
I get the following error (see stacktrace) while loading an XMLDocument. The document is huge and it has PI's created from Arbortext's editor. Works fine when I use MSXML2 to load the Document....
0
by: Matthew Copeland | last post by:
A little background. This is a VB.Net client application , and it uses a web reference to a web service, which has been properly refreshed. My app takes collections of two serializable...
0
by: Matthew Copeland | last post by:
A little background. This is a VB.Net client application , and it uses a web reference to a web service, which has been properly refreshed. My app takes collections of two serializable...
1
by: =?Utf-8?B?Vmlub2Q=?= | last post by:
Hi, I am having a problem doing the transform. Actually i am migrating the code from XslTranform class into XslCompiledTransform class. Here is the code that i am using in .net 1.1 private...
1
by: spiralfire | last post by:
I'm writing a parser, and im totally confused. Its apparently correct, but something is happening: I do a fread command to a char array of the entire file (it isn't big), this is the file: ...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
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...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
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...

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.