|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object uk.ac.bham.gloss.XRNormalizer
public class XRNormalizer
This is a class that checks and normalizes an XR document with xmlrepresentation mark-up. It also provides basic printing facility of the XML to an output stream. Copyright Richard Kaye 2007-8 for GLOSS, http://gloss.bham.ac.uk Usage permitted according to the GPL. No waranty.
Field Summary | |
---|---|
java.lang.String |
xmlnsURI
|
java.lang.String |
xmlURI
|
java.lang.String |
xrPrefix
The URI default prefix and namespace of the xmlrepresentation tags |
java.lang.String |
xrURI
|
Constructor Summary | |
---|---|
XRNormalizer()
|
Method Summary | |
---|---|
protected static org.w3c.dom.Document |
doc(org.w3c.dom.Node n)
Returns the owner document for node n, provided as a shorthand for n.getOwnerDocument() |
protected static java.lang.String |
escapeXML(java.lang.String s)
Returns "s" as an escaped String with ampersand converted to standard XML escape sequence, etc. |
protected java.lang.String |
getXRAttribute(org.w3c.dom.Node node,
java.lang.String attrName,
boolean preserveSpace)
Returns an attribute for an XR element which is not in a namespace. |
java.lang.String |
getXRAttributeData(org.w3c.dom.Node node,
boolean preserveSpace)
Returns that part of the content of input Node node that can be interpreted as an attribute value for an xr: element. |
protected void |
getXRAttributeData(org.w3c.dom.Node node,
java.lang.StringBuffer buff,
boolean preserveSpace)
Appends that part of the content of input Node node that can be interpreted as an attribute value for an xr: element to buff. |
protected java.lang.String |
getXRAttributeNS(org.w3c.dom.Node node,
java.lang.String attrName,
java.lang.String ns,
ParameterContainer ns_pars,
boolean preserveSpace)
Returns an attribute for an XR element: this will be the string value of the attribute, unescaped, and any xr:attribute node used to provide it will be removed. |
static boolean |
isWhiteSpace(java.lang.String text)
Returns true if the string is entirely whitespace, and false otherwise. |
static java.lang.String |
localName(java.lang.String qname)
Returns the localName part of qname. |
void |
normalize(org.w3c.dom.Document doc)
Main method: checks and transforms the document at doc. |
void |
normalize(org.w3c.dom.Node node,
ParameterContainer ns_pars,
boolean preserveSpace)
checks and transforms the document at node; ns_pars contain a list of prefix=NSURI pairs that have been declared on ancestor elements and may be assumed and do not need to be re-declared. |
protected void |
normalizeChildren(org.w3c.dom.Node node,
ParameterContainer ns_pars,
boolean preserveSpace)
|
protected void |
normalizeElement(org.w3c.dom.Node node,
ParameterContainer ns_pars,
boolean preserveSpace)
|
protected void |
normalizeEmptyNode(org.w3c.dom.Node node)
normalise an empty node |
protected org.w3c.dom.Node |
normalizeText(org.w3c.dom.Node node,
boolean preserveSpace,
boolean allowrefs)
normalise a node (xr:attribute, xr:text, xr:literal, xr:cdata, xr:comment, xr:processing-instruction) with just text content. |
protected void |
normalizeText(org.w3c.dom.Node node,
boolean allowrefs,
org.w3c.dom.Node parent,
java.lang.StringBuffer buff,
boolean preserveSpace)
normalise a node (xr:attribute, xr:text, xr:literal, xr:cdata, xr:comment, xr:processing-instruction) with just text content |
java.io.PrintStream |
out()
|
static java.lang.String |
prefix(java.lang.String qname)
Returns the prefix part of qname or null if none. |
void |
printRawDocument(org.w3c.dom.Document d)
Prints the XML document d to OutputStream out using the built-in java serializer. |
void |
printXRDocument(org.w3c.dom.Document d)
Prints the XML document d to OutputStream out using the built-in java serializer. |
void |
setOS(java.io.OutputStream os)
|
void |
setOutputEncoding(java.lang.String enc)
set output stream encoding |
static java.lang.String |
trimSpace(java.lang.String text)
Returns text with leading and trailing white space (\n, \r, \t, ' ' characters) removed. |
protected void |
warning(java.lang.String wtext)
Prints a warning message, or throws and exception, etc. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public final java.lang.String xrPrefix
public final java.lang.String xrURI
public final java.lang.String xmlnsURI
public final java.lang.String xmlURI
Constructor Detail |
---|
public XRNormalizer()
Method Detail |
---|
public void setOS(java.io.OutputStream os)
public void setOutputEncoding(java.lang.String enc) throws GlossException
GlossException
public java.io.PrintStream out()
public void printRawDocument(org.w3c.dom.Document d) throws java.io.IOException, GlossException, javax.xml.transform.TransformerException
java.io.IOException
GlossException
javax.xml.transform.TransformerException
public void printXRDocument(org.w3c.dom.Document d) throws java.io.IOException, GlossException, javax.xml.transform.TransformerException
java.io.IOException
GlossException
javax.xml.transform.TransformerException
protected static org.w3c.dom.Document doc(org.w3c.dom.Node n)
public static java.lang.String trimSpace(java.lang.String text)
public static boolean isWhiteSpace(java.lang.String text)
protected static java.lang.String escapeXML(java.lang.String s)
public static java.lang.String prefix(java.lang.String qname)
public static java.lang.String localName(java.lang.String qname)
protected void getXRAttributeData(org.w3c.dom.Node node, java.lang.StringBuffer buff, boolean preserveSpace) throws GlossException
GlossException
public java.lang.String getXRAttributeData(org.w3c.dom.Node node, boolean preserveSpace) throws GlossException
GlossException
protected java.lang.String getXRAttributeNS(org.w3c.dom.Node node, java.lang.String attrName, java.lang.String ns, ParameterContainer ns_pars, boolean preserveSpace) throws GlossException
GlossException
protected java.lang.String getXRAttribute(org.w3c.dom.Node node, java.lang.String attrName, boolean preserveSpace) throws GlossException
GlossException
public void normalize(org.w3c.dom.Document doc) throws GlossException
GlossException
protected void warning(java.lang.String wtext) throws GlossException
GlossException
public void normalize(org.w3c.dom.Node node, ParameterContainer ns_pars, boolean preserveSpace) throws GlossException
GlossException
protected void normalizeEmptyNode(org.w3c.dom.Node node) throws GlossException
GlossException
protected org.w3c.dom.Node normalizeText(org.w3c.dom.Node node, boolean preserveSpace, boolean allowrefs) throws GlossException
GlossException
protected void normalizeText(org.w3c.dom.Node node, boolean allowrefs, org.w3c.dom.Node parent, java.lang.StringBuffer buff, boolean preserveSpace) throws GlossException
GlossException
protected void normalizeChildren(org.w3c.dom.Node node, ParameterContainer ns_pars, boolean preserveSpace) throws GlossException
GlossException
protected void normalizeElement(org.w3c.dom.Node node, ParameterContainer ns_pars, boolean preserveSpace) throws GlossException
GlossException
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |