Package org.apache.poi.xssf.extractor
Class XSSFExportToXml
java.lang.Object
org.apache.poi.xssf.extractor.XSSFExportToXml
- All Implemented Interfaces:
Comparator<String>
Maps an XLSX to an XML according to one of the mapping defined.
The output XML Schema must respect this limitations:
- all mandatory elements and attributes must be mapped (enable validation to check this)
- no <any> in complex type/element declaration
- no <anyAttribute> attributes declaration
- no recursive structures: recursive structures can't be nested more than one level
- no abstract elements: abstract complex types can be declared but must not be used in elements.
- no mixed content: an element can't contain simple text and child element(s) together
- no <substitutionGroup> in complex type/element declaration
-
Constructor Summary
ConstructorsConstructorDescriptionXSSFExportToXml
(XSSFMap map) Creates a new exporter and sets the mapping to be used when generating the XML output document -
Method Summary
Modifier and TypeMethodDescriptionint
Compares two xpaths to define an ordering according to the XML Schemavoid
exportToXML
(OutputStream os, boolean validate) Exports the data in an XML streamvoid
exportToXML
(OutputStream os, String encoding, boolean validate) Exports the data in an XML streamMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.util.Comparator
equals, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
Constructor Details
-
XSSFExportToXml
Creates a new exporter and sets the mapping to be used when generating the XML output document- Parameters:
map
- the mapping rule to be used
-
-
Method Details
-
exportToXML
public void exportToXML(OutputStream os, boolean validate) throws SAXException, TransformerException Exports the data in an XML stream- Parameters:
os
- OutputStream in which will contain the output XMLvalidate
- if true, validates the XML against the XML Schema- Throws:
SAXException
- If validating the document failsTransformerException
- If transforming the document fails
-
exportToXML
public void exportToXML(OutputStream os, String encoding, boolean validate) throws SAXException, TransformerException Exports the data in an XML stream- Parameters:
os
- OutputStream in which will contain the output XMLencoding
- the output charset encodingvalidate
- if true, validates the XML against the XML Schema- Throws:
SAXException
- If validating the document failsTransformerException
- If transforming the document fails
-
compare
Compares two xpaths to define an ordering according to the XML Schema- Specified by:
compare
in interfaceComparator<String>
-