XSD problem with &

Are you missing a feature? Request its implementation here.
muzicman
Posts: 3
Joined: Fri Aug 20, 2004 4:31 pm
Location: Belgium

XSD problem with &

Post 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
george
Site Admin
Posts: 2095
Joined: Thu Jan 09, 2003 2:58 pm

Post 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>
muzicman
Posts: 3
Joined: Fri Aug 20, 2004 4:31 pm
Location: Belgium

Post 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?
george
Site Admin
Posts: 2095
Joined: Thu Jan 09, 2003 2:58 pm

Post 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
Post Reply