XML
  Home arrow XML arrow Page 2 - More Schematron Features
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
XML

More Schematron Features
By: Peyton McCullough
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 1
    2009-01-22

    Table of Contents:
  • More Schematron Features
  • More on assertions
  • Declaring variables with the let element
  • Phases
  • Diagnostics

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    More Schematron Features - More on assertions


    (Page 2 of 5 )

    At the assertion level of Schematron, basic assertion functionality is provided by the assert element. An assertion made using this element can either be met or unmet, and if unmet, then validation fails. That's not all that can be done on the assertion level, though.

    Going back to the assert element, a message is given if the assertion test evaluates to false. So, if something is not found, then the message goes out. There is a similar element that works differently, though. The report element also features an assertion test, but, in this case, if the assertion test evaluates to true (in other words, if something is found), then the message is given. The report element, then, can be seen as the opposite of the assert element.

    For example, consider an XML document that deals with animals. Inside of the document is a snake element. Other animals may have legs that are represented using a leg element, but snakes, obviously, do not have legs. We can ensure that this is the case using the report element. If a snake element is found to contain a leg element, then a message needs to be displayed:


    <report test="leg">The snake has a leg.</report>


    The following XML would cause the above report to give its message:


    <animals>
        <snake>
            <leg/>
        </snake>
    </animals>


    Removing the leg element would fix the problem.

    More XML Articles
    More By Peyton McCullough


     

    XML ARTICLES

    - Using Regions with XSL Formatting Objects
    - Using XSL Formatting Objects
    - More Schematron Features
    - Schematron Patterns and Validation
    - Using Schematron
    - Datatypes and More in RELAX NG
    - Providing Options in RELAX NG
    - An Introduction to RELAX NG
    - Path, Predicates, and XQuery
    - Using Predicates with XQuery
    - Navigating Input Documents Using Paths
    - XML Basics
    - Introduction to XPath
    - Simple Web Syndication with RSS 2.0
    - Java UI Design with an IDE







    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 1 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek