[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Redundancy is an error?

  • From: "Costello, Roger L." <costello@mitre.org>
  • To: "xml-dev@lists.xml.org" <xml-dev@lists.xml.org>
  • Date: Sun, 20 Nov 2016 19:20:57 +0000

Redundancy is an error?

Hi Folks,

I am learning the Alloy modelling language. It is so cool. One interesting aspect of Alloy is this rule:

                An expression is erroneous if it can be shown
               to be redundant, using types alone.

A common and simple case of redundancy is an expression that is equal to the empty relation (set). For example, if sets A and B are disjoint, then (A intersect B) is empty and therefore redundant (and therefore erroneous).

I am trying to see if any of the XML technologies have an equivalent rule.

It seems that XSD does not. Consider: the following schema says that an XML instance document can never have a <Foo> element:

<xs:element name="Book">
   
<xs:complexType>
       
<xs:sequence>
           
<xs:element name="Title" type="xs:string"/>
           
<xs:element name="Author" type="xs:string"/>
            
<xs:element name="Date" type="xs:string"/>
           
<xs:element name="Foo" minOccurs="0" maxOccurs="0" type="xs:string"/>
       
</xs:sequence>
   
</xs:complexType>
</xs:element>

 

The Foo element declaration is redundant – it declares an element that can never manifest in XML instances. Redundancy is not an error in XSD.

 

It also seems that redundancy is not an error in XSLT/XPath. Consider: the following XSLT has an XPath expression that can never be satisfied:

 

<xsl:template match="/">
   
<xsl:choose>
       
<xsl:when test="name(/*[position() eq 0]) eq 'foo'">foo</xsl:when>
       
<xsl:when test="name(/*[position() eq 1]) eq 'bar'">bar</xsl:when>
       
<xsl:when test="name(/*[position() eq 1]) eq 'blah'">blah</xsl:when>
   
</xsl:choose>
</xsl:template>

 

In the vast universe of XML technologies, is there anywhere a rule that requires redundancy be treated as an error?

/Roger

 



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


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.