|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.xml.sax.helpers.XMLFilterImpl
com.izforge.izpack.adaptator.impl.LineNumberFilter
public class LineNumberFilter
A custom SAX XML filter, used to add line numbers to a DOM document. This filter stores line numbers while parsing, and the applyLN method set line numbers on the result. Line numbers are stored in the user data of the Element, so require Java 5 (DOM 3) or higher.
| Field Summary | |
|---|---|
private java.util.Queue<java.lang.Integer> |
lnQueue
a queue to store line numbers while parsing. |
private org.xml.sax.Locator |
locator
The locator given while parsing. |
| Constructor Summary | |
|---|---|
LineNumberFilter(org.xml.sax.XMLReader xmlReader)
|
|
| Method Summary | |
|---|---|
void |
applyLN(javax.xml.transform.dom.DOMResult result)
Apply line numbers stored by a parse using this object on the xml elements. |
private void |
applyLN(org.w3c.dom.Element elt)
Apply a line number on the given element. |
org.xml.sax.Locator |
getDocumentLocator()
Return the locator on the current position. |
private org.w3c.dom.Element |
getFirstChild(org.w3c.dom.Node elt)
Return the first element child found from the given Node. |
private org.w3c.dom.Element |
getFirstFoundElement(org.w3c.dom.Node elt)
Return the first element found from the given Node. |
private org.w3c.dom.Element |
getNextSibling(org.w3c.dom.Node elt)
Return the next element sibling found from the given Node. |
private boolean |
hasChildElements(org.w3c.dom.Node elt)
Returns whether the given node has any element children. |
void |
setDocumentLocator(org.xml.sax.Locator locator)
|
void |
startDocument()
|
void |
startElement(java.lang.String uri,
java.lang.String localName,
java.lang.String qName,
org.xml.sax.Attributes atts)
|
| Methods inherited from class org.xml.sax.helpers.XMLFilterImpl |
|---|
characters, endDocument, endElement, endPrefixMapping, error, fatalError, getContentHandler, getDTDHandler, getEntityResolver, getErrorHandler, getFeature, getParent, getProperty, ignorableWhitespace, notationDecl, parse, parse, processingInstruction, resolveEntity, setContentHandler, setDTDHandler, setEntityResolver, setErrorHandler, setFeature, setParent, setProperty, skippedEntity, startPrefixMapping, unparsedEntityDecl, warning |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private java.util.Queue<java.lang.Integer> lnQueue
private org.xml.sax.Locator locator
| Constructor Detail |
|---|
public LineNumberFilter(org.xml.sax.XMLReader xmlReader)
| Method Detail |
|---|
public void startDocument()
throws org.xml.sax.SAXException
startDocument in interface org.xml.sax.ContentHandlerstartDocument in class org.xml.sax.helpers.XMLFilterImplorg.xml.sax.SAXException
public void startElement(java.lang.String uri,
java.lang.String localName,
java.lang.String qName,
org.xml.sax.Attributes atts)
throws org.xml.sax.SAXException
startElement in interface org.xml.sax.ContentHandlerstartElement in class org.xml.sax.helpers.XMLFilterImplorg.xml.sax.SAXExceptionpublic void setDocumentLocator(org.xml.sax.Locator locator)
setDocumentLocator in interface org.xml.sax.ContentHandlersetDocumentLocator in class org.xml.sax.helpers.XMLFilterImplpublic org.xml.sax.Locator getDocumentLocator()
private org.w3c.dom.Element getFirstFoundElement(org.w3c.dom.Node elt)
elt - The Node start point.
private org.w3c.dom.Element getNextSibling(org.w3c.dom.Node elt)
elt - The Node start point.
private org.w3c.dom.Element getFirstChild(org.w3c.dom.Node elt)
elt - The Node start point.
private boolean hasChildElements(org.w3c.dom.Node elt)
elt - The node to check.
true if this node has any children,
false otherwise.private void applyLN(org.w3c.dom.Element elt)
elt - the element to apply the line number.public void applyLN(javax.xml.transform.dom.DOMResult result)
result - The result of the parse.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||