OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]
Re: [xml-dev] Schemaless XML?

Maybe Michael's concept of overriding XPaths 
should handle the case where you want to 
ensure /x/y always returns a single node and
not a nodeset. This might counter the idea of
keeping the result type the same for a given
XPath expression.

On Wednesday, 12 October 2016, Stephen D Green <stephengreenubl@gmail.com> wrote:
A key difference in handling schemaless XML and XML with a schema to which it should adhere is when constructing an XPath expression, knowing whether to say /x/y[1]  or just /x/y   
If there is a schema it will likely say whether or not  y is limited to a single occurrence. 
If so then /x/y will always return a single node rather than nodeset. 
If not then you need /x/y[1]  (or better) to ensure it does. 
Getting back a nodeset when you expect a node could break downstream code.
It is likely the schema could change without your knowing it to loosen the cardinality by allowing multiple elements where before only single occurrences were allowed. 
So the issue remains even with a schema of sorts.
I reckon if you are monitoring XML being passed around a network or the Internet you might be concerned to have a schema, else you would have to always cater for every element having multiple cardinality. 
Painful. Yet the schema could change at any time without a change of namespace so you are still kept on your toes.
I think agile methods have led to these things 
being only very rarely discussed and little advice
provided to developers.

Stephen D Green

Stephen D Green

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 1993-2007 XML.org. This site is hosted by OASIS