Skip to content
Skip to breadcrumbs
Skip to header menu
Skip to action menu
Skip to quick search
Quick Search
Browse
Pages
Blog
Labels
Attachments
Mail
Advanced
What’s New
Space Directory
Feed Builder
Keyboard Shortcuts
Confluence Gadgets
Log In
Sign Up
Dashboard
Groovy
Copy Page
You are not logged in. Any changes you make will be marked as
anonymous
. You may want to
Log In
if you already have an account. You can also
Sign Up
for a new account.
This page is being edited by
.
Paragraph
Paragraph
Heading 1
Heading 2
Heading 3
Heading 4
Heading 5
Heading 6
Preformatted
Quote
Bold
Italic
Underline
More colours
Strikethrough
Subscript
Superscript
Monospace
Clear Formatting
Bullet list
Numbered list
Outdent
Indent
Align left
Align center
Align right
Link
Table
Insert
Insert Content
Image
Link
Attachment
Symbol
Emoticon
Wiki Markup
Horizontal rule
tinymce.confluence.insert_menu.macro_desc
Info
JIRA Issue
Status
Gallery
Tasklist
Table of Contents
Other Macros
Page Layout
No Layout
Two column (simple)
Two column (simple, left sidebar)
Two column (simple, right sidebar)
Three column (simple)
Two column
Two column (left sidebar)
Two column (right sidebar)
Three column
Three column (left and right sidebars)
Undo
Redo
Find/Replace
Keyboard Shortcuts Help
<p>This example assumes the following class is already on your CLASSPATH:</p> <img class="editor-inline-macro" src="/plugins/servlet/confluence/placeholder/macro?definition=e2luY2x1ZGU6WE1MIEV4YW1wbGV9&locale=en_GB&version=2" data-macro-name="include" data-macro-default-parameter="XML Example"> <p>A number of <a href="http://relaxng.org/">RELAX NG</a> validators are available (e.g. <a href="https://msv.dev.java.net/">MSV</a> and <a href="http://www.thaiopensource.com/relaxng/jing.html">Jing</a>). Rather than using the APIs for these validators directly, you might want to consider using the <a href="http://iso-relax.sourceforge.net/">ISO RELAX</a> project's common JARV API for accessing validators. Using this common API, you can switch between the <a href="http://iso-relax.sourceforge.net/JARV/JARV.html#download">available validators</a> without changing your source code.</p> <p>An even better option (if you are using Java 5 or above, or otherwise have JAXP 1.3 available to you) is to use the <a href="https://isorelax-jaxp-bridge.dev.java.net/">ISORELAX JARV to JAXP 1.3 Xml Validation Engine Adaptor</a>. This hooks into the built-in JAXP validation Factory support in JAXP and makes the code that you use to access the RELAX NG validator the same as you would do for a W3C XML Schema validator.</p> <p>Here is what the code would look like:</p> <table class="wysiwyg-macro" data-macro-name="code" style="background-image: url(/plugins/servlet/confluence/placeholder/macro-heading?definition=e2NvZGV9&locale=en_GB&version=2); background-repeat: no-repeat;" data-macro-body-type="PLAIN_TEXT"><tr><td class="wysiwyg-macro-body"><pre> // require(url:'http://iso-relax.sourceforge.net/', jar:'isorelax.jar') // require(groupId:'org.iso_relax.verifier.jaxp.validation', artifactId:'isorelax-jaxp-bridge', version:'1.0') // require(url:'https://msv.dev.java.net/', jar:'msv.jar') def rng = ''' <grammar xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes"> <start> <ref name="records"/> </start> <define name="car"> <element name="car"> <attribute name="make"> <data type="token"/> </attribute> <attribute name="name"> <text/> </attribute> <attribute name="year"> <data type="integer"/> </attribute> <ref name="country"/> <ref name="record"/> </element> </define> <define name="country"> <element name="country"> <text/> </element> </define> <define name="record"> <element name="record"> <attribute name="type"> <data type="token"/> </attribute> <text/> </element> </define> <define name="records"> <element name="records"> <oneOrMore> <ref name="car"/> </oneOrMore> </element> </define> </grammar> '''.trim() import javax.xml.XMLConstants import javax.xml.transform.stream.StreamSource import javax.xml.validation.SchemaFactory def factory = SchemaFactory.newInstance(XMLConstants.RELAXNG_NS_URI) def schema = factory.newSchema(new StreamSource(new StringReader(rng))) def validator = schema.newValidator() validator.validate(new StreamSource(new StringReader(XmlExamples.CAR_RECORDS))) </pre></td></tr></table>
Please type the word appearing in the picture.
Attachments
Labels
Location
Watch this page
< Edit
Preview >
Loading…
Save
Cancel
Next hint
search
attachments
weblink
advanced