: Class Xparse
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
com.exploringxml.xml
Class Xparse
java.lang.Object | +--com.exploringxml.xml.Xparse
- public class Xparse
- extends java.lang.Object
Simple XML parser derived from the XParse Javascript parser; Please see http://www.jeremie.com for more information on this. Quoting Jeremie: "Fully complies to the XML 1.0 spec as a well-formed processor, with the exception of full error reporting and the document type declaration(and it's related features, internal entities, etc)."
| Inner Class Summary | |
(package private) class |
Xparse.Frag
an internal fragment that is passed between functions |
| Field Summary | |
(package private) static int |
count
|
(package private) static JSArray |
index
|
| Constructor Summary | |
Xparse()
|
|
| Method Summary | |
(package private) java.util.Hashtable |
attribution(java.lang.String str)
util for element attribute parsing |
(package private) Xparse.Frag |
compile(Xparse.Frag frag)
transforms raw text input into a multilevel JSArray |
(package private) java.lang.String |
entity(java.lang.String str)
util to replace internal entities in input string |
(package private) java.lang.String |
normalize(java.lang.String str)
util to replace white characters in input string |
Node |
parse(java.lang.String src)
Main public function that is called to parse the XML string and return a root element object |
(package private) java.lang.String |
prolog(java.lang.String str)
util to remove \r characters from input string |
(package private) java.lang.String |
strip(java.lang.String str)
util to remove white characters from input string |
private java.lang.String |
substring(java.lang.String s,
int start,
int length)
Helper function for matching Javascript's definition of the substring function to not cause an IndexOutOfBoundsException when length exceeds string length but return the remainder of the string instead MC20001214 |
(package private) Xparse.Frag |
tagCData(Xparse.Frag frag)
process XML character data (CDATA) |
(package private) Xparse.Frag |
tagComment(Xparse.Frag frag)
process an XML comment |
(package private) Xparse.Frag |
tagElement(Xparse.Frag frag)
process an XML element |
(package private) Xparse.Frag |
tagPI(Xparse.Frag frag)
process an XML processing instruction (PI) |
| Methods inherited from class java.lang.Object |
|
| Field Detail |
count
static int count
index
static JSArray index
| Constructor Detail |
Xparse
public Xparse()
| Method Detail |
substring
private java.lang.String substring(java.lang.String s,
int start,
int length)
- Helper function for matching Javascript's definition
of the substring function to not cause an IndexOutOfBoundsException
when length exceeds string length but return the remainder
of the string instead MC20001214
- Parameters:
s- the string to slicestart- the starting position within slength- the number of characters to slice- Returns:
- the substring
parse
public Node parse(java.lang.String src)
- Main public function that is called to
parse the XML string and return a root element object
- Parameters:
src- the object's index in the array- Returns:
- the parsed XML's root Node
compile
Xparse.Frag compile(Xparse.Frag frag)
- transforms raw text input into a multilevel JSArray
- Parameters:
frag- the input fragment- Returns:
- the output fragment
tagElement
Xparse.Frag tagElement(Xparse.Frag frag)
- process an XML element
- Parameters:
frag- the input fragment- Returns:
- the output fragment
tagPI
Xparse.Frag tagPI(Xparse.Frag frag)
- process an XML processing instruction (PI)
- Parameters:
frag- the input fragment- Returns:
- the output fragment
tagComment
Xparse.Frag tagComment(Xparse.Frag frag)
- process an XML comment
- Parameters:
frag- the input fragment- Returns:
- the output fragment
tagCData
Xparse.Frag tagCData(Xparse.Frag frag)
- process XML character data (CDATA)
- Parameters:
frag- the input fragment- Returns:
- the output fragment
attribution
java.util.Hashtable attribution(java.lang.String str)
- util for element attribute parsing
- Parameters:
attribute- string- Returns:
- an JSArray of all of the keys = values
prolog
java.lang.String prolog(java.lang.String str)
- util to remove \r characters from input string
- Parameters:
attribute- string- Returns:
- the xml string without a prolog
strip
java.lang.String strip(java.lang.String str)
- util to remove white characters from input string
- Parameters:
string-- Returns:
- stripped string
normalize
java.lang.String normalize(java.lang.String str)
- util to replace white characters in input string
- Parameters:
string-- Returns:
- normalized string
entity
java.lang.String entity(java.lang.String str)
- util to replace internal entities in input string
- Parameters:
string-- Returns:
- string with replaced entitities
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||

Find a programming school near you