473,785 Members | 2,481 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 4622
"ru******@poczt a.onet.pl" <ruthless@CUT_T HIS.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:complexTyp e name="T-div">
<xsd:sequence >
<xsd:element ref="title"/>
<xsd:element ref="p" minOccurs="0" maxOccurs="unbo unded"/>
<xsd:element ref="div" minOccurs="0" maxOccurs="unbo unded"/>
</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:schemaLocat ion
="http://example.com/simple-recursive-example ruthless.xsd">
<my:title>Simpl e 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>recur sion</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
3058
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 contents of these tags based on the rules applicable to their parent tags. For example, if my schema looks something like this: <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:element name="Parent"> <xs:complexType>
4
1602
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, <tag>My Data Here</tag>. I've tried using the <xsl:value-of select="tag"/> element, but it does not appear to work in schema files. Is this correct? Is there another way to get at this data? -James
0
2430
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 service. I have run the schema through XML Spy and validated it with no errors, but when attempting to generate a dataset, I keeping getting a 'undefined data type' error. The schema is quite large so I don't know if that is causing the problem or...
1
1210
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 match the right data, for e.g. the XML will have a tag <AccountName></AccountName> and the datatable will have a column AccountName. What is the best way to do this ? Thanks
5
3685
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 validation? The former seems to be an easier question to answer. XML files will arrive from around the world and must be schema validated before further processing and loading into a database, so I'm trying to foresee the various layouts that might be...
1
3878
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 HTML-output isn't that pretty (<span>'s in the head-section...) it works fine with browsers, crawlers. It never REALLY was an issue...
2
2123
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 following example: <body> We may have some text <b>and some <u>other tags</u></b> <contentbut I want the text and undefined tags to be part of the text-node
8
2202
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 commercial/open source editor that gives the ability to the users to create XML document without tags, but with GUI elements based on the schema? I'm not sure why I didn't find anything like that in my search, suerly I'm missing something. Thanks,
0
3362
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" xmlns:h="http://www.w3.org/1999/xhtml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="alarm-manual alarm-manual.xsd" <h:p>Text ... <a:par-value name="myName"/... text </h:p>
0
9645
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
9480
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,...
0
10325
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10147
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9950
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
6739
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5381
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...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3645
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.