[Date Prev]
| [Thread Prev]
| [Thread Next]
| [Date Next]
--
[Date Index]
| [Thread Index]
Re: [xml-dev] Advantages/disadvantages of extremely simple XMLdesigns
- From: "Liam R. E. Quin" <liam@fromoldbooks.org>
- To: "Costello, Roger L." <costello@mitre.org>, "xml-dev@lists.xml.org" <xml-dev@lists.xml.org>
- Date: Sat, 11 Aug 2018 23:20:06 -0400
On Sat, 2018-08-11 at 14:35 +0000, Costello, Roger L. wrote:
> [...]
> <properties>
> <entry key="A">A content</entry>
> <entry key="B">B content</entry>
This was for years a common XML (and SGML) half-anti-pattern. If you
know the majority of the key values and they're safe, use element
names,
<properties>
<sock-colour>blue</sock-colour>
That way you can validate them, authoring software can help suggest
them, and it's no harder to deal with in an application. There can
still be "entry" elements for new/unknown values.
But if the values aren't known in advance then yes, you want xsd 1.1
and/or schematron.
You could use _only_ Schematron, but if you want type assignment - e.g.
it's going into a database to be queried with XPath 2 or later or with
XQuery then XSD is an obvious win.
Schematron is quite widely supported, by the way, including as
assertions inside an XML Schema. Support for XSD 1.1 is more limited
but still not that uncommon in some environments.
What's most important is that the design fits with how the people who
work with the information think about it. You could use XSLT to
transform it into something you can validate, for example, probably
fairly efficiently.
Liam
--
Liam Quin, https://www.holoweb.net/liam/cv/
Web slave for vintage clipart http://www.fromoldbooks.org/
Available for XML/Document/Information Architecture/
XSL/XQuery/Web/Text Processing/A11Y work & consulting.
[Date Prev]
| [Thread Prev]
| [Thread Next]
| [Date Next]
--
[Date Index]
| [Thread Index]