Oxygen XML Editor 11.2 Author API

ro.sync.exml.workspace.api.util
Interface XMLUtilAccess

All Known Subinterfaces:
AuthorXMLUtilAccess

public interface XMLUtilAccess

XML Utilities

*********************************
EXPERIMENTAL - Subject to change
*********************************

Please note that this API is not marked as final and it can change in one of the next versions of the application. If you have suggestions, comments about it, please let us know.

Since:
11.2

Field Summary
static int TRANSFORMER_SAXON_6
          Saxon 6 transformer
static int TRANSFORMER_SAXON_ENTERPRISE_EDITION
          Saxon 9 Enterprise Edition transformer type (full extensions support + schema aware).
static int TRANSFORMER_SAXON_HOME_EDITION
          Saxon 9 Home Edition transformer type (no extensions support).
static int TRANSFORMER_SAXON_PROFESSIONAL_EDITION
          Saxon 9 Professional Edition transformer type (full extensions support).
static int TRANSFORMER_XALAN
          Xalan transformer
 
Method Summary
 Transformer createXQueryTransformer(Source styleSource, URL[] extensionJars, int transformerType)
          Create a new XQuery transformer.
 Transformer createXSLTTransformer(Source styleSource, URL[] extensionJars, int transformerType)
          Create a new XSLT transformer.
 String escapeAttributeValue(String attributeValue)
          Escape an attribute value so that the XML document remains well-formed.
 XMLReader newNonValidatingXMLReader()
          Creates an XMLReader without validation.
 XMLReaderWithGrammar newNonValidatingXMLReader(Object grammarCacheToken)
          Creates an XMLReader without validation and with the possibility to reuse the grammar pool.
 void resetXMLCatalogs()
          Reset the loaded XML catalogs.
 URL resolvePathThroughCatalogs(URL baseURL, String relativeLocation, boolean entityResolve, boolean uriResolve)
          Try to resolve a relative location to an absolute path by using the XML catalogs.
 

Field Detail

TRANSFORMER_XALAN

static final int TRANSFORMER_XALAN
Xalan transformer

See Also:
Constant Field Values

TRANSFORMER_SAXON_6

static final int TRANSFORMER_SAXON_6
Saxon 6 transformer

See Also:
Constant Field Values

TRANSFORMER_SAXON_HOME_EDITION

static final int TRANSFORMER_SAXON_HOME_EDITION
Saxon 9 Home Edition transformer type (no extensions support).

See Also:
Constant Field Values

TRANSFORMER_SAXON_PROFESSIONAL_EDITION

static final int TRANSFORMER_SAXON_PROFESSIONAL_EDITION
Saxon 9 Professional Edition transformer type (full extensions support).

See Also:
Constant Field Values

TRANSFORMER_SAXON_ENTERPRISE_EDITION

static final int TRANSFORMER_SAXON_ENTERPRISE_EDITION
Saxon 9 Enterprise Edition transformer type (full extensions support + schema aware).

See Also:
Constant Field Values
Method Detail

createXSLTTransformer

Transformer createXSLTTransformer(Source styleSource,
                                  URL[] extensionJars,
                                  int transformerType)
                                  throws TransformerConfigurationException
Create a new XSLT transformer.

Parameters:
styleSource - The source XSL
extensionJars - Jars with extension libraries which can be used by the transformer, can be null
transformerType - The type of the transformer to create, one of the constants defined in this class starting with TRANSFORMER_
Returns:
The new transformer.
Throws:
TransformerConfigurationException - An Exception is thrown if an error occurs during parsing of the source.

createXQueryTransformer

Transformer createXQueryTransformer(Source styleSource,
                                    URL[] extensionJars,
                                    int transformerType)
                                    throws TransformerConfigurationException
Create a new XQuery transformer.

Parameters:
styleSource - The source XQuery file
extensionJars - Jars with extension libraries which can be used by the transformer, can be null
transformerType - The type of the transformer to create, one of the constants: TRANSFORMER_SAXON_HOME_EDITION, TRANSFORMER_SAXON_PROFESSIONAL_EDITION or TRANSFORMER_SAXON_ENTERPRISE_EDITION
Returns:
The new transformer.
Throws:
TransformerConfigurationException - An Exception is thrown if an error occurs during parsing of the source.

resetXMLCatalogs

void resetXMLCatalogs()
Reset the loaded XML catalogs. This way next time the catalogs are needed they will first be rebuilt.


resolvePathThroughCatalogs

URL resolvePathThroughCatalogs(URL baseURL,
                               String relativeLocation,
                               boolean entityResolve,
                               boolean uriResolve)
Try to resolve a relative location to an absolute path by using the XML catalogs.

Parameters:
baseURL - The URL of the current opened XML file.
relativeLocation - The relative location to be resolved.
entityResolve - true if the catalog entity resolver should be used.
uriResolve - true if the catalog URI resolver should be used.
Returns:
The absolute URL. It does not return null.

escapeAttributeValue

String escapeAttributeValue(String attributeValue)
Escape an attribute value so that the XML document remains well-formed.

Parameters:
attributeValue - The attribute value.
Returns:
The escaped value. It does not return null.

newNonValidatingXMLReader

XMLReader newNonValidatingXMLReader()
Creates an XMLReader without validation.

Returns:
A new XML Reader.

newNonValidatingXMLReader

XMLReaderWithGrammar newNonValidatingXMLReader(Object grammarCacheToken)
Creates an XMLReader without validation and with the possibility to reuse the grammar pool. If you are parsing XML fragments with DOCTYPE many times in your operation this method will be faster than the newNonValidatingXMLReader() method.
Usage example:
 String xml = new String("<!DOCTYPE map PUBLIC \"-//OASIS//DTD DITA Map//EN\" \"map.dtd\">\n" +
     "<map/>");
 Object grammarToken = null;
 for (int i = 0; i < 100000; i++) {
   XMLReaderWithGrammar readerAndCache = authorAccess.getXMLUtilAccess().newNonValidatingXMLReader(grammarToken);
   XMLReader reader = readerAndCache.getXmlReader();
   grammarToken = readerAndCache.getGrammarCache();
   reader.parse(new InputSource(new StringReader(xml)));
 }
 

Parameters:
grammarCacheToken - The grammar cache token, if not null, it will be used to cache the grammar pool.
Returns:
A new XML Reader with a grammar cache token which can be then reused on the same method to provide grammar caching.

Oxygen XML Editor 11.2 Author API

© Copyright SyncRO Soft SRL 2002 - 2010.