Methods Summary |
---|
private javax.xml.parsers.DocumentBuilder | getDocumentBuilder()
try {
DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
documentBuilder.setEntityResolver(entityResolver);
documentBuilder.setErrorHandler(errorHandler);
return documentBuilder;
} catch (ParserConfigurationException e) {
throw XMLPlatformException.xmlPlatformParseException(e);
}
|
public org.xml.sax.EntityResolver | getEntityResolver()
return entityResolver;
|
public org.xml.sax.ErrorHandler | getErrorHandler()
return errorHandler;
|
public int | getValidationMode()
if (!documentBuilderFactory.isValidating()) {
return XMLParser.NONVALIDATING;
}
try {
if (null == documentBuilderFactory.getAttribute(SCHEMA_LANGUAGE)) {
return XMLParser.DTD_VALIDATION;
}
} catch (IllegalArgumentException e) {
return XMLParser.DTD_VALIDATION;
}
return XMLParser.SCHEMA_VALIDATION;
|
public org.w3c.dom.Document | parse(org.xml.sax.InputSource inputSource)
try {
return getDocumentBuilder().parse(inputSource);
} catch (SAXException e) {
throw XMLPlatformException.xmlPlatformParseException(e);
} catch (IOException e) {
throw XMLPlatformException.xmlPlatformParseException(e);
}
|
public org.w3c.dom.Document | parse(java.io.File file)
try {
return getDocumentBuilder().parse(file);
} catch (SAXParseException e) {
throw XMLPlatformException.xmlPlatformSAXParseException(e);
} catch (SAXException e) {
throw XMLPlatformException.xmlPlatformParseException(e);
} catch (IOException e) {
throw XMLPlatformException.xmlPlatformFileNotFoundException(file, e);
}
|
public org.w3c.dom.Document | parse(java.io.InputStream inputStream)
try {
return getDocumentBuilder().parse(inputStream);
} catch (SAXParseException e) {
throw XMLPlatformException.xmlPlatformSAXParseException(e);
} catch (SAXException e) {
throw XMLPlatformException.xmlPlatformParseException(e);
} catch (IOException e) {
throw XMLPlatformException.xmlPlatformParseException(e);
}
|
public org.w3c.dom.Document | parse(java.io.Reader reader)
InputSource inputSource = new InputSource(reader);
return parse(inputSource);
|
public org.w3c.dom.Document | parse(javax.xml.transform.Source source)
try {
TransformerFactory transformerFactory = TransformerFactory.newInstance();
Transformer transformer = transformerFactory.newTransformer();
DOMResult domResult = new DOMResult();
transformer.transform(source, domResult);
return (Document)domResult.getNode();
} catch (TransformerException e) {
throw XMLPlatformException.xmlPlatformParseException(e);
}
|
public org.w3c.dom.Document | parse(java.net.URL url)
try {
InputStream inputStream = url.openStream();
return parse(inputStream);
} catch (IOException e) {
throw XMLPlatformException.xmlPlatformParseException(e);
}
|
public void | setEntityResolver(org.xml.sax.EntityResolver entityResolver)
this.entityResolver = entityResolver;
|
public void | setErrorHandler(org.xml.sax.ErrorHandler errorHandler)
this.errorHandler = errorHandler;
|
public void | setNamespaceAware(boolean isNamespaceAware)
documentBuilderFactory.setNamespaceAware(isNamespaceAware);
|
public void | setValidationMode(int validationMode)
switch (validationMode) {
case XMLParser.NONVALIDATING: {
documentBuilderFactory.setValidating(false);
// documentBuilderFactory.setAttribute(SCHEMA_LANGUAGE, null);
return;
}
case XMLParser.DTD_VALIDATION: {
documentBuilderFactory.setValidating(true);
// documentBuilderFactory.setAttribute(SCHEMA_LANGUAGE, null);
return;
}
case XMLParser.SCHEMA_VALIDATION: {
try {
documentBuilderFactory.setAttribute(SCHEMA_LANGUAGE, XML_SCHEMA);
documentBuilderFactory.setValidating(true);
} catch (IllegalArgumentException e) {
// This parser does not support XML Schema validation so leave it as
// a non-validating parser.
}
return;
}
}
|
public void | setWhitespacePreserving(boolean isWhitespacePreserving)
documentBuilderFactory.setIgnoringElementContentWhitespace(!isWhitespacePreserving);
|
public void | setXMLSchema(java.net.URL url)
if (null == url) {
return;
}
try {
documentBuilderFactory.setAttribute(SCHEMA_LANGUAGE, XML_SCHEMA);
documentBuilderFactory.setAttribute(JAXP_SCHEMA_SOURCE, url.toString());
} catch (IllegalArgumentException e) {
// The attribute isn't supported so do nothing
} catch (Exception e) {
XMLPlatformException.xmlPlatformErrorResolvingXMLSchema(url, e);
}
|
public void | setXMLSchemas(java.lang.Object[] schemas)
if ((null == schemas) || (schemas.length == 0)) {
return;
}
try {
documentBuilderFactory.setAttribute(SCHEMA_LANGUAGE, XML_SCHEMA);
documentBuilderFactory.setAttribute(JAXP_SCHEMA_SOURCE, schemas);
} catch (IllegalArgumentException e) {
// The attribute isn't supported so do nothing
} catch (Exception e) {
XMLPlatformException.xmlPlatformErrorResolvingXMLSchemas(schemas, e);
}
|