com.agfa.hap.sdo.implementation
Class XMLHelperImpl

java.lang.Object
  extended by com.agfa.hap.sdo.implementation.XMLHelperImpl
All Implemented Interfaces:
XMLHelper

public class XMLHelperImpl
extends java.lang.Object
implements XMLHelper


Field Summary
 
Fields inherited from interface commonj.sdo.helper.XMLHelper
INSTANCE
 
Constructor Summary
XMLHelperImpl()
           
 
Method Summary
 XMLDocument createDocument(DataObject dataObject, java.lang.String rootElementURI, java.lang.String rootElementName)
          Creates an XMLDocument with the specified XML rootElement for the DataObject.
 XMLDocument load(java.io.InputStream inputStream)
          Creates and returns an XMLDocument from the inputStream.
 XMLDocument load(java.io.InputStream inputStream, java.lang.String locationURI, java.lang.Object options)
          Creates and returns an XMLDocument from the inputStream.
 XMLDocument load(java.io.Reader inputReader, java.lang.String locationURI, java.lang.Object options)
          Creates and returns an XMLDocument from the inputReader.
 XMLDocument load(javax.xml.transform.Source inputSource, java.lang.String locationURI, java.lang.Object options)
          Creates and returns an XMLDocument from the inputSource.
 XMLDocument load(java.lang.String inputString)
          Creates and returns an XMLDocument from the input String.
 java.lang.String save(DataObject dataObject, java.lang.String rootElementURI, java.lang.String rootElementName)
          Returns the DataObject saved as an XML document with the specified root element.
 void save(DataObject dataObject, java.lang.String rootElementURI, java.lang.String rootElementName, java.io.OutputStream outputStream)
          Saves the DataObject as an XML document with the specified root element.
 void save(XMLDocument xmlDocument, java.io.OutputStream outputStream, java.lang.Object options)
          Serializes an XMLDocument as an XML document into the outputStream.
 void save(XMLDocument xmlDocument, javax.xml.transform.Result outputResult, java.lang.Object options)
          Serializes an XMLDocument as an XML document into the outputResult in a serialization technology independent format (as specified in javax.xml.transform).
 void save(XMLDocument xmlDocument, java.io.Writer outputWriter, java.lang.Object options)
          Serializes an XMLDocument as an XML document into the outputWriter.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XMLHelperImpl

public XMLHelperImpl()
Method Detail

load

public XMLDocument load(java.lang.String inputString)
Description copied from interface: XMLHelper
Creates and returns an XMLDocument from the input String. By default does not perform XSD validation. Same as load(new StringReader(inputString), null, null);

Specified by:
load in interface XMLHelper
Parameters:
inputString - specifies the String to read from
Returns:
the new XMLDocument loaded

load

public XMLDocument load(java.io.InputStream inputStream)
                 throws java.io.IOException
Description copied from interface: XMLHelper
Creates and returns an XMLDocument from the inputStream. The InputStream will be closed after reading. By default does not perform XSD validation. Same as load(inputStream, null, null);

Specified by:
load in interface XMLHelper
Parameters:
inputStream - specifies the InputStream to read from
Returns:
the new XMLDocument loaded
Throws:
java.io.IOException - for stream exceptions.

load

public XMLDocument load(java.io.InputStream inputStream,
                        java.lang.String locationURI,
                        java.lang.Object options)
                 throws java.io.IOException
Description copied from interface: XMLHelper
Creates and returns an XMLDocument from the inputStream. The InputStream will be closed after reading. By default does not perform XSD validation.

Specified by:
load in interface XMLHelper
Parameters:
inputStream - specifies the InputStream to read from
locationURI - specifies the URI of the document for relative schema locations
options - implementation-specific options.
Returns:
the new XMLDocument loaded
Throws:
java.io.IOException - for stream exceptions.

load

public XMLDocument load(javax.xml.transform.Source inputSource,
                        java.lang.String locationURI,
                        java.lang.Object options)
                 throws java.io.IOException
Description copied from interface: XMLHelper
Creates and returns an XMLDocument from the inputSource. The InputSource will be closed after reading. By default does not perform XSD validation.

Specified by:
load in interface XMLHelper
Parameters:
inputSource - specifies the Source to read from
locationURI - specifies the URI of the document for relative schema locations
options - implementation-specific options.
Returns:
the new XMLDocument loaded
Throws:
java.io.IOException - for stream exceptions.

load

public XMLDocument load(java.io.Reader inputReader,
                        java.lang.String locationURI,
                        java.lang.Object options)
                 throws java.io.IOException
Description copied from interface: XMLHelper
Creates and returns an XMLDocument from the inputReader. The InputStream will be closed after reading. By default does not perform XSD validation.

Specified by:
load in interface XMLHelper
Parameters:
inputReader - specifies the Reader to read from
locationURI - specifies the URI of the document for relative schema locations
options - implementation-specific options.
Returns:
the new XMLDocument loaded
Throws:
java.io.IOException - for stream exceptions.

save

public java.lang.String save(DataObject dataObject,
                             java.lang.String rootElementURI,
                             java.lang.String rootElementName)
Description copied from interface: XMLHelper
Returns the DataObject saved as an XML document with the specified root element. Same as StringWriter stringWriter = new StringWriter(); save(createDocument(dataObject, rootElementURI, rootElementName), stringWriter, null); stringWriter.toString();

Specified by:
save in interface XMLHelper
Parameters:
dataObject - specifies DataObject to be saved
rootElementURI - the Target Namespace URI of the root XML element
rootElementName - the Name of the root XML element
Returns:
the saved XML document as a string

save

public void save(DataObject dataObject,
                 java.lang.String rootElementURI,
                 java.lang.String rootElementName,
                 java.io.OutputStream outputStream)
          throws java.io.IOException
Description copied from interface: XMLHelper
Saves the DataObject as an XML document with the specified root element. Same as save(createDocument(dataObject, rootElementURI, rootElementName), outputStream, null);

Specified by:
save in interface XMLHelper
Parameters:
dataObject - specifies DataObject to be saved
rootElementURI - the Target Namespace URI of the root XML element
rootElementName - the Name of the root XML element
outputStream - specifies the OutputStream to write to.
Throws:
java.io.IOException - for stream exceptions.

save

public void save(XMLDocument xmlDocument,
                 java.io.OutputStream outputStream,
                 java.lang.Object options)
          throws java.io.IOException
Description copied from interface: XMLHelper
Serializes an XMLDocument as an XML document into the outputStream. If the DataObject's Type was defined by an XSD, the serialization will follow the XSD. Otherwise the serialization will follow the format as if an XSD were generated as defined by the SDO specification. The OutputStream will be flushed after writing. Does not perform validation to ensure compliance with an XSD.

Specified by:
save in interface XMLHelper
Parameters:
xmlDocument - specifies XMLDocument to be saved
outputStream - specifies the OutputStream to write to.
options - implementation-specific options.
Throws:
java.io.IOException - for stream exceptions.

save

public void save(XMLDocument xmlDocument,
                 java.io.Writer outputWriter,
                 java.lang.Object options)
          throws java.io.IOException
Description copied from interface: XMLHelper
Serializes an XMLDocument as an XML document into the outputWriter. If the DataObject's Type was defined by an XSD, the serialization will follow the XSD. Otherwise the serialization will follow the format as if an XSD were generated as defined by the SDO specification. The OutputStream will be flushed after writing. Does not perform validation to ensure compliance with an XSD.

Specified by:
save in interface XMLHelper
Parameters:
xmlDocument - specifies XMLDocument to be saved
outputWriter - specifies the Writer to write to.
options - implementation-specific options.
Throws:
java.io.IOException - for stream exceptions.

createDocument

public XMLDocument createDocument(DataObject dataObject,
                                  java.lang.String rootElementURI,
                                  java.lang.String rootElementName)
Description copied from interface: XMLHelper
Creates an XMLDocument with the specified XML rootElement for the DataObject.

Specified by:
createDocument in interface XMLHelper
Parameters:
dataObject - specifies DataObject to be saved
rootElementURI - the Target Namespace URI of the root XML element
rootElementName - the Name of the root XML element
Returns:
XMLDocument a new XMLDocument set with the specified parameters.

save

public void save(XMLDocument xmlDocument,
                 javax.xml.transform.Result outputResult,
                 java.lang.Object options)
          throws java.io.IOException
Description copied from interface: XMLHelper
Serializes an XMLDocument as an XML document into the outputResult in a serialization technology independent format (as specified in javax.xml.transform). The OutputResult will be flushed after writing. Does not perform validation to ensure compliance with an XSD.

Specified by:
save in interface XMLHelper
Parameters:
xmlDocument - specifies XMLDocument to be saved
outputResult - specifies Result to be saved
options - implementation-specific options.
Throws:
java.io.IOException - for stream exceptions.


Copyright © 2007. All Rights Reserved.