default namespace prefix

indo3

Usenet Archive
Joined
Jul 2, 2004
Messages
12
Reaction score
0
HELLO

For the top root element of my schema file,
i want to declare following attribute:

<xs:attribute name="xmlns:m" type="xs:string"
default="http://www.w3.org/1998/Math/MathML"/>

But this seems to be not possible with XML Schema, xerces says that a prefix is not allowed in the name attribute.

This is however possible with DTD.

For any idea,

THX
 

Martin Honnen

Usenet Archive
Joined
Apr 8, 2000
Messages
6,174
Reaction score
0
indo3 wrote:

For the top root element of my schema file,
i want to declare following attribute:

<xs:attribute name="xmlns:m" type="xs:string"
default="http://www.w3.org/1998/Math/MathML"/>

But this seems to be not possible with XML Schema, xerces says that a prefix is not allowed in the name attribute.

This is however possible with DTD.

Right, you need a schema per namespace and then you can use <xs:attribute ref="prefix:attributename" /> to reference the attribute defined in the schema for the other namespace. However you want an attribute xmlns:m and I think those can't be specified as http://www.w3.org/TR/xmlschema-1/#no-xmlns says

Schema Component Constraint: xmlns Not Allowed
The {name} of an attribute declaration must not match xmlns.

NOTE: The {name} of an attribute is an ·NCName·, which implicitly prohibits attribute declarations of the form xmlns:*.

And
http://www.w3.org/TR/xmlschema-1/#Attribute_Declaration_details says the following:

[XML-Infoset] distinguishes attributes with names such as xmlns or xmlns:xsl from ordinary attributes, identifying them as [namespace attributes]. Accordingly, it is unnecessary and in fact not possible for schemas to contain attribute declarations corresponding to such namespace declarations, see xmlns Not Allowed (§3.2.6). No means is provided in this specification to supply a default value for a namespace declaration.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
548,208
Messages
3,104,798
Members
249,594
Latest member
henrywalsh

Latest Threads

Top