Posted By: ManipUni | Oct 16th @ 3:11 PM
page 2 of 2
Comments: 33 | Views: 915

1) What? XHTML isn't legal XML? Maybe you're confusing XHTML with HTML?

 

2) Yes, I followed this thread and I have nothing interesting to add about XSD. Appart maybe from the fact that I've heard other people complaining about XSD before. Can't argue with that.

 

3) Aaah, "abuse" is the keyword. But you already know that. My point is that the XML spec cannot impose the lack of element order for reasons I outlined above. It is unfortunate if people create XML languages that impose a specific ordering of elements without a reason but ironically that's not something that XML can solve.

 

exoteric
exoteric
I : Next<I>

Order is the bread and butter of document-based formats. Not so for most data-based formats. XML was designed to accomodate both classes. I believe the M community are arguing over the same thing again.

 

It's bad practice to introduce a dependency on order where no dependency is necessary. Using XPath one usually does not care about order. One cares about structure but not order.

 

Dexter is probably right that XML syntax at least does not mandate order. But this is no more relevant as there is a newer standard which is the XML Information Set (Infoset). In particular

  • The Element Information Item is defined as, among other things, composed of

    [children]
     An ordered list of child information items, in document order.

This mandates that all XML Information Set processors must preserve element order. And as more or less all XML processors already do this, the question is rather theoretical. So even if the XML specification itself does not mandate order, the XML data-model specification does "fix" this.

 

It is an interesting question: how exactly to represent order.

 

It looks like your point is that order-independence should be the default and therefore a construct would be needed to represent order. It's an interesting question but it looks like the distinction between presentation and representation is so hardwired into brains that people don't want the syntax itself to be explicit about ordering. Still, not sure about this myself but want a processing layer between the human reader/writer and the document and preferably something else than notepad.

exoteric
exoteric
I : Next<I>

That can be accomodated by letting elements refer to their predecessors or successors explicitly but it gets ugly. Or by specifying whether an elements content is ordered or not. On the other hand, this business of ordering is maybe so important that we should always preserve document order and focus on making formats and software that have minimal requirements on ordering, focusing instead on structure. Still, for document formats that's not going to do it.

Sven Groot
Sven Groot
My name has 9 letters. Coincidence? I think not...

XHTML is a bad example since it isn't really legal XML anyway. The content within the nodes seems to be a mixed of other nodes and junk data that cannot be parsed using most XML parsers.

True XHTML written to the standard is perfectly legal XML, that will parse and validate (against the XHTML DTD) in any conformant XML parser.

 

Mixing text and elements inside an element is perfectly legal, and can be represented using XSD using <xs:complexType mixed="true">.

PaoloM
PaoloM
Hypermediocrity

If your problem is with XSD, then don't use it. There are alternatives Smiley

Dodo
Dodo
I'm your creativity creator™ :)

You forgot that by using attributes, you only have to append new data at the end and if you need to insert something inbetween two of the numbered elements, you could just use some value between the value of the two preexisting elements, of which there are infinite amounts in the decimal system.

ManipUni said:
You can argue that there are valid uses for positional XML and I already admitted to one example and named a second within which order was important, but you also have to admit that for every correct use of ordered XML there are at least a dozen bad abuses of it.

 

Of course. Given any popular technology you generally don't have to look too hard before you see rampant abuse of it. If you can avoid the use of implicit ordering in your XML, it's going to be better. If you find yourself in a position where the only way to avoid it gets convoluted, then it's much better to us implicit ordering than to jump through crazy hoops to get round it.

 

Dodo said:
You forgot that by using attributes, you only have to append new data at the end and if you need to insert something inbetween two of the numbered elements, you could just use some value between the value of the two preexisting elements, of which there are infinite amounts in the decimal system.

 

If you want to trust the order of your documents down to the vagaries of the floating point number format, then you're a much braver soul than I am. I certainly hope you don't actually believe there are an infinite amount of representable numbers between two arbitrary floating point values if you do. Of course even doing that doesn't help if you want to be able to insert arbitrary XML elements (which may be from a different schema) into that list, because you're still assigning an attribute of the list as if it were an attribute of the element.

Dodo
Dodo
I'm your creativity creator™ :)

I am very well aware that XML is not a suitable database storage format. The representable numbers are usually 14 digits (which should be more than enough), but that can be extended, it would just cause horribly FPU intensive operations (which I am aware of being a bad thing). If you assign every element a number or ID, you can control the order of the elements in another way and do not necessarily have to rewrite the whole file. It depends on what you're using XML for, if it is a bad idea to do that.

ScanIAm
ScanIAm
On a scale of 1 to 10, people are stupid.

Ugh...and even worse,  This is completely valid to exepct and yet invalid in xsd:

 

<xs:sequence>

  <xs:element name="bob" minOccurs="0"/>

  <xs:element name="mary" minOccurs="0"/>

  <xs:element name="bob" minOccurs="0"/>

  <xs:element name="jane" minOccurs="0"/>

  <xs:element name="bob" minOccurs="0"/>

</xs:sequence>

page 2 of 2
Comments: 33 | Views: 915
Microsoft Communities