public class XMLUtilities
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
charsToEntities(java.lang.String str,
boolean xml11)
Converts <, >, & in the string to their HTML entity
equivalents.
|
static org.xml.sax.InputSource |
findEntity(java.lang.String systemId,
java.lang.String test,
java.lang.Class<?> where)
Tries to find the given systemId in the context of the given
class.
|
static boolean |
parseXML(java.io.InputStream in,
org.xml.sax.helpers.DefaultHandler handler)
Convenience method for parsing an XML file.
|
public static java.lang.String charsToEntities(java.lang.String str, boolean xml11)
If xml11
is true, then character entities
are used to convert illegal XML characters (mainly ASCII
control characters).
str
- The stringxml11
- Whether to allow XML 1.1 constructs.public static boolean parseXML(java.io.InputStream in, org.xml.sax.helpers.DefaultHandler handler) throws java.io.IOException
SAX Errors are caught and are not propagated to the caller; instead, an error message is printed to jEdit's activity log. So, if you need custom error handling, do not use this method.
The given stream is closed before the method returns, regardless whether there were errors or not.
java.io.IOException
public static org.xml.sax.InputSource findEntity(java.lang.String systemId, java.lang.String test, java.lang.Class<?> where)
getResourceAsStream()
method using the test string
as the resource.
This is used a lot internally while parsing XML files used by jEdit, but anyone is free to use the method if it sounds usable.