public class XMLReader
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
boolean |
debug |
protected boolean |
ReadAll |
| Modifier and Type | Method and Description |
|---|---|
void |
clearErrorMessage() |
int |
countNodes(java.lang.String nodeName)
Counts the number of nodes matching nodeName
|
protected boolean |
equals(byte[] to)
Compare xml from current position to the param byte[] to
|
protected boolean |
equals(byte[] to,
boolean terminator)
Compare xml from current position to the param byte[] to
|
int |
findEndElement(boolean both)
Find '</' or '/>
|
int |
findStartElement()
Find '<'
todo allow cdata section <![CDATA[...]]>
|
java.lang.String |
getAttributeValue()
Get attribute value starting at curPos.
|
java.lang.String |
getAttributeValue(java.lang.String attributeName) |
byte[] |
getAttributeValueAsByte(java.lang.String attributeName) |
byte[] |
getAttributeValueAsByte(java.lang.String attributeName,
boolean reset) |
byte[] |
getContent() |
byte[] |
getContent(java.lang.String elementName) |
java.lang.String |
getContentAsString() |
java.lang.String |
getContentAsString(java.lang.String elementName) |
int |
getCurPos() |
byte[] |
getElement(byte[] elementName)
find a matching element from the current position in the xml, return it's
body from element start including < to element end.
|
byte[] |
getElement(byte[] elementName,
int index)
find a matching element from the current position in the xml, return it's
body from element start including < to element end.
|
java.lang.String |
getElementAttribute(java.lang.String elementName,
java.lang.String elementAttributeName) |
byte[] |
getElementAttributeAsByte(java.lang.String elementName,
java.lang.String elementAttributeName) |
java.lang.String |
getErrorMessage() |
byte[] |
getInnerElement(byte[] elementName)
find a matching element from the current position in the xml, return it's
body from element start including < to element end.
|
byte[] |
getInnerElement(byte[] elementName,
int index)
find a matching element from the current position in the xml, return it's
body from element start including < to element end.
|
int |
getIntAttributeValue(java.lang.String attributeName) |
int |
getIntElementAttribute(java.lang.String elementName,
java.lang.String elementAttributeName) |
java.lang.String |
getNextAttributeValue(java.lang.String attributeName) |
XMLReader |
getNode(java.lang.String nodeName)
find a matching element from the current position in the xml, return it's
body from element start including < to element end.
|
java.lang.String |
getNodeAsString(java.lang.String nodeName) |
int |
getNodeEnd(byte[] nodeName)
find a matching element end from the current position in the xml, return
it's ending position index including the >
|
int |
getNodeStart(byte[] nodeName)
find a matching element from the current position in the xml, return it's
starting position index
|
static boolean |
isWhiteSpace(byte b) |
boolean |
isXMLNameChar(byte b) |
static void |
main(java.lang.String[] args) |
byte |
read()
Read a byte skipping any
or any
<![CDATA[...]]> |
byte[] |
replaceAmps() |
byte[] |
replaceCDATA()
This will replace any and all CDATA sections within the reader.
|
void |
reset() |
void |
setCurPos(int pos) |
void |
skipNonWhiteSpace()
skip over non white space including ' ' 0x0a and 0x0d
|
void |
skipNonXMLName()
skip over non xml name characters for now these will be anything but
whitespace | & < > / ;
|
void |
skipWhiteSpace()
skip over white space including ' ' 0x0a and 0x0d
|
void |
skipXMLName()
skip over valid xml name characters for now these will be anything but
whitespace | & < > / ;
|
public java.lang.String getErrorMessage()
public void clearErrorMessage()
public int getCurPos()
public void setCurPos(int pos)
public void reset()
public byte read()
throws EndOfBufferException,
BadXMLException,
java.lang.Exception
or any
<![CDATA[...]]>EndOfBufferExceptionBadXMLExceptionjava.lang.Exceptionpublic int findStartElement()
public int findEndElement(boolean both)
public void skipXMLName()
public void skipNonXMLName()
public void skipWhiteSpace()
public void skipNonWhiteSpace()
protected boolean equals(byte[] to)
throws java.lang.Exception
to - is what we want to compare the xml buffer to.java.lang.Exceptionprotected boolean equals(byte[] to,
boolean terminator)
throws java.lang.Exception
to - is what we want to compare the xml buffer to.terminator - if set true will force a check for a whitespace or = character
at the end of the match.java.lang.Exceptionpublic static boolean isWhiteSpace(byte b)
public boolean isXMLNameChar(byte b)
b - is the xml character we want to checkpublic int getNodeStart(byte[] nodeName)
public int getNodeEnd(byte[] nodeName)
public XMLReader getNode(java.lang.String nodeName)
public java.lang.String getNodeAsString(java.lang.String nodeName)
public byte[] getElement(byte[] elementName)
public byte[] getElement(byte[] elementName,
int index)
public byte[] getInnerElement(byte[] elementName)
public byte[] getInnerElement(byte[] elementName,
int index)
public java.lang.String getAttributeValue(java.lang.String attributeName)
public java.lang.String getAttributeValue()
public java.lang.String getNextAttributeValue(java.lang.String attributeName)
public int getIntAttributeValue(java.lang.String attributeName)
throws java.lang.Exception
java.lang.Exceptionpublic byte[] getAttributeValueAsByte(java.lang.String attributeName)
public byte[] getAttributeValueAsByte(java.lang.String attributeName,
boolean reset)
public java.lang.String getElementAttribute(java.lang.String elementName,
java.lang.String elementAttributeName)
public int getIntElementAttribute(java.lang.String elementName,
java.lang.String elementAttributeName)
throws java.lang.Exception
java.lang.Exceptionpublic byte[] getElementAttributeAsByte(java.lang.String elementName,
java.lang.String elementAttributeName)
public java.lang.String getContentAsString()
public java.lang.String getContentAsString(java.lang.String elementName)
public byte[] getContent()
public byte[] getContent(java.lang.String elementName)
public byte[] replaceCDATA()
public byte[] replaceAmps()
public int countNodes(java.lang.String nodeName)
nodeName - name of nodes we want to countpublic static void main(java.lang.String[] args)