|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object uk.ac.bham.gloss.XRNormalizer uk.ac.bham.gloss.XRPrinter
public class XRPrinter
This is the class representing objects that take a DOM with XR mark-up and prints xml to an output stream. This class is currently being developed/simplified/tidied up. Essential methods are near the top. Methods that should be removed near the bottom. Copyright Richard Kaye 2007-8 for GLOSS, http://gloss.bham.ac.uk Usage permitted according to the GPL. No waranty.
Field Summary | |
---|---|
protected java.lang.String |
idAttrName
The name of any ID attribute other than the standard xml:id, null if none |
protected java.lang.String |
idAttrNS
The namespace of any ID attribute other than the standard xml:id, null if none |
Fields inherited from class uk.ac.bham.gloss.XRNormalizer |
---|
xmlnsURI, xmlURI, xrPrefix, xrURI |
Constructor Summary | |
---|---|
XRPrinter(java.io.OutputStream os)
Constructor: specify the output stream for documents to go to. |
Method Summary | |
---|---|
protected static java.lang.String |
escapeComment(java.lang.String buff)
Returns a version of buff that can be placed inside a comment. |
protected static java.lang.String |
escapePI(java.lang.String buff)
Returns a version of buff that can be placed inside a comment. |
protected org.w3c.dom.Element |
findLocalNodePath(org.w3c.dom.Element node,
java.lang.String nodePath)
find the element in this document corresponding to nodePath starting at node |
protected org.w3c.dom.Element |
findNodeID(org.w3c.dom.Element node,
java.lang.String id,
boolean local)
find the element in this document with the given ID |
protected org.w3c.dom.Element |
findNodePath(org.w3c.dom.Element node,
java.lang.String nodePath,
boolean local)
find the element in this document corresponding to nodePath starting at node |
java.lang.String |
getAttributeData(org.w3c.dom.Node node)
Get character data, etc, in node as an escaped String suitable for direct printing as an attribute value. |
java.lang.String |
getCDATAData(org.w3c.dom.Node node)
Get character data in the node as an String escaped suitably for direct printing as a CDATA value, and with leading "". |
protected void |
getCharacterData(org.w3c.dom.Node node,
java.lang.StringBuffer buff)
Internal method that collects character data in child TEXT, CDATA and other descendents nodes of "node" and appends it to the StringBuffer buff without any escaping. |
java.lang.String |
getCommentData(org.w3c.dom.Node node)
Get character data in the node as an String escaped suitably for direct printing as a comment, with <!-- and --> to wrap it. |
java.lang.String |
getLiteralData(org.w3c.dom.Node node)
Get character data in the node as an String escaped suitably for direct printing as a literal value. |
java.lang.String |
getPIData(org.w3c.dom.Node node,
java.lang.String target)
Get character data in the node as an String escaped suitably for direct printing as a PI value. |
java.lang.String |
getTextData(org.w3c.dom.Node node)
Get character data in the node as an String, escaped suitable for direct printing as text (PCDATA). |
protected void |
getTextOrAttributeData(org.w3c.dom.Node node,
java.lang.StringBuffer buff)
Appends that part of the content of node that can be interpreted as an attribute value or text data to buff. |
void |
print(org.w3c.dom.Document doc)
Main method: parses and prints the document at doc. |
void |
print(org.w3c.dom.Node node,
ParameterContainer ns_pars)
Main method that prints a node, with ns_pars listing a list of prefixes and their namespaces that are in scope and therefore do not have to be printed. |
protected void |
printAttributes(org.w3c.dom.Element node,
ParameterContainer ns_pars,
ParameterContainer attrsPrinted,
ParameterContainer prefixesUsed)
Internal method that prints the attributes of a given element. |
protected void |
printChildren(org.w3c.dom.Node node,
ParameterContainer ns_pars)
Internal method that prints all child nodes of the given one. |
protected void |
printChildren(org.w3c.dom.Node node,
ParameterContainer ns_pars,
boolean escapeChars)
Internal method that prints all child nodes of the given one, and with escaping of text nodes specified. |
protected void |
printChildren(org.w3c.dom.Node node,
ParameterContainer ns_pars,
java.lang.String sep)
Internal method that prints all child nodes of the given one, separated by sep and with escaping of text nodes true. |
protected void |
printChildren(org.w3c.dom.Node node,
ParameterContainer ns_pars,
java.lang.String sep,
boolean escapeChars)
Internal method that prints all child nodes of the given one, separated by sep. |
protected void |
printElement(org.w3c.dom.Element node,
ParameterContainer ns_pars)
Internal method that prints the Element node "node"; All known namespace prefixes and URIs are in ns_pars. |
protected boolean |
printElementContent(org.w3c.dom.Element node,
ParameterContainer ns_pars)
Internal method that prints the content of an element. |
void |
printExternal(org.w3c.dom.Node node,
ParameterContainer ns_pars)
|
void |
printExternalChildren(org.w3c.dom.Node node,
ParameterContainer ns_pars)
|
Methods inherited from class uk.ac.bham.gloss.XRNormalizer |
---|
doc, escapeXML, getXRAttribute, getXRAttributeData, getXRAttributeData, getXRAttributeNS, isWhiteSpace, localName, normalize, normalize, normalizeChildren, normalizeElement, normalizeEmptyNode, normalizeText, normalizeText, out, prefix, printRawDocument, printXRDocument, setOS, setOutputEncoding, trimSpace, warning |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.lang.String idAttrName
protected java.lang.String idAttrNS
Constructor Detail |
---|
public XRPrinter(java.io.OutputStream os)
Method Detail |
---|
public void print(org.w3c.dom.Document doc) throws java.io.IOException, GlossException
java.io.IOException
GlossException
public java.lang.String getTextData(org.w3c.dom.Node node) throws GlossException
GlossException
public java.lang.String getCDATAData(org.w3c.dom.Node node) throws GlossException
GlossException
public java.lang.String getLiteralData(org.w3c.dom.Node node) throws GlossException
GlossException
public java.lang.String getCommentData(org.w3c.dom.Node node) throws GlossException
GlossException
public java.lang.String getPIData(org.w3c.dom.Node node, java.lang.String target) throws GlossException
GlossException
protected static java.lang.String escapeComment(java.lang.String buff)
protected static java.lang.String escapePI(java.lang.String buff)
protected void printElement(org.w3c.dom.Element node, ParameterContainer ns_pars) throws GlossException
GlossException
protected void printChildren(org.w3c.dom.Node node, ParameterContainer ns_pars) throws GlossException
GlossException
protected void printChildren(org.w3c.dom.Node node, ParameterContainer ns_pars, boolean escapeChars) throws GlossException
GlossException
protected void printChildren(org.w3c.dom.Node node, ParameterContainer ns_pars, java.lang.String sep) throws GlossException
GlossException
protected void printChildren(org.w3c.dom.Node node, ParameterContainer ns_pars, java.lang.String sep, boolean escapeChars) throws GlossException
GlossException
protected void printAttributes(org.w3c.dom.Element node, ParameterContainer ns_pars, ParameterContainer attrsPrinted, ParameterContainer prefixesUsed) throws GlossException
GlossException
protected boolean printElementContent(org.w3c.dom.Element node, ParameterContainer ns_pars) throws GlossException
GlossException
public void print(org.w3c.dom.Node node, ParameterContainer ns_pars) throws GlossException
GlossException
protected org.w3c.dom.Element findNodeID(org.w3c.dom.Element node, java.lang.String id, boolean local)
protected org.w3c.dom.Element findLocalNodePath(org.w3c.dom.Element node, java.lang.String nodePath) throws GlossException
GlossException
protected org.w3c.dom.Element findNodePath(org.w3c.dom.Element node, java.lang.String nodePath, boolean local) throws GlossException
GlossException
public void printExternal(org.w3c.dom.Node node, ParameterContainer ns_pars) throws GlossException
GlossException
public void printExternalChildren(org.w3c.dom.Node node, ParameterContainer ns_pars) throws GlossException
GlossException
protected void getCharacterData(org.w3c.dom.Node node, java.lang.StringBuffer buff) throws GlossException
GlossException
protected void getTextOrAttributeData(org.w3c.dom.Node node, java.lang.StringBuffer buff) throws GlossException
GlossException
public java.lang.String getAttributeData(org.w3c.dom.Node node) throws GlossException
GlossException
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |