How to define a "anywhere" node in my XSD

david.deridder

Usenet Archive
Joined
Aug 23, 2006
Messages
3
Reaction score
0
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
 

david.deridder

Usenet Archive
Joined
Aug 23, 2006
Messages
3
Reaction score
0
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/>
 

Joseph Kesselman

Usenet Archive
Joined
Feb 3, 2006
Messages
733
Reaction score
0
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.
 
Joined
Feb 1, 2006
Messages
50
Reaction score
0
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
 

Peter Flynn

Usenet Archive
Joined
Jan 2, 2000
Messages
1,813
Reaction score
0
Jean-François Michaud said:
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
 
Joined
Feb 1, 2006
Messages
50
Reaction score
0
Peter said:
Jean-François Michaud said:
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
 

Peter Flynn

Usenet Archive
Joined
Jan 2, 2000
Messages
1,813
Reaction score
0
Jean-François Michaud said:
Peter said:
Jean-François Michaud said:
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
 

Stefan Ram

Usenet Archive
Joined
Sep 3, 2001
Messages
3,281
Reaction score
0
Peter Flynn said:
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).

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.
 

Peter Flynn

Usenet Archive
Joined
Jan 2, 2000
Messages
1,813
Reaction score
0
Stefan said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
548,049
Messages
3,104,246
Members
248,133
Latest member
DujonT

Latest Threads

Top