Page 1 of 1

XSD problem with &

Posted: Fri Aug 20, 2004 4:40 pm
by muzicman
Hi,

I've got following schema:

<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="PERSON1">
<xs:complexType>
<xs:all>
<xs:element name="NAME1" />
</xs:all>
</xs;complexType>
</xs:element>
</xs:schema>

and I want to validate following XML file:
<PERSON1>
<NAME1>Vanessa & I</NAME1>
</PERSON1>

When I parse I get the error that the & is not valid

Posted: Fri Aug 20, 2004 5:28 pm
by george
Hi,

You cannot enter & directly in an XML document as it is used to signal entity references. You should use & instead:

Code: Select all


<PERSON1>
<NAME1>Vanessa & I</NAME1>
</PERSON1>

Posted: Fri Aug 20, 2004 6:55 pm
by muzicman
Well that's the problem
I don't make the XML I get them from clients
and I can't substitute the & because sometimes they use <

isn't it possible to indicate in the schema that & isn't a special character?

Posted: Sat Aug 21, 2004 5:05 am
by george
Hi,

No, it is not possible. That document is not an XML document as it is not well formed so schema does not even get the chance to be taken into account.

Best Regards,
George