473,769 Members | 2,359 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

xs:key effective across xi:includes?

I don't know if what I want to do is possible or not, but I'd like to
have an xs:key in my schema that constrains attributes directly in a
document, as well as those in another document, included in the
first. Here's an example of what I'm trying to say:

FooList.xsd:
=============== =
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xi="http://www.w3.org/2001/XInclude"
xmlns:FooList=" http://www.somecompany .com/FooList"
targetNamespace ="http://www.somecompany .com/FooList"
xmlns="http://www.trionworld. com" elementFormDefa ult="qualified" >

<xs:import namespace="http ://www.w3.org/2001/XInclude"
schemaLocation= "http://www.w3.org/2001/XInclude.xsd"/>

<!-- Range-limited data type for 'Bar' attributes on 'Foo's. An
xs:key will
constrain the value to be unique (can you extend/restrict xs:ID to
specify
both min and max? ...). -->
<xs:simpleTyp e name="BarAttr">
<xs:restricti on base="xs:nonNeg ativeInteger">
<xs:minExclusiv e value="0"/>
<xs:maxInclusiv e value="65535"/>
</xs:restriction>
</xs:simpleType>

<xs:complexTy pe name="Foo">
<xs:attribute name="Bar" type="FooList:B arAttr" use="required"/>
</xs:complexType>

<xs:element name="FooList">
<xs:complexType >
<xs:sequence minOccurs="0">
<xs:element ref="xi:include " minOccurs="0"
maxOccurs="unbo unded"/>
<xs:element name="Foo" type="FooList:F oo" minOccurs="0"
maxOccurs="unbo unded"/>
</xs:sequence>
</xs:complexType>
<xs:key name="PK_FooBar ">
<xs:selector xpath="FooList: Foo"/>
<xs:field xpath="@Bar"/>
</xs:key>
</xs:element>

</xs:schema>
FooListA.xml
==========
<?xml version="1.0" encoding="UTF-8"?>
<FooList xmlns="http://www.somecompany .com/FooList"
xmlns:xsi="http ://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocat ion="http://www.somecompany .com/FooList FooList.xsd">

<Foo Bar="1"/>
<Foo Bar="2"/>

</FooList>
FooListB.xml
==========
<?xml version="1.0" encoding="UTF-8"?>
<FooList xmlns="http://www.somecompany .com/FooList"
xmlns:xsi="http ://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocat ion="http://www.somecompany .com/FooList FooList.xsd">

<include xmlns="http://www.w3.org/2001/XInclude" href="FooListA. xml"
xpointer="FooLi st:FooList"/>

<Foo Bar="1"/>
<Foo Bar="2"/>

</FooList>
Essentially, I would like validation of FooListB.xml to fail, given
that it has 'Bar' attribute values which conflict with those in
FooListA.xml (assuming my include directive is correct...?). I'm
basically trying to "merge" document fragments into a master document,
and have the key constraint be useful.

Is this possible?

Cheers,
-David

Apr 17 '07 #1
0 1439

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1315
by: Marc Pelletier | last post by:
Hello all, I have a schema which includes the primary key for the table. The primary key was added by the VS XML Designer tool, but when I generate my typed dataset from it there is no findby method using the key. Any advice gratefully received.. An abbreviated version of the xsd follows: <?xml version="1.0" encoding="utf-8" ?>
4
2507
by: Iain A. Mcleod | last post by:
Hi I'm stuck with the following schema validation problem in VS.NET 2003: I have two types of xml document and related schema: project and projectCollection. A projectcollection is just a set of projects. Therefore, I wish to include the project customType in the projectCollection namespace. I therefore have declared two xsd documents: project.xsd and projectcollection.xsd
0
1297
by: Olivier Ishacian | last post by:
XMLmind XML Editor V3.0 Patch 1 can be downloaded from http://www.xmlmind.com/xmleditor/download.shtml _____________________________________________ V3.0 Patch 1 (December 2, 2005) Enhancements: ~~~~~~~~~~~~~
2
1493
by: BizTalk Benjamin | last post by:
Hi, I have created a set of schemas for messages that i need to exchange between services. I set the targetNamespace ="http://mycompany/services/abc" and the root elements have names like FindCustomerRequest, FindCustomerResponse, CreateCustomerRequest and so on. In Biztalk when a message of any of the above comes in, it validates correctly because the engine sets the subscription to "http://mycompany/services/abc#FindCustomerRequest" ....
6
2856
by: RickH | last post by:
Hello, I would like to create a user XSD data type that inherits from the w3 standard data type called ID to make sure a certain repeated element always contains distinct values. The problem is I would like this element to also allow spaces to be present. By default the ID data type does not allow spaces. How can I inherit ID and also allow the entry of spaces in the data of a new derived data type? This is a title column where I...
0
9586
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9423
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
9990
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9861
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8869
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7406
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5298
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3561
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2814
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.