Class XSLTConverter
java.lang.Object
com.gigaspaces.internal.utils.xslt.XSLTConverter
Utility Class that provides methods for DOM <--> XML <--> XSL conversions/transformations. e.g. :
1. DOM InputStream and XSL --> transform to a DOM Node (or an XML file) 2. DOM Document and
XSL --> transform to a DOM Node (or an XML file) 3. DOM InputStream and XSL --> transform to a
XSL results.
The underlying parsing processor is any standat XSLT/SAX parser, such as the Xalan or the
defaults coming with the JDK 5.0.
This class is used for the cluster schema transformation, from XML/DOM input together with
cluster schema XSL file, results in a DOM xml Node, used in the ClusterXML.java.
- Version:
- 5.0
- Author:
- Gershon Diner
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidstatic NodetransformDOM2DOM(InputStream _DOMInputStream, InputStream _XSLInputStream) Although its a general porpuse method, it is currently used for the cluster schema transformation.static NodetransformDOM2DOM(Document _DOMDoc, InputStream _XSLInputStream) Although its a general porpuse method, it is currently used for the cluster schema transformation.static voidvalidateClusterDocument(Node validatedXmlDocument) If -Dcom.gs.xmlschema.validation=true (which is the default) it will parse the final xml configuration document (XML DOM tree) against the stricter XSD schema (the clusterXML-Schema.xsd schema).
-
Constructor Details
-
XSLTConverter
public XSLTConverter()
-
-
Method Details
-
transformDOM2DOM
public static Node transformDOM2DOM(InputStream _DOMInputStream, InputStream _XSLInputStream) throws TransformerException, TransformerConfigurationException, FileNotFoundException, IOException, ParserConfigurationException Although its a general porpuse method, it is currently used for the cluster schema transformation. It gets XML/DOM InputStream, a XSL schema InputStream, calling the XSLT parser transformation, it results in a DOM xml Node. (Used in the ClusterXML.java for instance) One may decide to use different parser implementation using the Sys prop: -Djavax.xml.transform.TransformFactory=org.apache.xerces.jaxp.TransformFactoryImpl- Returns:
- a DOM Node (DOM Document)
- Throws:
TransformerExceptionTransformerConfigurationExceptionFileNotFoundExceptionIOExceptionParserConfigurationException
-
validateClusterDocument
public static void validateClusterDocument(Node validatedXmlDocument) throws SAXException, IOException If -Dcom.gs.xmlschema.validation=true (which is the default) it will parse the final xml configuration document (XML DOM tree) against the stricter XSD schema (the clusterXML-Schema.xsd schema). Throws exception if it fails to validate or can't create the validator.- Throws:
SAXExceptionIOException
-
transformDOM2DOM
public static Node transformDOM2DOM(Document _DOMDoc, InputStream _XSLInputStream) throws TransformerException, TransformerConfigurationException, FileNotFoundException, IOException, ParserConfigurationException, SAXException Although its a general porpuse method, it is currently used for the cluster schema transformation. It gets XML/DOM Document, an XSL schema InputStream, calling the XSLT parser transformation, it results in a DOM xml Node. (Used in the ClusterXML.java for instance) One may decide to use different parser implementation using the Sys prop: -Djavax.xml.transform.TransformFactory=org.apache.xerces.jaxp.TransformFactoryImpl- Parameters:
_DOMDoc- an XML DOM Document- Returns:
- a DOM Node (DOM Document)
- Throws:
SAXException- in case an xsd validation fails for some reasonTransformerExceptionTransformerConfigurationExceptionFileNotFoundExceptionIOExceptionParserConfigurationException
-
main
public static void main(String[] args) throws TransformerConfigurationException, FileNotFoundException, TransformerException, IOException, ParserConfigurationException
-