Oxygen XML Editor 14.2 Author API

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

All Known Subinterfaces:
AuthorXMLUtilAccess

@API(type=NOT_EXTENDABLE,
     src=PUBLIC)
public interface XMLUtilAccess

XML Utilities

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
 void addPriorityEntityResolver(org.xml.sax.EntityResolver entityResolver)
          Add a priority entity resolver.
 void addPriorityURIResolver(javax.xml.transform.URIResolver uriResolver)
          Add a priority URI resolver.
 javax.xml.transform.Transformer createSaxon9HEXSLTTransformerWithExtensions(javax.xml.transform.Source styleSource, net.sf.saxon.lib.ExtensionFunctionDefinition[] saxonExtensions)
          Create a Saxon 9 Home Edition transformer with the specified extension functions.
 javax.xml.transform.Transformer createXQueryTransformer(javax.xml.transform.Source xquerySource, java.net.URL[] extensionJars, int transformerType)
          Create a new XQuery transformer.
 javax.xml.transform.Transformer createXQueryTransformer(javax.xml.transform.Source xquerySource, java.net.URL[] extensionJars, int transformerType, boolean useOxygenOptions)
          Create a new XQuery transformer.
 javax.xml.transform.Transformer createXSLTTransformer(javax.xml.transform.Source styleSource, java.net.URL[] extensionJars, int transformerType)
          Create a new XSLT transformer.
 javax.xml.transform.Transformer createXSLTTransformer(javax.xml.transform.Source styleSource, java.net.URL[] extensionJars, int transformerType, boolean useOxygenOptions)
          Create a new XSLT transformer.
 java.lang.String escapeAttributeValue(java.lang.String attributeValue)
          Escape an attribute value so that the XML document remains well-formed.
 org.xml.sax.EntityResolver getEntityResolver()
          Get the same entity resolver Oxygen sets to its constructed SAX Parsers (which looks into the Oxygen options and document types for catalogs).
 javax.xml.transform.URIResolver getURIResolver()
          Get the same URI resolver Oxygen sets to its constructed XSLT transformers (which looks into the Oxygen options and document types for catalogs).
 org.xml.sax.XMLReader newNonValidatingXMLReader()
          Creates an XMLReader without validation.
 XMLReaderWithGrammar newNonValidatingXMLReader(java.lang.Object grammarCacheToken)
          Creates an XMLReader without validation and with the possibility to reuse the grammar pool.
 void removePriorityEntityResolver(org.xml.sax.EntityResolver entityResolver)
          Remove a priority entity resolver.
 void removePriorityURIResolver(javax.xml.transform.URIResolver uriResolver)
          Remove a priority URI resolver.
 void resetXMLCatalogs()
          Reset the loaded XML catalogs.
 java.net.URL resolvePathThroughCatalogs(java.net.URL baseURL, java.lang.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

javax.xml.transform.Transformer createXSLTTransformer(javax.xml.transform.Source styleSource,
                                                      java.net.URL[] extensionJars,
                                                      int transformerType)
                                                      throws javax.xml.transform.TransformerConfigurationException
Create a new XSLT transformer. The options set in the oXygen preferences are used.

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:
javax.xml.transform.TransformerConfigurationException - An Exception is thrown if an error occurs during parsing of the source.

createXSLTTransformer

javax.xml.transform.Transformer createXSLTTransformer(javax.xml.transform.Source styleSource,
                                                      java.net.URL[] extensionJars,
                                                      int transformerType,
                                                      boolean useOxygenOptions)
                                                      throws javax.xml.transform.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_
useOxygenOptions - If true the options set in the oXygen preferences are used. Otherwise no options are set to the transformers.
Returns:
The new transformer.
Throws:
javax.xml.transform.TransformerConfigurationException - An Exception is thrown if an error occurs during parsing of the source.
Since:
12.2

createSaxon9HEXSLTTransformerWithExtensions

javax.xml.transform.Transformer createSaxon9HEXSLTTransformerWithExtensions(javax.xml.transform.Source styleSource,
                                                                            net.sf.saxon.lib.ExtensionFunctionDefinition[] saxonExtensions)
                                                                            throws javax.xml.transform.TransformerConfigurationException

Create a Saxon 9 Home Edition transformer with the specified extension functions. This is necessary when the extension functions cannot be called by reflection because there is no license for the commercial version of Saxon 9.

The Saxon 9 options set in the oXygen preferences are not used.

Parameters:
styleSource - The source XSL
saxonExtensions - The list of Saxon 9 extensions.
Returns:
The new transformer.
Throws:
javax.xml.transform.TransformerConfigurationException - An Exception is thrown if an error occurs during parsing of the source.
Since:
12.2

createXQueryTransformer

javax.xml.transform.Transformer createXQueryTransformer(javax.xml.transform.Source xquerySource,
                                                        java.net.URL[] extensionJars,
                                                        int transformerType)
                                                        throws javax.xml.transform.TransformerConfigurationException
Create a new XQuery transformer. The options set in the oXygen preferences are used.

Parameters:
xquerySource - 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:
Returns:
The new transformer.
Throws:
javax.xml.transform.TransformerConfigurationException - An Exception is thrown if an error occurs during parsing of the source.

createXQueryTransformer

javax.xml.transform.Transformer createXQueryTransformer(javax.xml.transform.Source xquerySource,
                                                        java.net.URL[] extensionJars,
                                                        int transformerType,
                                                        boolean useOxygenOptions)
                                                        throws javax.xml.transform.TransformerConfigurationException
Create a new XQuery transformer.

Parameters:
xquerySource - 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:
useOxygenOptions - If true the options set in the oXygen preferences are used. Otherwise no options are set to the transformers.
Returns:
The new transformer.
Throws:
javax.xml.transform.TransformerConfigurationException - An Exception is thrown if an error occurs during parsing of the source.
Since:
12.2

resetXMLCatalogs

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


resolvePathThroughCatalogs

java.net.URL resolvePathThroughCatalogs(java.net.URL baseURL,
                                        java.lang.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 returns null only for URLs with unknown protocols for which an URL object cannot be constructed.

escapeAttributeValue

java.lang.String escapeAttributeValue(java.lang.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

org.xml.sax.XMLReader newNonValidatingXMLReader()
Creates an XMLReader without validation.

Returns:
A new XML Reader.

newNonValidatingXMLReader

XMLReaderWithGrammar newNonValidatingXMLReader(java.lang.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.

getEntityResolver

org.xml.sax.EntityResolver getEntityResolver()
Get the same entity resolver Oxygen sets to its constructed SAX Parsers (which looks into the Oxygen options and document types for catalogs). The resolver also looks at the additionally set priority entity resolvers.

Returns:
the same entity resolver Oxygen sets to its constructed SAX Parsers (which looks into the Oxygen options and document types for catalogs).
Since:
12.1

getURIResolver

javax.xml.transform.URIResolver getURIResolver()
Get the same URI resolver Oxygen sets to its constructed XSLT transformers (which looks into the Oxygen options and document types for catalogs). The resolver also looks at the additionally set priority URI resolvers.

Returns:
the same URI resolver Oxygen sets to its constructed XSLT transformers (which looks into the Oxygen options and document types for catalogs).
Since:
12.1

addPriorityEntityResolver

void addPriorityEntityResolver(org.xml.sax.EntityResolver entityResolver)
Add a priority entity resolver.

Parameters:
entityResolver - The entity resolver which will be called with priority before Oxygen calls the standard resolvers which are based on the catalog files specified in the preferences catalogs list and in each document type association.
Since:
13

removePriorityEntityResolver

void removePriorityEntityResolver(org.xml.sax.EntityResolver entityResolver)
Remove a priority entity resolver.

Parameters:
entityResolver - The entity resolver which will be called with priority before Oxygen calls the standard resolvers which are based on the catalog files specified in the preferences catalogs list and in each document type association.
Since:
13

addPriorityURIResolver

void addPriorityURIResolver(javax.xml.transform.URIResolver uriResolver)
Add a priority URI resolver.

Parameters:
uriResolver - The URI resolver which will be called with priority before Oxygen calls the standard resolvers which are based on the catalog files specified in the preferences catalogs list and in each document type association.
Since:
13

removePriorityURIResolver

void removePriorityURIResolver(javax.xml.transform.URIResolver uriResolver)
Remove a priority URI resolver.

Parameters:
uriResolver - The URI resolver which will be called with priority before Oxygen calls the standard resolvers which are based on the catalog files specified in the preferences catalogs list and in each document type association.
Since:
13

Oxygen XML Editor 14.2 Author API

© Copyright SyncRO Soft SRL 2002 - 2013. All rights reserved.