473,382 Members | 1,332 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

XML-Schema: Problems with Restricted XPath in Selector of Unique

Hi,

I want to write an XML-schema saying that this document [1]

<root>
<edge type="special">
<target type="one"/>
</edge>
<edge type="special">
<target type="one"/>
</edge>
</root>

is not valid
because there must not be more than one edge-element
- with a type 'special' and
- with a target of the same type (in that case 'one').

This document [2]

<root>
<edge type="special">
<target type="one"/>
</edge>
<edge type="normal">
<target type="one"/>
</edge>
</root>

should be valid because there is only one edge with type special
and a target of type one.

This document [3]

<root>
<edge type="special">
<target type="one"/>
</edge>
<edge type="special">
<target type="two"/>
</edge>
</root>

should also be valid because there are two special edges
but they have different target types.

I try validation using this xml-schema:

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs=http://www.w3.org/2001/XMLSchema
elementFormDefault="qualified"
attributeFormDefault="unqualified">
<xs:element name="root">
<xs:complexType>
<xs:sequence maxOccurs="unbounded">
<xs:element name="edge" type="edge"/>
</xs:sequence>
</xs:complexType>

<!-- WHY DOESN'T WORK THE FOLLOWING -->
<xs:unique name="special-uniqueness">
<xs:selector xpath="edge[@type='special']/target"/>
<xs:field xpath="@type"/>
</xs:unique>

</xs:element>
<xs:complexType name="edge">
<xs:sequence>
<xs:element name="target" type="target"
minOccurs="1" maxOccurs="1"/>
</xs:sequence>
<xs:attribute name="type" type="xs:string" use="required"/>
</xs:complexType>
<xs:complexType name="target">
<xs:attribute name="type" type="xs:string" use="required"/>
</xs:complexType>
</xs:schema>

but I do not succeed: The XPath-expression in the selector of the
unique-element below the XML-comment is not allowed in restricted
XPath syntax.

Does anybody has an idea how to write an XML-schema saying the
document one is not valid but the documents two and three are
valid (given the above criteria)?

Thank you very much for your answers in advance.

Best regards - Torsten
Jan 4 '07 #1
0 2534

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

Similar topics

8
by: Robert J Egan | last post by:
Hi i'm trying to search a remote website page. The form returns xml information, though the page extension is missing. I retrieve the information and write it to the screen. So far so good -...
1
by: felipe_azv | last post by:
a got this code in asp to construct a xml , to export it to a url this is de asp code: <% SQL = "Select * from User where CodeUser in ("& request.form("C1" &")" set rs =...
2
by: Simon Strandgaard | last post by:
I am trying to understand how to create a 'catalog.xml' file for my docbook-xml documents. If I understand correct a local catalog.xml file can both avoid hardcoding in makefiles (portability),...
0
by: MarionEll | last post by:
XML 2003 Exposition Draws Leading XML Vendors Trade Show, Presentations Allow Companies to Showcase Cutting-edge Solutions Alexandria, Va. - Dec. 1, 2003 - XML 2003, the world's largest XML...
0
by: Steve Whitlatch | last post by:
It may be me, or it may be the Linux implementation of XML Catalogs on slackware. Whichever, please shed some light on this XML Catalog problem. When using the --catalogs option, xmllint resolves...
0
by: melledge | last post by:
The Reliable Source for Everything XML - XML 2005 Update XML 2005 - November 14-18 - Atlanta Hilton Hotel - Atlanta, GA www.xmlconference.org Register today and participate in IDEAlliance's...
0
by: jts2077 | last post by:
I am trying to create a large nested XML object using E4X methods. The problem is the, the XML I am trying to create can only have xmlns set at the top 2 element levels. Such as: <store ...
0
by: UncleRic | last post by:
Environment: Mac OS X (10.4.10) on MacBook Pro I'm a Perl Neophyte. I've downloaded the XML::Parser module and am attempting to install it in my working directory (referenced via PERL5LIB env): ...
9
by: Lie | last post by:
Why this generates AttributeError, then not? Python 2.5.2 (r252:60911, Apr 21 2008, 11:17:30) on linux2 Type "help", "copyright", "credits" or "license" for more information. Traceback (most...
10
by: =?Utf-8?B?YzY3NjIyOA==?= | last post by:
Hi all, I had a program and it always works fine and suddenly it gives me the following message when a pass a xml file to our server program: error code: -1072896680 reason: XML document must...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.