XML.orgXML.org
FOCUS AREAS |XML-DEV |XML.org DAILY NEWSLINK |REGISTRY |RESOURCES |ABOUT
OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]
XML Schema/attributeGroup and namespaces

Hello,

I run into some difficulties while importing a xs:attributeGroups with
the right namespace. Look at this document:

== foo.xml ==
<?xml version="1.0" encoding="UTF-8"?>
<root
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
	xsi:noNamespaceSchemaLocation="foo.xsd"
	xmlns:bar="http://bar";>
	
	<element attr1="1" bar:attr2="2" bar:attr3="3"/>
</root>

The element has three attributes, attr1 is in the noNamespace, the
others are in the "http://bar"-namespace.

Here are the schemas:

== foo.xsd ==
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema
	xmlns:xs="http://www.w3.org/2001/XMLSchema";
	elementFormDefault="qualified"
	xmlns:bar="http://bar";>
	<xs:import namespace="http://bar"; schemaLocation="bar.xsd"/>
	<xs:element name="root">
		<xs:complexType>
			<xs:sequence>
				<xs:element ref="element"/>
			</xs:sequence>
		</xs:complexType>
	</xs:element>
	<xs:element name="element">
		<xs:complexType>
			<xs:attribute name="attr1"/>
			<xs:attribute ref="bar:attr2"/>
			<xs:attributeGroup ref="bar:group"/>
		</xs:complexType>
	</xs:element>
</xs:schema>

== bar.xsd ==
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema
	xmlns:xs="http://www.w3.org/2001/XMLSchema";
	elementFormDefault="qualified"
	targetNamespace="http://bar";
	xmlns:bar="http://bar";>
	<xs:attribute name="attr2"/>
	<xs:attributeGroup name="group">
		<xs:attribute name="attr3"/>
		<xs:attribute name="attr4"/>
	</xs:attributeGroup>
</xs:schema>

While validating, attr1 and attr2 are OK, but attr3 raises an error. On
the other hand, putting attr3 in noNamespace (writing attr3 without the
prefix), also attr3 is OK.

I really need a straightforward way to import xs:attributeGroups from
external schemas into a separate namespace, so how can I do this?

Thanks for your advices,

Stefan


[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 1993-2007 XML.org. This site is hosted by OASIS