XML
  Home arrow XML arrow Page 4 - 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 - Phases


    (Page 4 of 5 )

    Assertions can be grouped into rules, and rules can be grouped into patterns. In a similar way, patterns can be grouped into what are called phases. However, phases are different from rules and patterns in that a single pattern can belong to more than one phase. This is because a phase is declared differently from rules and patterns. Instead of containing the patterns themselves, a phase is populated with patterns using the active element, which represents a pattern active within a phase.

    Phases allow for different “versions” of a schema. When the document is validated, the user may be able to select which phase to use. When a phase is chosen, then only the active patterns within that phase will be used to validate the document.

    Creating a phase is easy. You simply need to use the phase element and set the id attribute in order to give the phase a unique identifier. Below, we create a phase by the name of “phase1”:


    <phase id="phase1">
        ...
    </phase>


    In order to add a pattern to a phase, the active element is used. The only attribute of the active element is pattern, which is set to the identifier of the pattern you wish to add. Below, we add a pattern named “pattern1” to the phase:


    <phase id="phase1">
        <active pattern="pattern1"/>
    </phase>


    If this phase is used for validation, only pattern1 will be used to validate the document because it is the only active pattern within the phase. All other patterns are inactive.

    The names “#ALL” and “#DEFAULT” cannot be used to name a phase. The former is used to indicate that all phases are active. This is the default behavior if no particular phase is specified. The latter is used to indicate that the default phase is active. You can set the default phase of a schema by setting the defaultPhase attribute of the schema element:


    <schema xmlns="http://purl.oclc.org/dsdl/schematron" defaultPhase="phase1">


    By default, phase1 will be used for validating a document using the schema.

    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 5 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek