Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: Qualified attributes and attribute references in schemas

From: "George Cristian Bina" <george@----.-->
To: "Adam van den Hoven" <avandenhoven@-----.--->, "XML Schema Development" <xmlschema-dev@--.--->
Date: 7/22/2004 3:50:00 AM
Hi Adam,

Oxygen uses Xerces 2.6.2.
Top level attributes are defined inside the schema target namespace
therefore they should appear in your instance documents qualified with a
prefix mapped to that namespace, the form applies to local attribute
declarations. You can also see that the oXygen content completion does not
offer you the form attribute on the top level xs:attribute while it presents
it in the xs:attribute inside the element declaration. Local defined
attributes belong to no namespace because attributeFormDefault is set to
unqualified, therefore they should be represented in instance documents
without a prefix.

> <?xml version="1.0" encoding="UTF-8"?>
> <element xmlns="http://schema.foo.net/bar"
>   <element foo="bar" bar="foo"></element>
> </element>

If you remove the foo attribute and enter it through the content completion
you will see that oXygen will enter automatically a prefix mapped to the
schema target namespace and qualifies the attribute with that:
xmlns:oXygen1="http://schema.foo.net/bar" oXygen1:foo="x"

> <b:element xmlns:b="http://schema.foo.net/bar">
>   <b:element b:foo="bar" bar="foo"/>
> </b:element>

This is valid as reported because foo attribute is in the
http://schema.foo.net/bar namespace and the local defined bar attribute is
in no namespace.

Hope that helps,
George
-------------------------------------------------------
George Cristian Bina mailto:george@o...
<oXygen/> XML Editor - www.---.com/


----- Original Message -----
From: "Adam van den Hoven" <avandenhoven@c...>
To: "XML Schema Development" <xmlschema-dev@w...>
Sent: Thursday, July 22, 2004 12:20 AM
Subject: Qualified attributes and attribute references in schemas


>
> I have an odd situation with my IDE (oxygenXML) and I can't tell if its a
> problem with my schema or the IDE (well the xml parser used by the IDE).
As
> an example, I have the following schema:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
> targetNamespace="http://schema.foo.net/bar"
>   attributeFormDefault="unqualified" xmlns:b="http://schema.foo.net/bar">
>   <xs:attribute name="foo" type="xs:string"/>
>   <xs:element name="element">
>     <xs:complexType>
>       <xs:choice minOccurs="0" maxOccurs="unbounded">
>         <xs:element ref="b:element"/>
>       </xs:choice>
>       <xs:attribute ref="b:foo"/>
>       <xs:attribute name="bar" type="xs:string"/>
>     </xs:complexType>
>   </xs:element>
> </xs:schema>
>
> What I'm expecting is nested element tags each with optional foo and bar
> attributes. I created the following document:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <element xmlns="http://schema.foo.net/bar"
>   <element foo="bar" bar="foo"></element>
> </element>
>
> When I validate this against the schema above, I get the following error:
>     Attribute 'foo' is not allowed to appear in element 'element'.
>
> If I do:
> <b:element xmlns:b="http://schema.foo.net/bar">
>   <b:element b:foo="bar" bar="foo"/>
> </b:element>
>
> All is forgiven and it passes validation.
>
> As far as I can read in Eric Meyer's book the form should follow the
default
> set in the root xs:schema element.
>
> So which is right?
>
> Adam
>

From jeni@j...  Wed Jul 21 17:52:39 2004
Return-Path: <jeni@j...>
X-Original-To: xmlschema-dev@listhu


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent