public class DefaultXMLService extends org.scijava.service.AbstractService implements XMLService
| Constructor and Description |
|---|
DefaultXMLService() |
| Modifier and Type | Method and Description |
|---|---|
String |
avoidUndeclaredNamespaces(String xml)
Replaces NS:tag with NS_tag for undeclared namespaces
|
String |
escapeXML(String s)
Escape special characters.
|
Templates |
getStylesheet(String resourcePath,
Class<?> sourceClass)
Gets an XSLT template from the given resource location.
|
String |
getXML(Document doc)
Converts the given DOM back to a string.
|
String |
indentXML(String xml)
Indents XML to be more readable.
|
String |
indentXML(String xml,
boolean preserveCData)
Indents XML to be more readable, avoiding any whitespace injection into
CDATA if the preserveCData flag is set.
|
String |
indentXML(String xml,
int spacing)
Indents XML by the given spacing to be more readable.
|
String |
indentXML(String xml,
int spacing,
boolean preserveCData)
Indents XML by the given spacing to be more readable, avoiding any
whitespace injection into CDATA if the preserveCData flag is set.
|
Document |
parseDOM(File file)
Parses a DOM from the given XML file on disk.
|
Document |
parseDOM(InputStream is)
Parses a DOM from the given XML input stream.
|
Document |
parseDOM(String xml)
Parses a DOM from the given XML string.
|
void |
parseXML(byte[] xml,
DefaultHandler handler)
Parses the XML contained in the given byte array into using the specified
XML handler.
|
void |
parseXML(org.scijava.io.handle.DataHandle<org.scijava.io.location.Location> stream,
DefaultHandler handler)
Parses the XML contained in the given data handle into using the specified
XML handler.
|
void |
parseXML(InputStream xml,
DefaultHandler handler)
Parses the XML contained in the given InputStream using the specified XML
handler.
|
Map<String,String> |
parseXML(String xml)
Parses the given XML string into a list of key/value pairs.
|
void |
parseXML(String xml,
DefaultHandler handler)
Parses the given XML string using the specified XML handler.
|
String |
sanitizeXML(String s)
Remove invalid characters from an XML string.
|
String |
transformXML(Source xmlSource,
Templates xslt)
Transforms the given XML data using the specified XSLT stylesheet.
|
String |
transformXML(String xml,
Templates xslt)
Transforms the given XML string using the specified XSLT stylesheet.
|
boolean |
validateXML(String xml)
Attempts to validate the given XML string using Java's XML validation
facility.
|
boolean |
validateXML(String xml,
String label)
Attempts to validate the given XML string using Java's XML validation
facility.
|
getContext, setContext, toStringgetInfo, getPriority, setInfo, setPrioritycontextclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitinitialize, registerEventHandlersgetIdentifier, logcontext, getContext, setContextcompareTo, getPriority, setPrioritygetInfo, setInfogetLocationgetVersiondisposepublic Document parseDOM(File file) throws ParserConfigurationException, SAXException, IOException
XMLServiceparseDOM in interface XMLServiceParserConfigurationExceptionSAXExceptionIOExceptionpublic Document parseDOM(String xml) throws ParserConfigurationException, SAXException, IOException
XMLServiceparseDOM in interface XMLServiceParserConfigurationExceptionSAXExceptionIOExceptionpublic Document parseDOM(InputStream is) throws ParserConfigurationException, SAXException, IOException
XMLServiceparseDOM in interface XMLServiceParserConfigurationExceptionSAXExceptionIOExceptionpublic String getXML(Document doc) throws TransformerException
XMLServicegetXML in interface XMLServiceTransformerExceptionpublic String sanitizeXML(String s)
XMLServicesanitizeXML in interface XMLServicepublic String escapeXML(String s)
XMLServiceescapeXML in interface XMLServicepublic String indentXML(String xml)
XMLServiceindentXML in interface XMLServicepublic String indentXML(String xml, int spacing)
XMLServiceindentXML in interface XMLServicepublic String indentXML(String xml, boolean preserveCData)
XMLServiceindentXML in interface XMLServicepublic String indentXML(String xml, int spacing, boolean preserveCData)
XMLServiceindentXML in interface XMLServicepublic Map<String,String> parseXML(String xml) throws IOException
XMLServiceparseXML in interface XMLServiceIOExceptionpublic void parseXML(String xml, DefaultHandler handler) throws IOException
XMLServiceparseXML in interface XMLServiceIOExceptionpublic void parseXML(org.scijava.io.handle.DataHandle<org.scijava.io.location.Location> stream, DefaultHandler handler) throws IOException
XMLServiceparseXML in interface XMLServiceIOExceptionpublic void parseXML(byte[] xml,
DefaultHandler handler)
throws IOException
XMLServiceparseXML in interface XMLServiceIOExceptionpublic void parseXML(InputStream xml, DefaultHandler handler) throws IOException
XMLServiceparseXML in interface XMLServiceIOExceptionpublic Templates getStylesheet(String resourcePath, Class<?> sourceClass)
XMLServicegetStylesheet in interface XMLServicepublic String avoidUndeclaredNamespaces(String xml)
XMLServiceavoidUndeclaredNamespaces in interface XMLServicepublic String transformXML(String xml, Templates xslt) throws IOException
XMLServicetransformXML in interface XMLServiceIOExceptionpublic String transformXML(Source xmlSource, Templates xslt) throws IOException
XMLServicetransformXML in interface XMLServiceIOExceptionpublic boolean validateXML(String xml)
XMLServicevalidateXML in interface XMLServicexml - The XML string to validate.public boolean validateXML(String xml, String label)
XMLServicevalidateXML in interface XMLServicexml - The XML string to validate.label - String describing the type of XML being validated.Copyright © 2011–2026 SCIFIO. All rights reserved.