use of org.apache.xmlbeans.XmlOptions in project poi by apache.
the class XSSFPivotCacheRecords method commit.
@Beta
@Override
protected void commit() throws IOException {
PackagePart part = getPackagePart();
OutputStream out = part.getOutputStream();
XmlOptions xmlOptions = new XmlOptions(DEFAULT_XML_OPTIONS);
//Sets the pivotCacheDefinition tag
xmlOptions.setSaveSyntheticDocumentElement(new QName(CTPivotCacheRecords.type.getName().getNamespaceURI(), "pivotCacheRecords"));
ctPivotCacheRecords.save(out, xmlOptions);
out.close();
}
use of org.apache.xmlbeans.XmlOptions in project poi by apache.
the class XSSFPivotTable method readFrom.
@Beta
public void readFrom(InputStream is) throws IOException {
try {
XmlOptions options = new XmlOptions(DEFAULT_XML_OPTIONS);
//Removing root element
options.setLoadReplaceDocumentElement(null);
pivotTableDefinition = CTPivotTableDefinition.Factory.parse(is, options);
} catch (XmlException e) {
throw new IOException(e.getLocalizedMessage());
}
}
use of org.apache.xmlbeans.XmlOptions in project poi by apache.
the class XSLFSheet method commit.
protected final void commit() throws IOException {
XmlOptions xmlOptions = new XmlOptions(DEFAULT_XML_OPTIONS);
String docName = getRootElementName();
if (docName != null) {
xmlOptions.setSaveSyntheticDocumentElement(new QName("http://schemas.openxmlformats.org/presentationml/2006/main", docName));
}
PackagePart part = getPackagePart();
OutputStream out = part.getOutputStream();
getXmlObject().save(out, xmlOptions);
out.close();
}
use of org.apache.xmlbeans.XmlOptions in project knime-core by knime.
the class NodeDescription13Proxy method validate.
/**
* Validate against the XML Schema. If violations are found they are reported via the logger as coding problems.
*
* @return <code>true</code> if the document is valid, <code>false</code> otherwise
*/
final boolean validate() {
// this method has default visibility so that we can use it in testcases
XmlOptions options = new XmlOptions(OPTIONS);
List<XmlError> errors = new ArrayList<XmlError>();
options.setErrorListener(errors);
boolean valid = m_document.validate(options);
if (!valid) {
logger.coding("Node description of '" + m_document.getKnimeNode().getName() + "' does not conform to the Schema. Violations follow.");
for (XmlError err : errors) {
logger.coding(err.toString());
}
}
return valid;
}
use of org.apache.xmlbeans.XmlOptions in project knime-core by knime.
the class NodeDescription28Proxy method validate.
/**
* Validate against the XML Schema. If violations are found they are reported via the logger as coding problems.
*
* @return <code>true</code> if the document is valid, <code>false</code> otherwise
*/
protected final boolean validate() {
// this method has default visibility so that we can use it in testcases
XmlOptions options = new XmlOptions(OPTIONS);
List<XmlError> errors = new ArrayList<XmlError>();
options.setErrorListener(errors);
boolean valid = m_document.validate(options);
if (!valid) {
logger.coding("Node description of '" + m_document.getKnimeNode().getName() + "' does not conform to the Schema. Violations follow.");
for (XmlError err : errors) {
logger.coding(err.toString());
}
}
return valid;
}
Aggregations