Click to See Complete Forum and Search --> : XML parse error (help please)


tripwater
03-10-2005, 05:06 PM
I am new to XML. From my understanding the data between the tags is a string that can be in any format.

I am laying out a XSLT file when I find an error in the XML file.

Below is the code:


<?xml version="1.0" encoding="iso-8859-1"?>
<inventory>
<name>Inventory Account Totals</name>
<dategen>3/10/2005 3:00pm</dategen>
<enddate>3/10/2005</enddate>
<parts>
<item>
<account>121.006</account>
<desc>Inv - Parts - Briggs & Stratton</desc>
<total>$1,096.92</total>
</item>
<item>
<account>121.005</account>
<desc>Inv - Parts - Cub Cadet</desc>
<total>$2,432.05</total>
</item>

<parttotal>$3,500</parttotal>
</parts>

<units>
<item>
<account>121.006</account>
<desc>Inv - Parts - Briggs & Stratton</desc>
<total>$1,096.92</total>
</item>
<item>
<account>121.005</account>
<desc>Inv - Parts - Cub Cadet</desc>
<total>$2,432.05</total>
</item>

<unittotal>$3,500</unittotal>
</units>
</inventory>


Here is the error:

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.


--------------------------------------------------------------------------------

Whitespace is not allowed at this location. Error processing resource 'file:///C:/Documents and Settings/US/Desktop/XML tes...

<desc>Inv - Parts - Briggs & Stratton</desc>
-------------------------------^




Why is this? Is it because of the "&"? I would like to think not. THis will majorly limit what I can do as all of this info is generated dynamically from a database. And I can not filter through everything checking for certain chars. I thought what ever is between an opening and closing tag is safe except of course < > = !=

Any thoughts?

Thank you for any help.

Khalid Ali
03-10-2005, 08:15 PM
you will need to refer to w3c.org website and then read up on XML standards.
&amp; is a reserved character and you can not use it as a value for an element. you must use the ASCII enttity value for such special characters(in this particular case if you use &amp;amp; it will work)

jayshah11
03-21-2005, 10:57 AM
The error is the '&' sign that you have in data.

These characters have to be replaced by the entity references in order for them to be part of the XML Syntax by the parser.

Replace the & sign by &amp; and you should be fine.