Let's describe EuroMath2 features more deeply.
In EuroMath2, all available schema files must be referenced from the configuration file.
When EM2 validates the document, it automatically switches to the correct schema when
element (or attribute) from another namespace occurs. This foreign element (or attribute)
must of course be allowed in the original schema, but its contents are not needed
to be specified - the rule is ignored and the element is validated by appropriate schema.
For example when using XML Schema, it is sufficient to specify
<any namespace="##other" processContents="skip"/>
(or <anyAttribute namespace="##other" processContents="skip"/>
)
- the schema is switched automatically and the element is fully validated.
The validation is performed simply by using this code:
XMLAccess xmlAccess = new DocumentLoader().loadDocument(new File("testfiles/article/chapt1.xml").toURL()); xmlAccess.loadGlobalSchemas(); xmlAccess.validate();
validate()
method throws SchemaException
if the document is not valid.
In order to modify XML document in an WYSIWYG fashion, we need to know
how we can modify a document. If we want to insert
new element then we want to know which element we may insert and what is
its required content. The DocumentSchema
object serves this purpose; for example we may check if an attribute is deletable
using this call:
xmlAccess.getSchema().isDeletableAttribute(attribute)
Default editor offers wizards for inserting element(s) and entities into specified position, inserting attributes, deleting elements and attributes, enclose/declose operations, new document creation operation etc.
GENE is the heart of EuroMath2 - the XML document processing engine. You may learn more about GENE here.