[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

XML Schema/attributeGroup and namespaces

  • From: Stefan Krause <stf@s...>
  • To: xml-dev@l...
  • Date: Tue, 27 May 2008 21:42:34 +0200

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]


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.