Why are no namespace attributes validated by schema.

Discussion in 'XML' started by wooks, Jul 13, 2004.

  1. wooks

    wooks Guest

    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?
     
    wooks, Jul 13, 2004
    #1
    1. Advertising

  2. 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/
     
    Martin Honnen, Jul 13, 2004
    #2
    1. Advertising

  3. In article <>,
    wooks <> 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
     
    Richard Tobin, Jul 13, 2004
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Owen
    Replies:
    1
    Views:
    12,903
    S. Justin Gengo
    Sep 12, 2005
  2. Stanimir Stamenkov
    Replies:
    3
    Views:
    1,301
    Stanimir Stamenkov
    Apr 25, 2005
  3. Replies:
    1
    Views:
    531
    George Bina
    Jul 20, 2006
  4. Mr. SweatyFinger
    Replies:
    2
    Views:
    2,090
    Smokey Grindel
    Dec 2, 2006
  5. Replies:
    3
    Views:
    2,987
Loading...

Share This Page