Language

The Free and Open Productivity Suite
Released: Apache OpenOffice 4.1.15
OOoRunner test harness

util
Class XMLTools

java.lang.Object
  |
  +--util.XMLTools

public class XMLTools
extends Object


Inner Class Summary
static class XMLTools.AttributeList
          The implementation of com.sun.star.xml.sax.XAttributeList where attributes and their values can be added.
static class XMLTools.Tag
          Represents an XML tag which must be found in XML data written.
static class XMLTools.XMLChecker
          Class realises extended XML data checking.
static class XMLTools.XMLTagsChecker
          Beside structure of XML this class also can check existence of tags, inner tags, and character data.
static class XMLTools.XMLWellFormChecker
          Checks if the XML structure is well formed (i.e.
static class XMLTools.XMLWriter
          This class writes all XML data handled into a stream specified in the constructor.
 
Constructor Summary
XMLTools()
           
 
Method Summary
static PropertyValue[] createMediaDescriptor(String[] propNames, Object[] values)
           
static void exportDocument(XMultiServiceFactory xMSF, XComponent xDoc, String docType, String exportType, String fileURL)
          Exports document (the whole or a part) into the file specified in XML format.
static Object[] getDocumentHandler(XMultiServiceFactory xMSF)
          Creates XDocumentHandler implementation in form of com.sun.star.xml.sax.Writer service, which writes XML data into a com.sun.star.io.Pipe created.
static com.sun.star.xml.sax.XDocumentHandler getFileXMLWriter(XMultiServiceFactory xMSF, String fileURL)
          Gets the hanlder, which writes all the XML data passed to the file specified.
static void importDocument(XMultiServiceFactory xMSF, XComponent xDoc, String docType, String importType, String fileURL)
          Imports document (the whole or a part) from the file specified in XML format.
static void parseXMLFile(XMultiServiceFactory xMSF, String fileURL, com.sun.star.xml.sax.XDocumentHandler handler)
          Parses XML file and passes its data to the SAX handler specified.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XMLTools

public XMLTools()
Method Detail

getDocumentHandler

public static Object[] getDocumentHandler(XMultiServiceFactory xMSF)
Creates XDocumentHandler implementation in form of com.sun.star.xml.sax.Writer service, which writes XML data into a com.sun.star.io.Pipe created.
Returns:
Single element array which contains the handler contained in Any structure.

createMediaDescriptor

public static PropertyValue[] createMediaDescriptor(String[] propNames,
                                                    Object[] values)

getFileXMLWriter

public static com.sun.star.xml.sax.XDocumentHandler getFileXMLWriter(XMultiServiceFactory xMSF,
                                                                     String fileURL)
                                                              throws Exception
Gets the hanlder, which writes all the XML data passed to the file specified.
Parameters:
xMSF - Soffice ServiceManager factory.
fileURL - The file URL (in form file:///) to which XML data is written.
Returns:
SAX handler to which XML data has to be written.

parseXMLFile

public static void parseXMLFile(XMultiServiceFactory xMSF,
                                String fileURL,
                                com.sun.star.xml.sax.XDocumentHandler handler)
                         throws Exception
Parses XML file and passes its data to the SAX handler specified.
Parameters:
xMSF - Soffice ServiceManager factory.
fileURL - XML file name (in form file:///) to be parsed.
handler - SAX handler to which XML data from file will be transferred.

exportDocument

public static void exportDocument(XMultiServiceFactory xMSF,
                                  XComponent xDoc,
                                  String docType,
                                  String exportType,
                                  String fileURL)
                           throws Exception
Exports document (the whole or a part) into the file specified in XML format.
Parameters:
xMSF - Soffice ServiceManager factory.
xDoc - Document to be exported.
docType - Type of document (for example 'Calc', 'Writer', 'Draw') The type must start with capital letter.
exportType - The type of export specifies if the whole document will be exported or one of its parts (Meta info, Styles, etc.). The following types supported (it also depends of document type) : "" (empty string) - for the whole document ; "Content" - only content exported ; "Meta" - meta document info exported ; "Settings" - view settings of document exported ; "Styles" - document styles exported ;
fileURL - XML file name (in form file:///) to be exported to.

importDocument

public static void importDocument(XMultiServiceFactory xMSF,
                                  XComponent xDoc,
                                  String docType,
                                  String importType,
                                  String fileURL)
                           throws Exception
Imports document (the whole or a part) from the file specified in XML format.
Parameters:
xMSF - Soffice ServiceManager factory.
xDoc - Target document to be imported.
docType - Type of document (for example 'Calc', 'Writer', 'Draw') The type must start with capital letter.
exportType - The type of export specifies if the whole document will be exported or one of its parts (Meta info, Styles, etc.). The following types supported (it hardly depends of XML data in file) : "" (empty string) - for the whole document ; "Content" - only content exported ; "Meta" - meta document info exported ; "Settings" - view settings of document exported ; "Styles" - document styles exported ;
fileURL - XML file name (in form file:///) to be imported from.

OOoRunner test harness

Apache Software Foundation

Copyright & License | Privacy | Contact Us | Donate | Thanks

Apache, OpenOffice, OpenOffice.org and the seagull logo are registered trademarks of The Apache Software Foundation. The Apache feather logo is a trademark of The Apache Software Foundation. Other names appearing on the site may be trademarks of their respective owners.