Reputation: 99
I have an xsd that describes XHTML documents. However the application I'm working with may have some selected asp.net controls within to the markup at the point is validated. Therefore the validation fails.
An example control could be:
<smart:Address runat="server" />
I wanted to add a new element to the xsd file but when I specify:
<xs:element name="smart:Address">
I get validation errors as an element name must not have a colon in it.
Can anyone suggest how I might be able to extend the schema file to allow selected server controls?
Update To help things along the full xsd is available at: xhtml1-transistional.xsd
Upvotes: 0
Views: 368
Reputation: 163418
You need to put the element declarations for the smart namespace in a separate schema document, whose targetNamespace attribute identifies the namespace. The name attribute of constructs like xs:element and xs:simpleType is always an unqualified (local) name, implicitly qualified by the targetNamespace (use elementFormDefault="qualified" to ensure this is true even for local element declarations). When you refer to an element declaration in one schema document from a component in a different schema document, then (a) you must have an xs:import declaration to indicate the dependency, and (b) you use a qualified name for the reference, in the form prefix:local, where prefix is bound to the corresponding namespace using an xmlns:prefix="uri" declaration, usually on the xs:schema element.
Upvotes: 0
Reputation: 64943
You're missing that "smart" is an XML namespace.
In other words: you need to declare "smart" namespace:
<xs:schema xmlns:smart="http://someurl" ......
Learn more here:
Upvotes: 2