Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > Why are no namespace attributes validated by schema.

Reply
Thread Tools

Why are no namespace attributes validated by schema.

 
 
wooks
Guest
Posts: n/a
 
      07-13-2004
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?
 
Reply With Quote
 
 
 
 
Martin Honnen
Guest
Posts: n/a
 
      07-13-2004


wooks wrote:

> 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.

--

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

 
Reply With Quote
 
 
 
 
Richard Tobin
Guest
Posts: n/a
 
      07-13-2004
In article <(E-Mail Removed) >,
wooks <(E-Mail Removed)> wrote:

>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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
findcontrol("PlaceHolderPrice") why why why why why why why why why why why Mr. SweatyFinger ASP .Net 2 12-02-2006 03:46 PM
"Cannot be validated" - why not??? Owen ASP .Net 1 09-12-2005 09:23 PM
ASP.net validation controls don't are not validated(fired) on the client side. mallik ASP .Net 3 07-07-2005 08:42 AM
Help:Why can't I use namespace System.Web? It is said that this namespace doesn't exist. But it should exist. ASP .Net 1 07-29-2003 04:31 PM
dynamically created control is not being validated DesignerX ASP .Net 2 07-24-2003 04:47 PM



Advertisments