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

XSD question (same attributes, different elements...)

Hi

Just getting into XSD and have some questions:

If I have several different elements that all have identical
attibutes, what is the best way of conveying that in the XSD?

Is there a way of defining that an attribute must be either xs:ID OR a
set of predefined lables (ie something like xs:ID | "specific_lable_1"
| "specific_lable_2" ?

The XSD schema I am writing is fully defined, yet some of the
attributes for the various elements are yet to be implemented. What's
the best way of adding a "not yet implemented" flag to these
attributes?

Thanks!
Jul 20 '05 #1
1 1877
On 22/01/2004, around 11:24, Gooseman wrote:
G> Hi

G> Just getting into XSD and have some questions:

G> If I have several different elements that all have identical
G> attibutes, what is the best way of conveying that in the XSD?
You want to look up 'attribute groups' ...

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="root">
<xs:complexType>
<xs:sequence>
<xs:element ref="element1"/>
</xs:sequence>
<xs:attributeGroup ref="ag1"/>
</xs:complexType>
</xs:element>
<xs:element name="element1" type="xs:string"/>
<xs:attribute name="att1" type="xs:string"/>
<xs:attribute name="att2" type="xs:string"/>
<xs:attribute name="att3" type="xs:string"/>
<xs:attributeGroup name="ag1">
<xs:attribute ref="att1" use="required"/>
<xs:attribute ref="att2" use="optional"/>
</xs:attributeGroup>
<xs:attributeGroup name="ag2">
<xs:attribute ref="att2" use="required"/>
<xs:attribute ref="att3" use="required"/>
</xs:attributeGroup>
</xs:schema>

--
Stuart
Friends may come and go, but enemies accumulate.

Jul 20 '05 #2

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

Similar topics

1
by: John L. Clark | last post by:
I am curious as to the rationale, and effect, of having default namespaces not applying (directly) to attributes (see http://www.w3.org/TR/REC-xml-names/#defaulting). Given an attribute without a...
9
by: Soren Kuula | last post by:
Hi, I just can't find namespaces of attributes stated clearly enough in the XML namespace spec. But .. I hear rumors that attributes, unless qualified otherwise, default to the namespace of the...
7
by: Info 3000 | last post by:
Hello, I'm beginner in XML. I have just a little question : I understand that I can write : <Book> <Title> A nice day </Title> <Author> James Nicepen </Author> </Book>
1
by: Jenny | last post by:
Hi, Can I create an array of tags by assigning same name to these tags? For example, I have two <p> tags with the same name t1. But document.all.b.value=document.all.t.length does not...
4
by: Logico | last post by:
Hi everybody, I need to do a function in javascript to check or uncheck all checkboxes with the same id. I want this function to work in every form and every page of my site, as I will use the same...
3
by: gogaz | last post by:
Hi, I am new to XML. Is following XML write? Or it can cause errors for other developers using/parsing my XML output in their respective applications. <emp id="101" name="ABC">...
10
by: Michael Schuerig | last post by:
I would like to define additional attributes on some XHTML elements. The purpose is to use them as parameters for scripts. So far, I have no good grasp on how to add attributes *cleanly*. Of...
3
by: Freeter | last post by:
Hi, I have an xml snippet like this: <ALabel name="ALabel1"> <property vname="Location" x="388" y="384" z="223"/> <property vname="Label"> <parameter vname="label"> <String value="ALabel1"/>...
6
by: burkley | last post by:
In XML Schema, is it possible to derive a complex type via restriction and have the new derived type be in a different namespace than the original base type? I've banged on this for 2 days now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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: 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?
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...

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.