473,386 Members | 1,758 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.

creating recurrent tags in XML Schema

hello.

i've got a question

can i in XML Schema define tag that works as lists knows from e.g. C,C++ -
recurrent tags?

i'm talking about e.g. genealogical tree every level of this tree is the
same

1) Grandparents // parents for the level 2
2) parenst // parents for the level 3
3) children // parents for the next level

and so on...

can you help me with simple recuretion example?

thanks in advance
greetings R
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.542 / Virus Database: 336 - Release Date: 03-11-18
Jul 20 '05 #1
1 4592
"ru******@poczta.onet.pl" <ruthless@CUT_THIS.poczta.onet.pl> writes:
can i in XML Schema define tag that works as lists knows from e.g. C,C++ -
recurrent tags?
You can certainly define recursive elements types in XML
Schema.
can you help me with simple recuretion example?


Sure. Here is a simple schema for documents with titles,
paragraphs, and sections (tagged 'doc', 'title', 'p', and
'div'), in which sections are recursive (i.e. 'div' elements
can contain 'div' elements).

<xsd:schema
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns="http://example.com/simple-recursive-example"
targetNamespace="http://example.com/simple-recursive-example" >

<xsd:element name="doc" type="T-div"/>
<xsd:element name="div" type="T-div"/>
<xsd:element name="p"/>
<xsd:element name="title"/>

<xsd:complexType name="T-div">
<xsd:sequence>
<xsd:element ref="title"/>
<xsd:element ref="p" minOccurs="0" maxOccurs="unbounded"/>
<xsd:element ref="div" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>

</xsd:schema>

Here is a document using that schema:

<my:doc xmlns:my="http://example.com/simple-recursive-example"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation
="http://example.com/simple-recursive-example ruthless.xsd">
<my:title>Simple document showing recursion</my:title>
<my:p>This document illustrates the 'simple recursive example' schema.</my:p>
<my:p>The same structure is used for the 'doc' and the 'div' elements,
and the definition of the 'div' element is recursive: 'div' elements
can nest within 'div' elements. </my:p>
<my:div>
<my:title>The 'document' element</my:title>
<my:p>The document contains a title, a series of paragraphs,
and a series of 'div' elements.</my:p>
</my:div>
<my:div>
<my:title>The 'div' element</my:title>
<my:p>Like the 'doc' element, any 'div' element can
contain a title (required),
a series of zero or more paragraphs,
and a series of zero or more 'div' elements.</my:p>
<my:div>
<my:title>The parallel between doc and div</my:title>
<my:p>The identity of structure between 'doc' and 'div' elements
is captured in the schema by using the same complex type
(T-div) for both the 'doc' element and the 'div' element.</my:p>
</my:div>
<my:div>
<my:title>The <my:title>recursion</my:title></my:title>
<my:p>The ability of 'div' elements to contain other 'div' elements
is expressed in the schema by the simple expedient of naming
the 'div' element as a possible child of the 'div' element.</my:p>
</my:div>
</my:div>
</my:doc>

Note that because they are implicitly declared as having the ur-type
(type xsd:anyType), the 'title' and 'p' elements can also self-nest,
as illustrated in the last 'my:title' element.

I hope this helps.

-C. M. Sperberg-McQueen
World Wide Web Consortium
Jul 20 '05 #2

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

Similar topics

4
by: Jim Whitehead | last post by:
If I have a well-formed XML document, can I somehow tell a validating parser to ignore selected tags? I want these tags to be ignored for validation purposes, bit I still want to validate the...
4
by: Porthos | last post by:
Hi All, I've been working on mining data from a schema file (all attribute data so far) and have come to the point where I need to get information that is contained in tags. For instance,...
0
by: Jeremy Summers | last post by:
Has anyone run into problems creating typed datasets from complex schemas? I am attempting to create a Typed Dataset in Visual Studio .Net from a .xsd schema file for a industry standard web...
1
by: Sameer_Vantage | last post by:
I need to create an XML file which is in a pre-defined format (All the tags are defined) from data extracted from a SQL Server database. The XML should be created in such a way that the tags should...
5
by: wolf_y | last post by:
My question is simply: under what conditions will empty tags of the form <MOM></MOM> pass schema validation? Of course, the mirror question is: under what conditions will empty tags fail...
1
by: Luurs | last post by:
Hi All, I've been using a asp-label in the HTML <headsection for quite some time in order to dynamically generate meta-keywords,-description, css and js references. Though the actual...
2
by: gregmcmullinjr | last post by:
I am wondering if there is a way to use a DTD or Schema to instruct an XML parser to ignore tags that are not defined. That is, if my list of acceptable tags is <bodyand <content>, then in the...
8
by: Anupam | last post by:
Hello, I have an XML schema that I would like my users to use. However, I do not want them to use XML tags in an XML editor or a plain text editor to create the file. Is there some...
0
by: mk189 | last post by:
Hi, I am trying to create XML schema of custom markup language, enriched by XHTML. In simplified version, the XML documet could look like that: <a:alarm-manual xmlns:a="alarm-manual"...
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: 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
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,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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.