public class XMLReaderChar
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
char[] |
buffer |
int |
bufferSize |
boolean |
debug |
protected boolean |
ReadAll |
| Constructor and Description |
|---|
XMLReaderChar() |
XMLReaderChar(char[] buffer) |
| Modifier and Type | Method and Description |
|---|---|
void |
clearErrorMessage() |
int |
countNodes(java.lang.String nodeName)
Counts the number of nodes matching nodeName
|
protected boolean |
equals(char[] to)
Compare xml from current position to the param char[] to
|
protected boolean |
equals(char[] to,
boolean terminator)
Compare xml from current position to the param char[] 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) |
char[] |
getAttributeValueAsChar(java.lang.String attributeName) |
char[] |
getAttributeValueAsChar(java.lang.String attributeName,
boolean reset) |
char[] |
getContent() |
char[] |
getContent(java.lang.String elementName) |
java.lang.String |
getContentAsString() |
java.lang.String |
getContentAsString(java.lang.String elementName) |
int |
getCurPos() |
char[] |
getElement(char[] elementName)
find a matching element from the current position in the xml, return it's
body from element start including < to element end.
|
char[] |
getElement(char[] 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) |
char[] |
getElementAttributeAsChar(java.lang.String elementName,
java.lang.String elementAttributeName) |
static int |
getElementNameLen(java.lang.String content) |
java.lang.String |
getErrorMessage() |
static java.lang.String |
getInnerContent(java.lang.String content)
Gets the inner content (if any) between the node start and node end
|
char[] |
getInnerElement(char[] elementName)
find a matching element from the current position in the xml, return it's
body from element start including < to element end.
|
char[] |
getInnerElement(char[] 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) |
XMLParserChar |
getNextNodeWithNS(char[][] nameSpaces)
find a matching element from the current position in the xml, return it's
body from element start including < to element end.
|
XMLReaderChar |
getNextNodeWithNS(java.lang.String nameSpace)
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 |
getNextNodeWithNSAsString(char[][] nameSpaces) |
java.lang.String |
getNextNodeWithNSAsString(java.lang.String nameSpace) |
XMLReaderChar |
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(char[] nodeName)
find a matching element end from the current position in the xml, return
it's ending position index including the >
|
int |
getNodeStart(char[] nodeName)
find a matching element from the current position in the xml, return it's
starting position index
|
int |
getNSEnd(char[] nodeName)
find a matching element end from the current position in the xml, return
it's ending position index including the >
|
int |
getNSStart(char[] nameSpace)
find a matching NameSpace from the current position in the xml, return
it's starting position index
|
int |
getNSStart(char[][] nameSpaces)
find a matching NameSpace from the current position in the xml, return
it's starting position index
|
boolean |
isWhiteSpace(char b)
Checks if a char is a whitespace.
|
boolean |
isXMLNameChar(char b) |
static void |
main(java.lang.String[] args) |
protected boolean |
nsEquals(char[] to,
boolean terminator)
Compare xml from current position to the param char[] to
|
char |
read()
Read a char skipping any
or any
<![CDATA[...]]> |
char[] |
replaceAmps() |
char[] |
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 | & < > / ;
|
java.lang.String |
toString() |
public char[] buffer
public int bufferSize
public boolean debug
protected boolean ReadAll
public XMLReaderChar()
public XMLReaderChar(char[] buffer)
public java.lang.String getErrorMessage()
public void clearErrorMessage()
public int getCurPos()
public void setCurPos(int pos)
public void reset()
public char 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(char[] to)
throws java.lang.Exception
to - is what we want to compare the xml buffer to.java.lang.Exceptionprotected boolean equals(char[] 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.Exceptionprotected boolean nsEquals(char[] 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 boolean isWhiteSpace(char b)
whitespace = ' ' || 0x09 || 0x0a || 0x0d
b - - the char to checkpublic boolean isXMLNameChar(char b)
b - is the xml character we want to checkpublic int getNSStart(char[] nameSpace)
public int getNSStart(char[][] nameSpaces)
public int getNodeStart(char[] nodeName)
public int getNodeEnd(char[] nodeName)
public int getNSEnd(char[] nodeName)
public XMLReaderChar getNode(java.lang.String nodeName)
public XMLReaderChar getNextNodeWithNS(java.lang.String nameSpace)
public XMLParserChar getNextNodeWithNS(char[][] nameSpaces)
public java.lang.String getNodeAsString(java.lang.String nodeName)
public java.lang.String getNextNodeWithNSAsString(java.lang.String nameSpace)
public java.lang.String getNextNodeWithNSAsString(char[][] nameSpaces)
public char[] getElement(char[] elementName)
public char[] getElement(char[] elementName,
int index)
public char[] getInnerElement(char[] elementName)
public char[] getInnerElement(char[] 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 char[] getAttributeValueAsChar(java.lang.String attributeName)
public char[] getAttributeValueAsChar(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 char[] getElementAttributeAsChar(java.lang.String elementName,
java.lang.String elementAttributeName)
public java.lang.String getContentAsString()
public java.lang.String getContentAsString(java.lang.String elementName)
public char[] getContent()
public char[] getContent(java.lang.String elementName)
public char[] replaceCDATA()
public char[] replaceAmps()
public int countNodes(java.lang.String nodeName)
nodeName - name of nodes we want to countpublic static void main(java.lang.String[] args)
public java.lang.String toString()
toString in class java.lang.Objectpublic static java.lang.String getInnerContent(java.lang.String content)
Will not alter position markers
content - with start and end nodepublic static int getElementNameLen(java.lang.String content)