|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.crosswire.common.xml.XMLUtil
public final class XMLUtil
Utilities for working with SAX XML parsing.
for license details.
The copyright to this program is held by it's authors.| Field Summary | |
|---|---|
private static Map |
badEntities
|
private static Set |
goodEntities
|
private static Pattern |
invalidCharacterPattern
Pattern that negates the allowable XML 4 byte unicode characters. |
private static Logger |
log
The log stream |
private static Pattern |
validCharacterEntityPattern
Pattern for numeric entities. |
| Constructor Summary | |
|---|---|
private |
XMLUtil()
Prevent Instansiation |
| Method Summary | |
|---|---|
static String |
cleanAllCharacters(String broken)
Remove all invalid characters in the input. |
static String |
cleanAllEntities(String broken)
For each entity in the input that is not allowed in XML, replace the entity with its unicode equivalent or remove it. |
static String |
cleanAllTags(String broken)
XML parse failed, so we can try getting rid of all the tags and having another go. |
static void |
debugSAXAttributes(Attributes attrs)
Show the attributes of an element as debug |
static String |
escape(String s)
Normalizes the given string |
static org.jdom.Document |
getDocument(String subject)
Get and load an XML file from the classpath and a few other places into a JDOM Document object. |
private static String |
handleEntity(String entity)
Replace entity with its unicode equivalent, if it is not a valid XML entity. |
static String |
writeToString(SAXEventProvider provider)
Serialize a SAXEventProvider into an XML String |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private static Set goodEntities
private static Map badEntities
private static final Logger log
private static Pattern validCharacterEntityPattern
private static Pattern invalidCharacterPattern
| Constructor Detail |
|---|
private XMLUtil()
| Method Detail |
|---|
public static org.jdom.Document getDocument(String subject)
throws org.jdom.JDOMException,
IOException
subject - The name of the desired resource (without any extension)
IOException - if there is a problem reading the file
org.jdom.JDOMException - If the resource is not valid XML
public static String writeToString(SAXEventProvider provider)
throws SAXException
provider - The source of SAX events
SAXExceptionpublic static void debugSAXAttributes(Attributes attrs)
public static String escape(String s)
public static String cleanAllEntities(String broken)
broken - the string to handle entities
public static String cleanAllCharacters(String broken)
broken - the string to be cleaned
public static String cleanAllTags(String broken)
private static String handleEntity(String entity)
entity - the entity to be replaced
|
Copyright ¨ 2003-2007 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||