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

How to define a "anywhere" node in my XSD

Hi,

I would like to specify in my XSD that the "Documentation" element can
be added everywhere in the XML document. A bit like the
xs:documentation node.

How can i declare this in my XSD?

An example
<a>
<b>
<Documentation/>
</b>
</a>

is valid

but also

<a>
<Documentation/>
<b>
<Documentation/>
</b>
<Documentation/>
</a>

Thanks for the help
David

Aug 31 '06 #1
7 1253

da************@axa.be schreef:
Hi,

I would like to specify in my XSD that the "Documentation" element can
be added everywhere in the XML document. A bit like the
xs:documentation node.

How can i declare this in my XSD?

An example
<a>
<b>
<Documentation/>
</b>
</a>

is valid

but also

<a>
<Documentation/>
<b>
<Documentation/>
</b>
<Documentation/>
</a>
Another valid one could be

<a>
<Documentation/>
<Documentation/>
<Documentation/>
<b>
<Documentation/>
<Documentation/>
</b>
<Documentation/>
</a>

>
Thanks for the help
David
Aug 31 '06 #2
There's no easy syntax for that. You have to explicitly write your
schema so it says the documentation element can appear anywhere in any
of the individual element models.

One alternative might be to use the documentation element only in
non-validated documents, and require that it be filtered out before
validating.
Aug 31 '06 #3

da************@axa.be wrote:
Hi,

I would like to specify in my XSD that the "Documentation" element can
be added everywhere in the XML document. A bit like the
xs:documentation node.

How can i declare this in my XSD?

An example
<a>
<b>
<Documentation/>
</b>
</a>

is valid

but also

<a>
<Documentation/>
<b>
<Documentation/>
</b>
<Documentation/>
</a>

Thanks for the help
David
What you are asking for is equivalent to an inclusion in SGML. You
might want to look the SGML way if its an option to you. The price you
pay for more flexibility is a bigger complexity headache :).

Regards
Jeff

Aug 31 '06 #4
Jean-François Michaud wrote:
da************@axa.be wrote:
>Hi,

I would like to specify in my XSD that the "Documentation" element can
be added everywhere in the XML document. A bit like the
xs:documentation node.
[...]
What you are asking for is equivalent to an inclusion in SGML. You
might want to look the SGML way if its an option to you. The price you
pay for more flexibility is a bigger complexity headache :).
One of the papers at the Extreme Markup meeting in Montreal earlier this
month suggested that some SGML features omitted from XML (including
Inclusion Exceptions) be reconsidered for a future version. Publishers
have a number of serious requirements which XML is currently unable to
support.

///Peter
--
XML FAQ: http://xml.silmaril.ie/
Aug 31 '06 #5

Peter Flynn wrote:
Jean-François Michaud wrote:
da************@axa.be wrote:
Hi,

I would like to specify in my XSD that the "Documentation" element can
be added everywhere in the XML document. A bit like the
xs:documentation node.
[...]
What you are asking for is equivalent to an inclusion in SGML. You
might want to look the SGML way if its an option to you. The price you
pay for more flexibility is a bigger complexity headache :).

One of the papers at the Extreme Markup meeting in Montreal earlier this
month suggested that some SGML features omitted from XML (including
Inclusion Exceptions) be reconsidered for a future version. Publishers
have a number of serious requirements which XML is currently unable to
support.
This would considerably enhance the expressive power of XML. I think it
would be a good thing :). But they have to be careful not to complexify
too much either. The advantage that XML has over SGML is its
simplicity.

Regards
Jean-Francois Michaud

Aug 31 '06 #6
Jean-François Michaud wrote:
Peter Flynn wrote:
>Jean-François Michaud wrote:
>>da************@axa.be wrote:
Hi,

I would like to specify in my XSD that the "Documentation" element can
be added everywhere in the XML document. A bit like the
xs:documentation node.
[...]
>>What you are asking for is equivalent to an inclusion in SGML. You
might want to look the SGML way if its an option to you. The price you
pay for more flexibility is a bigger complexity headache :).
One of the papers at the Extreme Markup meeting in Montreal earlier this
month suggested that some SGML features omitted from XML (including
Inclusion Exceptions) be reconsidered for a future version. Publishers
have a number of serious requirements which XML is currently unable to
support.

This would considerably enhance the expressive power of XML. I think it
would be a good thing :). But they have to be careful not to complexify
too much either. The advantage that XML has over SGML is its
simplicity.
Yes, this is why it's unlikely to happen. Sadly the use of XML for
dealing with real-life text documents was sidelined in the mad rush
to use XML for handling data, for which it is not always suited.

///Peter
Sep 2 '06 #7
Stefan Ram wrote:
Peter Flynn <pe********@m.silmaril.iewrites:
>>>>>I would like to specify in my XSD that the "Documentation" element can
>be added everywhere in the XML document. A bit like the
>xs:documentation node.
Yes, this is why it's unlikely to happen. Sadly the use of XML for
dealing with real-life text documents was sidelined in the mad rush
to use XML for handling data, for which it is not always suited.

I do not know XSD, but I guess that the above can already be
done today, by explicitly allowing this element for every
element (repeatedly for each element).
Oh yes (see earlier posts). The nice thing about Exceptions was that
they only had to be specified on the earliest ancestor element type,
and were then inherited to all descendants automatically. But they
are a DTD solution, not an XSD solution.

The solution, of course, is to use schema modelling software like
Relax/NG, as you imply.

///Peter
So the only problem of the OP might be that this has to be
repeated, but this can be eliminated by generating the XSD
from a program or using a preprocessor. I mean, who still
writes his XSD manually, today? (seriously; I don't know,
because I have no experience with XSD.)

One even might consider to write a tool that translates an
SGML-DTD to the best XSD-approximation, which would include
this capability.
Sep 2 '06 #8

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

Similar topics

49
by: Ville Vainio | last post by:
I don't know if you have seen this before, but here goes: http://text.userlinux.com/white_paper.html There is a jab at Python, though, mentioning that Ruby is more "refined". -- Ville...
3
by: Prince Kumar | last post by:
When running LOAD with "ALLOW READ ACCESS", I get the following error if select is running againt the table (isolation UR). load.sql --------- db2 load from /u02/data/dly_d040817_test.dat of...
81
by: Matt | last post by:
I have 2 questions: 1. strlen returns an unsigned (size_t) quantity. Why is an unsigned value more approprate than a signed value? Why is unsighned value less appropriate? 2. Would there...
13
by: baumann.Pan | last post by:
when define char *p = " can not modify"; p ='b' ;is not allowed, but if you declare p as char p = "can modify"; p = 'b'; is ok? why?
18
by: steve | last post by:
I'm trying to create a structure of three pointers to doubles. For which I have: typedef struct { double *lst_t, *lst_vc, *lst_ic; } last_values; I then need to allocate space for...
41
by: JohnR | last post by:
In it's simplest form, assume that I have created a usercontrol, WSToolBarButton that contains a button. I would like to eventually create copies of WSToolBarButton dynamically at run time based...
9
by: anon.asdf | last post by:
In terms of efficieny: Is it better to use multiple putchar()'s after one another as one gets to new char's OR is it better to collect the characters to a char-array first, and then use...
1
by: yawnmoth | last post by:
<?php $content = ' <a> <d> <b> <c/><c/> </b> </d> <b> <c/><c/><c/>
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: 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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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...

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.