XML.orgXML.org
FOCUS AREAS |XML-DEV |XML.org DAILY NEWSLINK |REGISTRY |RESOURCES |ABOUT
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] Advantages/disadvantages of extremely simple XML designs

I think tthat for such a document design, you should skip the XML Schema (or any other grammar schema) altogether, and just stick with Schematron.

On Sat, Aug 11, 2018 at 10:35 AM Costello, Roger L. <costello@mitre.org> wrote:

Hi Folks,

There is an Apache technology called NiFi. It is used to distribute data. [1]

A feature of NiFi is that a NiFi application will automatically generate metadata about the data it ingests. The metadata is formatted as XML, which has this form:

<properties>
   
<entry key="A">A content</entry>
   
<entry key="B">B content</entry>
   
<entry key="C">C content</entry>
   
<entry key="D">D content</entry>
    ...
</properties>

 

Each item of metadata is represented with an <entry> element. The “key” attribute contains the name of the metadata item, and the value of the <entry> element contains the value of the metadata item.

What are the advantages and disadvantages of this type of XML design?

Advantages:

  • The markup is simple and regular: just a root element and one element that is repeated over and over. So, it’s easy to understand and use.
  • The design is highly extensible: to represent new metadata items, simply add more <entry> elements. No changes to the markup (i.e., no change to the XML Schema).

Disadvantages:

There is likely to be a constraint (relation) between an <entry>’s @key value and the <entry>’s content:

Examples of co-constraints:

  • “If @key has the value A, then the content must be a string restricted to 20 characters and must have this pattern: regex
  • “If @key has the value B, then the content must be a member of this enumeration list: foo, bar, blah
  • And so on.

 

XML Schema 1.0 doesn’t support co-constraints. [2] So, you need to supplement XSD with Schematron. In some environments, it is simply not feasible to perform both XML Schema validation and Schematron validation.

Consequently, co-constraints go unexpressed. The design hampers the ability to use XML Schema’s powerful constraint mechanisms. Thus, the design hampers the ability to perform powerful error-checking.

Do you agree with these advantages and disadvantages? Are there other advantages and disadvantages?

/Roger

[1] https://nifi.apache.org/

[2] Yes, I know that XSD 1.1 supports co-constraints, but (I assert, without evidence that) there is lesser support for XSD 1.1 than for XSD 1.0 or for Schematron.

 

PNG image

PNG image



[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