default namespace prefix

I

indo3

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
 
M

Martin Honnen

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

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top