XML
  Home arrow XML arrow 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


    (Page 1 of 5 )

    In my last two articles, I covered the basics of Schematron—enough of it to create a basic schema with assertions, rules and patterns. However, there is more to Schematron than was covered in those articles, and some of Schematron's other features are very useful and worth mentioning. In this article, we'll take a look at more of Schematron's features, delving deeper into the Schematron schema language.

    Namespaces

    As a modern schema language, Schematron, of course, provides support for namespaces. Consider a document like this:


    <ds:articles xmlns:ds="http://developershed.com">
        <ds:article>
            <ds:name>Using Schematron</ds:name>
        </ds:article>
        <ds:article>
            <ds:name>More Schematron</ds:name>
        </ds:article>
    </ds:articles>


    In order for patterns to match properly, and for Schematron to operate, namespaces need to be declared in the schema. This is very simple to do, and is done using the ns element. The ns element must be declared as a child of the schema element. It has two attributes: prefix and uri. These correspond, of course, to the namespace prefix and the namespace URI. In order to declare the namespace used above, the following XML would be used:


    <ns prefix="ds" uri="http://developershed.com"/>


    Now the schema will work properly with the document:


    <assert test="ds:name">An article must have a name.</assert>


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