468,104 Members | 1,302 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,104 developers. It's quick & easy.

XML Parsing errors

I've added a configuration file similar to Web.config but that does not
invoke a restart when changed, just a cache dependency.

At various times I'm getting a seeingly random one of the following
errors:

This is an unexpected token. The expected token is 'NAME'. Line 6,
position 3

An unexpected end of file parsing NAME has occurred. Line 6, position 3

The specified node cannot be inserted as the valid child of this node,
because the specified node is the wrong type.

My code is the straight forward

xmlDoc = new XmlDocument();
xmlDoc.Load(@"C:/Inetpub/AppConfig.xml");

I've checked the xml in XmlSpy and it's well formed so where's the
error? The xml is :

<?xml version="1.0" encoding="utf-8" ?>
<AppConfig>
<ModificationDate>14/06/2005</ModificationDate>
<SearchEngineList>
<SearchEngine>Googlebot</SearchEngine>
<SearchEngine>Lycos</SearchEngine>
<SearchEngine>Ultraseek</SearchEngine>
<SearchEngine>Sidewinder</SearchEngine>
<SearchEngine>InfoSeek</SearchEngine>
<SearchEngine>Scooter</SearchEngine>
<SearchEngine>WebCrawler</SearchEngine>
<SearchEngine>UTV</SearchEngine>
<SearchEngine>girafabot</SearchEngine>
<SearchEngine>WISEnutbot</SearchEngine>
<SearchEngine>MSIECrawler</SearchEngine>
<SearchEngine>msnbot</SearchEngine>
<SearchEngine>yahoo</SearchEngine>
<SearchEngine>teoma</SearchEngine>
<SearchEngine>Teoma</SearchEngine>
<SearchEngine>grub-client</SearchEngine>
<SearchEngine>iltrovatore</SearchEngine>
<SearchEngine>miragorobot</SearchEngine>
<SearchEngine>jetbot</SearchEngine>
<SearchEngine>ConveraCrawler</SearchEngine>
<SearchEngine>NutchCVS</SearchEngine>
<SearchEngine>sohu-search</SearchEngine>
<SearchEngine>aipbot</SearchEngine>
<SearchEngine>IRLbot</SearchEngine>
<SearchEngine>DTAAgent</SearchEngine>
<SearchEngine>NG/2.0</SearchEngine>
<SearchEngine>OmniExplorer_Bot</SearchEngine>
<SearchEngine>YellCrawl</SearchEngine>
<SearchEngine>LWP::Simple</SearchEngine>
<SearchEngine>Gigabot</SearchEngine>
<SearchEngine>MJ12bot</SearchEngine>
<SearchEngine>USyd-NLP-Spider</SearchEngine>
<SearchEngine>Baiduspider</SearchEngine>
<SearchEngine>EasyDL</SearchEngine>
<SearchEngine>Baiduspider</SearchEngine>
</SearchEngineList>
<IPAddressList>
<IPAddress>123.123.123.123</IPAddress>
</IPAddressList>
</AppConfig>

Nov 12 '05 #1
2 1690
I've since got the simultaneous errors of
The 'SearchEngine' start tag on line '13' doesn't match the end tag of
'' in file 'AppConfig.xml'. Line 13, position 28.
and
The 'SearchEngine' start tag on line '13' doesn't match the end tag of
'SearchEngineList' in file 'AppConfig.xml'. Line 42, position 4.

then shortly after
The 'SearchEngine' start tag on line '11' doesn't match the end tag of
'>' in file 'AppConfig.xml'. Line 11, position 29.
and
The 'SearchEngine' start tag on line '11' doesn't match the end tag of
'SearchEngineList' in file 'AppConfig.xml'. Line 41, position 4.
Also
The local name for elements or attributes cannot be null or an empty
string.

Am I missing something about the encoding or something? The whitespace
characters are just as in my previous post.

Nov 12 '05 #2

Chris wrote:
*I've since got the simultaneous errors of
The 'SearchEngine' start tag on line '13' doesn't match the end tag
of
'' in file 'AppConfig.xml'. Line 13, position 28.
and
The 'SearchEngine' start tag on line '13' doesn't match the end tag
of
'SearchEngineList' in file 'AppConfig.xml'. Line 42, position 4.

then shortly after
The 'SearchEngine' start tag on line '11' doesn't match the end tag
of
'>' in file 'AppConfig.xml'. Line 11, position 29.
and
The 'SearchEngine' start tag on line '11' doesn't match the end tag
of
'SearchEngineList' in file 'AppConfig.xml'. Line 41, position 4.
Also
The local name for elements or attributes cannot be null or an empty
string.

Am I missing something about the encoding or something? The
whitespace
characters are just as in my previous post. *


I struggled several days with a parsing error in xml-files in BizTalk.
The problem was that my editor, TextPad.exe, saves xml-files in
unicode, by default! A sample was generated from the schema, but after
I modified it, it stopped working! Very confusing.

--
Nils_Thorell
------------------------------------------------------------------------
Posted via http://www.mcse.ms
------------------------------------------------------------------------
View this thread: http://www.mcse.ms/message1709335.html

Nov 12 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

8 posts views Thread by Gerrit Holl | last post: by
16 posts views Thread by Terry | last post: by
19 posts views Thread by asrs63 | last post: by
24 posts views Thread by Marc Dubois | last post: by
26 posts views Thread by Ramon F Herrera | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.