Combine common functionality in POIXMLTypeLoader into helper method
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1722500 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
006595947d
commit
39551f8e01
@ -67,53 +67,48 @@ public class POIXMLTypeLoader {
|
|||||||
DEFAULT_XML_OPTIONS.setSaveSuggestedPrefixes(Collections.unmodifiableMap(map));
|
DEFAULT_XML_OPTIONS.setSaveSuggestedPrefixes(Collections.unmodifiableMap(map));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static XmlObject newInstance(SchemaType type, XmlOptions options) {
|
private static XmlOptions getXmlOptions(XmlOptions options) {
|
||||||
XmlOptions opt = (options == null) ? DEFAULT_XML_OPTIONS : options;
|
XmlOptions opt = (options == null) ? DEFAULT_XML_OPTIONS : options;
|
||||||
return XmlBeans.getContextTypeLoader().newInstance(type, opt);
|
return opt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static XmlObject newInstance(SchemaType type, XmlOptions options) {
|
||||||
|
return XmlBeans.getContextTypeLoader().newInstance(type, getXmlOptions(options));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static XmlObject parse(String xmlText, SchemaType type, XmlOptions options) throws XmlException {
|
public static XmlObject parse(String xmlText, SchemaType type, XmlOptions options) throws XmlException {
|
||||||
XmlOptions opt = (options == null) ? DEFAULT_XML_OPTIONS : options;
|
return XmlBeans.getContextTypeLoader().parse(xmlText, type, getXmlOptions(options));
|
||||||
return XmlBeans.getContextTypeLoader().parse(xmlText, type, opt);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static XmlObject parse(File file, SchemaType type, XmlOptions options) throws XmlException, IOException {
|
public static XmlObject parse(File file, SchemaType type, XmlOptions options) throws XmlException, IOException {
|
||||||
XmlOptions opt = (options == null) ? DEFAULT_XML_OPTIONS : options;
|
return XmlBeans.getContextTypeLoader().parse(file, type, getXmlOptions(options));
|
||||||
return XmlBeans.getContextTypeLoader().parse(file, type, opt);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static XmlObject parse(URL file, SchemaType type, XmlOptions options) throws XmlException, IOException {
|
public static XmlObject parse(URL file, SchemaType type, XmlOptions options) throws XmlException, IOException {
|
||||||
XmlOptions opt = (options == null) ? DEFAULT_XML_OPTIONS : options;
|
return XmlBeans.getContextTypeLoader().parse(file, type, getXmlOptions(options));
|
||||||
return XmlBeans.getContextTypeLoader().parse(file, type, opt);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static XmlObject parse(InputStream jiois, SchemaType type, XmlOptions options) throws XmlException, IOException {
|
public static XmlObject parse(InputStream jiois, SchemaType type, XmlOptions options) throws XmlException, IOException {
|
||||||
XmlOptions opt = (options == null) ? DEFAULT_XML_OPTIONS : options;
|
return XmlBeans.getContextTypeLoader().parse(jiois, type, getXmlOptions(options));
|
||||||
return XmlBeans.getContextTypeLoader().parse(jiois, type, opt);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static XmlObject parse(XMLStreamReader xsr, SchemaType type, XmlOptions options) throws XmlException {
|
public static XmlObject parse(XMLStreamReader xsr, SchemaType type, XmlOptions options) throws XmlException {
|
||||||
XmlOptions opt = (options == null) ? DEFAULT_XML_OPTIONS : options;
|
return XmlBeans.getContextTypeLoader().parse(xsr, type, getXmlOptions(options));
|
||||||
return XmlBeans.getContextTypeLoader().parse(xsr, type, opt);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static XmlObject parse(Reader jior, SchemaType type, XmlOptions options) throws XmlException, IOException {
|
public static XmlObject parse(Reader jior, SchemaType type, XmlOptions options) throws XmlException, IOException {
|
||||||
XmlOptions opt = (options == null) ? DEFAULT_XML_OPTIONS : options;
|
return XmlBeans.getContextTypeLoader().parse(jior, type, getXmlOptions(options));
|
||||||
return XmlBeans.getContextTypeLoader().parse(jior, type, opt);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static XmlObject parse(Node node, SchemaType type, XmlOptions options) throws XmlException {
|
public static XmlObject parse(Node node, SchemaType type, XmlOptions options) throws XmlException {
|
||||||
XmlOptions opt = (options == null) ? DEFAULT_XML_OPTIONS : options;
|
return XmlBeans.getContextTypeLoader().parse(node, type, getXmlOptions(options));
|
||||||
return XmlBeans.getContextTypeLoader().parse(node, type, opt);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static XmlObject parse(XMLInputStream xis, SchemaType type, XmlOptions options) throws XmlException, XMLStreamException {
|
public static XmlObject parse(XMLInputStream xis, SchemaType type, XmlOptions options) throws XmlException, XMLStreamException {
|
||||||
XmlOptions opt = (options == null) ? DEFAULT_XML_OPTIONS : options;
|
return XmlBeans.getContextTypeLoader().parse(xis, type, getXmlOptions(options));
|
||||||
return XmlBeans.getContextTypeLoader().parse(xis, type, opt);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static XMLInputStream newValidatingXMLInputStream ( XMLInputStream xis, SchemaType type, XmlOptions options ) throws XmlException, XMLStreamException {
|
public static XMLInputStream newValidatingXMLInputStream ( XMLInputStream xis, SchemaType type, XmlOptions options ) throws XmlException, XMLStreamException {
|
||||||
XmlOptions opt = (options == null) ? DEFAULT_XML_OPTIONS : options;
|
return XmlBeans.getContextTypeLoader().newValidatingXMLInputStream(xis, type, getXmlOptions(options));
|
||||||
return XmlBeans.getContextTypeLoader().newValidatingXMLInputStream(xis, type, opt);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user