Why are no namespace attributes validated by schema.

wooks

Usenet Archive
Joined
Jul 10, 2003
Messages
43
Reaction score
0
I apologise if this has been asked before, it is a bit hard to search for.

I have an xml schema which defines the elements in the namespace "urn:dummy". The schema does not contain any attribute definitions/declarations.

The instance XML however gets transformed at runtime with the result that a label attribute is added to each element.

An example of my instance XML is below

<?xml version="1.0"?>
<ROOTSTUB xmlns="urn:dummy">
<a label="Name">login</a>
<b label="derivation">restriction</b>
<c label="XML Data Type">NCName</c>
<d label="Minimum Field Length">6</d>
</ROOTSTUB>

Post transformation, errors are being thrown up because the validating XML schema has no attribute definitions.

My question is given that the label attributes are not in any namespace why are they being validated by the XML schema?
 

Martin Honnen

Usenet Archive
Joined
Apr 8, 2000
Messages
6,174
Reaction score
0
wooks said:
I apologise if this has been asked before, it is a bit hard to search for.

I have an xml schema which defines the elements in the namespace "urn:dummy". The schema does not contain any attribute definitions/declarations.

Well then the elements are not allowed to have attributes.
The instance XML however gets transformed at runtime with the result that a label attribute is added to each element.

An example of my instance XML is below

<?xml version="1.0"?>
<ROOTSTUB xmlns="urn:dummy">
<a label="Name">login</a>
<b label="derivation">restriction</b>
<c label="XML Data Type">NCName</c>
<d label="Minimum Field Length">6</d>
</ROOTSTUB>

Post transformation, errors are being thrown up because the validating XML schema has no attribute definitions.

My question is given that the label attributes are not in any namespace why are they being validated by the XML schema?

Because the schema defines the elements, you would need to allow elements if you want to add them.
 

Richard Tobin

Usenet Archive
Joined
Jan 6, 2000
Messages
4,251
Reaction score
0
wooks said:
Post transformation, errors are being thrown up because the validating XML schema has no attribute definitions.

My question is given that the label attributes are not in any namespace why are they being validated by the XML schema?

There are two issues: are the attributes themselves valid? and are the elements that they are attached to valid? Even if you don't want to validate the attributes themselves, you have to declare that the elements are allowed to have such attributes.

You need to use an attribute wildcard, and specify lax validation, e.g.

<anyAttribute namespace="##local" processContents="lax"/>

-- Richard
 

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
548,042
Messages
3,104,223
Members
248,131
Latest member
Tonypshaw1

Latest Threads

Top