473,386 Members | 1,832 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,386 software developers and data experts.

What's wrong with this XSD?

Hello,
I've been trying to make my XSD work, but I'm stuck. I did manage to
narrow it down to a simple use case, so I'd appreciate it if someone
could load these and see what's wrong:
It's basically one XML file and two XSDs, listed below.

Thanks in advance for any suggestions.
Uri

XML FILE
=======
<?xml version="1.0" encoding="UTF-8"?>
<sys:process id="x" xmlns:sys="www.aternity.com/sys"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="www.aternity.com/activity c:\temp\a.xsd"/>

A.XSD FILE
=========
<?xml version="1.0" encoding="UTF-8"?>
<!--W3C Schema generated by XMLSpy v2007 rel. 3 sp1 (http://
www.altova.com)-->
<xs:schema xmlns="www.aternity.com/activity" xmlns:xs="http://
www.w3.org/2001/XMLSchema" xmlns:http="www.aternity.com/http"
xmlns:sys="www.aternity.com/sys" xmlns:ui="www.aternity.com/ui"
targetNamespace="www.aternity.com/activity">
<xs:import namespace="www.aternity.com/sys" schemaLocation="b.xsd"/>

<xs:complexType name="CT_Rule">

<!-- this tag works -->
<xs:attribute name="id" use="required">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="x"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>

<!-- this tag doesn't work -->
<!--xs:attributeGroup ref="gr_reference"/-->
</xs:complexType>
<xs:attributeGroup name="gr_reference">
<xs:attribute ref="id" use="optional"/>
<!--xs:attribute ref="idtype" use="optional"/-->
</xs:attributeGroup>

<xs:attribute name="id">
<xs:simpleType>
<xs:restriction base="xs:string"/>
</xs:simpleType>
</xs:attribute>

</xs:schema>

B.XSD FILE
=========
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns="www.aternity.com/activity" xmlns:sys="www.aternity.com/sys"
targetNamespace="www.aternity.com/sys">
<xs:import namespace="www.aternity.com/activity"
schemaLocation="a.xsd"/>

<xs:element name="process">
<xs:complexType>
<xs:complexContent>
<xs:extension base="sys:CT_Rule"/>
</xs:complexContent>
</xs:complexType>
</xs:element>

<xs:complexType name="CT_Rule">
<xs:complexContent>
<xs:extension base="CT_Rule"/>
</xs:complexContent>
</xs:complexType>
</xs:schema>

Aug 21 '07 #1
3 2175
On 21 Aug, 09:53, uri...@gmail.com wrote:
Hello,
I've been trying to make my XSD work, but I'm stuck. I did manage to
narrow it down to a simple use case, so I'd appreciate it if someone
could load these and see what's wrong:
It's basically one XML file and two XSDs, listed below.
....
<?xml version="1.0" encoding="UTF-8"?>
<!--W3C Schema generated by XMLSpy v2007 rel. 3 sp1 (http://www.altova.com)-->
<xs:schema xmlns="www.aternity.com/activity" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:http="www.aternity.com/http"
xmlns:sys="www.aternity.com/sys" xmlns:ui="www.aternity.com/ui"
targetNamespace="www.aternity.com/activity">
<xs:import namespace="www.aternity.com/sys" schemaLocation="b.xsd"/>

<xs:complexType name="CT_Rule">

<!-- this tag works -->
<xs:attribute name="id" use="required">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="x"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>

<!-- this tag doesn't work -->
<!--xs:attributeGroup ref="gr_reference"/-->
</xs:complexType>

<xs:attributeGroup name="gr_reference">
<xs:attribute ref="id" use="optional"/>
<!--xs:attribute ref="idtype" use="optional"/-->
</xs:attributeGroup>
Your definition for CT_Rule contains two attributes called 'id' (one
directly and one in the attribute group). This is not allowed.

Also, by convention, your URIs would be http://www.aternity.com/...
Things won't break if you don't do this, but it is common practice.

HTH,

Pete.
=============================================
Pete Cordell
Codalogic
for XML Schema to C++ data binding visit
http://www.codalogic.com/lmx/
=============================================

Aug 21 '07 #2
Thanks, Pete,
That fixed it up all right. It is a little annoying, though, to have
to write the namespace - could some change in the definition of the
attribute or something else make it easier for me?

Aug 22 '07 #3
On 22 Aug, 09:16, uri...@gmail.com wrote:
Thanks, Pete,
That fixed it up all right. It is a little annoying, though, to have
to write the namespace - could some change in the definition of the
attribute or something else make it easier for me?
You could do:

<xs:attributeGroup name="gr_reference">
<xs:attribute ref="id" type="xs:string" use="optional"/
>
<!--xs:attribute ref="idtype" use="optional"/-->
</xs:attributeGroup>

Or:
<xs:attributeGroup name="gr_reference">
<xs:attribute ref="id" type="idType" use="optional"/>
<!--xs:attribute ref="idtype" use="optional"/-->
</xs:attributeGroup>

<xs:simpleType name="idType">
<xs:restriction base="xs:string"/>
</xs:simpleType>

i.e. use a type rather than a ref.

HTH,

Pete.
=============================================
Pete Cordell
Codalogic
for XML Schema to C++ data binding visit
http://www.codalogic.com/lmx/
=============================================

Aug 22 '07 #4

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

Similar topics

3
by: Mike Henley | last post by:
I first came across rebol a while ago; it seemed interesting but then i was put off by its proprietary nature, although the core of the language is a free download. Recently however, i can't...
72
by: E. Robert Tisdale | last post by:
What makes a good C/C++ programmer? Would you be surprised if I told you that it has almost nothing to do with your knowledge of C or C++? There isn't much difference in productivity, for...
121
by: typingcat | last post by:
First of all, I'm an Asian and I need to input Japanese, Korean and so on. I've tried many PHP IDEs today, but almost non of them supported Unicode (UTF-8) file. I've found that the only Unicode...
28
by: Madhur | last post by:
Hello what about this nice way to open a file in single line rather than using if and else. #include<stdio.h> void main() { FILE *nd; clrscr();...
9
by: Pyenos | last post by:
import cPickle, shelve could someone tell me what things are wrong with my code? class progress: PROGRESS_TABLE_ACTIONS= DEFAULT_PROGRESS_DATA_FILE="progress_data" PROGRESS_OUTCOMES=
3
by: Siong.Ong | last post by:
Dear all, my PHP aims to update a MySQL database by selecting record one by one and modify then save. Here are my PHP, but I found that it doesnt work as it supposed to be, for example, when...
89
by: Tubular Technician | last post by:
Hello, World! Reading this group for some time I came to the conclusion that people here are split into several fractions regarding size_t, including, but not limited to, * size_t is the...
20
by: Daniel.C | last post by:
Hello. I just copied this code from my book with no modification : #include <stdio.h> /* count characters in input; 1st version */ main() { long nc; nc = 0;
24
by: MU | last post by:
Hello I have some code that sets a dropdownlist control with a parameter from the querystring. However, when the querystring is empty, I get an error. Here is my code: Protected Sub...
2
by: mingke | last post by:
Hi... So I have problem with my if condition..I don't know what's wrong but it keeps resulting the wrong answer.... So here's the part of my code I have problem with: for (i=0; i<size2;...
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.