By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,983 Members | 1,597 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,983 IT Pros & Developers. It's quick & easy.

default namespace prefix

P: n/a
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
Jul 20 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a


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/#At...ration_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.
--

Martin Honnen
http://JavaScript.FAQTs.com/

Jul 20 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.