If you are writing a configuration file for XXE, please do not forget to temporarily disable the Quick Start and Schema caches by unchecking the corresponding checkboxes in → , Advanced|Cached Data section. More information about these caches in Section 5.11.1, “Cached data options” in XMLmind XML Editor - Online Help.
The RELAX NG example is similar to the other examples.
Create a subdirectory named example3
in the addon/
subdirectory of XXE user preferences directory:
Copy example3.rnc
[4]to directory addon/example3/
.
default namespace = "http://www.xmlmind.com/xmleditor/schema/example3" namespace a = "http://relaxng.org/ns/compatibility/annotations/1.0" start = doc-element doc-element = element doc { para-element+ } para-element = element para { mixed { [ a:defaultValue = "left" ] attribute align { "left" | "center" | "right" }? } }
Copy example3.css
to directory addon/example3/
.
@namespace url(http://www.xmlmind.com/xmleditor/schema/example3); doc, para { display: block; } para { margin: 1ex 0; } para[align] { text-align: concatenate(attr(align)); }
This style sheet would work fine without default namespace declaration at the top of it but rule matching is faster when @namespace
is used.
Create a document template for RELAX NG schema "http://www.xmlmind.com/xmleditor/schema/example3
" using a text editor. Save it as addon/example3/example3.xml
.
<?xml version="1.0" encoding="UTF-8" ?> <doc xmlns="http://www.xmlmind.com/xmleditor/schema/example3"> <para></para> </doc>
Note that, unlike with DTDs and with W3C XML Schemas, there is no standard way to associate a RELAX NG schema to an instance[5].
Create a configuration file for XXE. Save it as addon/example3/example3.xxe
.
<?xml version="1.0" encoding="ISO-8859-1"?> <configuration name="Example3" xmlns="http://www.xmlmind.com/xmleditor/schema/configuration" xmlns:cfg="http://www.xmlmind.com/xmleditor/schema/configuration"> <detect> <rootElementNamespace >http://www.xmlmind.com/xmleditor/schema/example3</rootElementNamespace> </detect> <relaxng compactSyntax="true" encoding="ISO-8859-1" location="example3.rnc"/> <css location="example3.css" name="Style sheet"/> <template location="example3.xml" name="Template"/> </configuration>
The relaxng
configuration element is essential because there is no standard way to associate a RELAX NG schema to an instance.
Restart XXE.
Now you can use Example3/Template to create a new document.
→ and selectMake sure that the template document is valid: the red icon must not be displayed at the bottom/left of XXE window.
If the template document, example3.xml
, is invalid, please use a text editor and fix it because XXE is not designed to be comfortable to use with invalid documents.
[4] Example3.rng
is also available in
, in case you prefer the XML syntax to the compact syntax.XXE_install_dir
/doc/configure/samples/example3/
[5] However the <?xml-model>
processing instruction allows to associate schema documents written in any schema definition language with a given XML document.