- From: George Cristian Bina <george@sync.ro>
- Date: Thu, 22 Jul 2004 00:49:53 +0300
- To: "Adam van den Hoven" <avandenhoven@cucbc.com>, "XML Schema Development" <xmlschema-dev@w3.org>
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@oxygenxml.com <oXygen/> XML Editor - http://www.oxygenxml.com/ ----- Original Message ----- From: "Adam van den Hoven" <avandenhoven@cucbc.com> To: "XML Schema Development" <xmlschema-dev@w3.org> 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 >
Received on Wednesday, 21 July 2004 17:51:40 UTC