right now i am getting this Invalid at the top level of the document. Error processing resource 'http:/....
Main Topics
Browse All Topicshi
i am getting this error when the xml is opend in the browser. it does tell me the node. however, what characters are not allowed in XML? how can i test that? what should i do to debug.
The XML page cannot be displayed
Cannot view XML input using XSL style sheet. Please correct the error and then click the Refresh button, or try again later.
An invalid character was found in text content. Error processing resource
<NodeName>
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
right now i am getting this Invalid at the top level of the document. Error processing resource 'http:/....
Contacting through email is against board policy ... However there are a couple of options
a) You can upload the file somewhere and post the link here. You can remove the file once your problem has been solved.
www.ee-stuff.com provides space for this purpose.
b) You can edit the file to replace some names and post the relevant sections here.
i saved using xml spy.
here are the starting lines
<?xml version="1.0" encoding="utf-8"?>
<!-- edited with XMLSpy v2006 U.... -->
<!-- edited with XML Spy v4.1 U (http://www.xmlspy.com) -->
<?xml-stylesheet type="text/xsl" href="http://serYU/gerixx.
<EnsDocument xmlns:xsd="http://www.w3.o
infact this is the xml file which is giving that error
whose start is
<?xml version="1.0" encoding="utf-8"?>
<FunGreat xmlns:xsi="http://www.w3.o
----followed by other nodes.
anything amiss
> It could be that you have an unsupported character encoding of the file. Make sure it's UTF-8.
That is the wrong advice, this is obviously a different encoding
It seems that you created the file in XML-Spy, then this should not happen,
I assume that you cut and pasted some part of the text in a different editor or through a script.
The µ likely is the problem, there is no single byte representation for µ in UTF-8 and there is in ISO Latin
Basically you are indicating the wrong encoding in your XML
Try replacing <?xml version="1.0" encoding="utf-8"?>
with <?xml version="1.0" encoding="ISO-8859-1"?>
using a text editor, not XML Spy
That could solve your issue in the short run, but you should be more cautious constructing your XML and making sure you label it with the right encoding.
If you are mixing bits from different encodings (which usually creates a mess) you should transform everything to UTF-8 before bringing stuff together
hope this helps
Geert
hi geritone thanks for the reply.
so you mean to say if put encoding="ISO-8859-1" then µ will be accepted? which of the two iso or utf provides a wide range of accpeted characters?
i mean is it that if i use utf some 29 characters will be considered invalid by parser whereas if i use iso standard then only 10 will be considered invalid?
also cant we know beforehand when we save the xml in the editor that a particular character is invalid
appreciate your reply
UTF-8 accepts all unicode characters but only 100 or so as a one byte character
ISO-8859 accepts about 200 characters, all as one byte, but nothing more
I recommend that you use UTF-8, because there are no surprises there
Here is how it works, UTF-8 only uses 7bits per byte for characters and has the first bit set to zero. All characters with the first bit set to one, are control characters, to indicate that the next byte belongs to the same character
(these control characters are like Ã, if you look at them in a non UTF-8 aware editor) A UTF-8 character can have a dynamic size ranging from 1 to 4 bytes, and the control characters indicate the size
The encoding of the first 100 characters is the same in UTF-8 and ISO-8859-1
That is why you only see the difference when you have a character outside this range.
µ is in the second half of the ISO encoding, but its byte value has the first bit set to 1 and is not an accepted control character... that is why the parser clearly sees that this character is not allowed by the encoding you have choosen
Having said all of this. I see two questions.
- how to solve this particular issue: change your encoding to iso-8859-1
- which encoding to choose in general: I recommend UTF-8 since it simply has more characters
cheers
Geert
1. yes, I would be very surprised that XML-Spy would allow you to add characters in the wrong encoding in your XML, but then again, XML Spy is not very good at all (nice interface on top of a buggy non standardized core)... If you can take a recommendation... use www.stylusstudio.com instead)
2. well, you could escape every character if you want
µ would be μ
that would be the same, regardless of the encoding, since it is the unicode number (note this one takes 8 bytes)
I often do that: use ISO-8859-1, and use the entities to ecape unsupported characters
you could view the XML in IE to see that you have the correct escape
cheers
Geert
correct, I have enterprise and professional licenses for both
no need to go into detail, but I like both for different purposes
and I want to be thorough in testing with multiple environments
before I deliver something. Plus they are both good at different tasks
(oxygen can be slow on XPath in very big files for example
but has a better Berkeley DB XML interface, Stylus has pipelines, Oxygen has modules, Stylus makes it easier to work with profiles and has some GUI advantages, Oxygen works better with small unsaved samples)
but one out of two would be fine for you
cheers
Geer
Business Accounts
Answer for Membership
by: sunnycoderPosted on 2007-09-18 at 19:50:28ID: 19918064
Hello samir25,
e.com/Web/ Web_Langua ges/XML/ Q_ 21620392.h tml
Here is a complete explanation
http://www.experts-exchang
Most common cause is < and & in text ...
you need to escape "<" by "<" and "&" by "&"
Regards,
sunnycoder