|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcds.xml.XMLParser
public final class XMLParser
XML parser. Simple XML parser for well-formed XML documents in ASCII, without validation Resolves automatically & " ' < >. Compacts blanks in one space (doesn't take into account SPACE XMl declaration. Assumes that the XML document begins with or . It uses 3 methodes to interact with a XML event consumer (similar to the XML SAX interface) -> startElement(), endElement() and characters() but the startElement() send an Hashtable for the tag parameters instead of the AttrList SAX object ==> See the XmlConsumer java interface to have an example of usage The in(nameList) method allows one to know at any time if the current parser state correspond to a particular XML levels
Field Summary | |
---|---|
int |
nstack
|
Constructor Summary | |
---|---|
XMLParser(XMLConsumer ac)
Create a new XMLParser object |
|
XMLParser(XMLConsumer ac,
boolean withStack)
|
Method Summary | |
---|---|
int |
getDepth()
|
java.lang.String |
getError()
Return the error report. |
java.util.Stack |
getStack()
Return the stack of the tag name. |
byte[] |
getUnreadBuffer()
Retourne les caractères non lus du buffer courant, ou null si lecture terminée |
boolean |
in(java.lang.String nameList)
Return true if the tag name list in parameter is found in the XML stack (with the same order) and ends with the last tag name in the list. |
boolean |
parse(MyInputStream dis)
Launch the XML parsing. |
boolean |
parse(MyInputStream dis,
java.lang.String endTag)
Lancement du parsing XML pour une sous-section. |
static java.lang.String |
XMLDecode(java.lang.String s)
Decode XML macros |
static java.lang.String |
XMLEncode(java.lang.String s)
Encode XML macros |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public int nstack
Constructor Detail |
---|
public XMLParser(XMLConsumer ac)
ac
- an object implementing the XMLConsumer interfacewithStack
- true si on gère une pile des tags (méthode in() et getStack() possible)public XMLParser(XMLConsumer ac, boolean withStack)
Method Detail |
---|
public boolean parse(MyInputStream dis) throws java.lang.Exception
dis
- the input stream
java.lang.Exception
public boolean parse(MyInputStream dis, java.lang.String endTag) throws java.lang.Exception
dis
- le stream à parserendTag
- le TAG XML qui déterminera la fin du parsing partiel
java.lang.Exception
public java.util.Stack getStack() throws java.lang.Exception
java.lang.Exception
public int getDepth()
public boolean in(java.lang.String nameList) throws java.lang.Exception
nameList
- List of tag names, separated by spaces
java.lang.Exception
public java.lang.String getError()
public static java.lang.String XMLEncode(java.lang.String s)
s
- the string to encode
public static java.lang.String XMLDecode(java.lang.String s)
s
- the string to decode
public byte[] getUnreadBuffer()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |