public class DumpXml extends XmlTokenizer
File f = new File("data.xml",File.READ_WRITE); new totalcross.xml.DumpXML(f); f.close();Then you'll learn how each of the methods of the XmlTokenizer interface are called, and you can then create your own logic to handle the element calls.
Constructor and Description |
---|
DumpXml()
Must call tokenize by yourself.
|
DumpXml(Stream stream) |
Modifier and Type | Method and Description |
---|---|
void |
foundAttributeName(byte[] buffer,
int offset,
int count)
Method called when an attribute name has been found.
|
void |
foundAttributeValue(byte[] buffer,
int offset,
int count,
byte dlm)
Method called when an attribute value has been found.
|
void |
foundCharacter(char charFound)
Method called when a character has been found in the contents, which is resulting from a character reference resolution.
|
void |
foundCharacterData(byte[] buffer,
int offset,
int count)
Method called when a character data content has been found.
|
void |
foundEndEmptyTag()
Method called when an empty-tag has been found.
|
void |
foundEndOfInput(int count)
Method called when the end of the input was found, and the tokenization is
about to end.
|
void |
foundEndTagName(byte[] buffer,
int offset,
int count)
Method called when an end-tag has been found.
|
void |
foundStartOfInput(byte[] buffer,
int offset,
int count)
Method called before to start tokenizing.
|
void |
foundStartTagName(byte[] buffer,
int offset,
int count)
Method called when a start-tag has been found.
|
disableReferenceResolution, foundComment, foundDeclaration, foundInvalidData, foundProcessingInstruction, foundReference, getAbsoluteOffset, hashCode, isDataCDATA, resolveCharacterReference, setCdataContents, setStrictlyXml, tokenize, tokenize, tokenize, tokenize
public DumpXml()
public DumpXml(Stream stream) throws SyntaxException, IOException
SyntaxException
IOException
public void foundStartOfInput(byte[] buffer, int offset, int count)
XmlTokenizer
Derived class may override this method, for doing whatever appropriate housekeeping (sniffing at the encoding, etc.)
foundStartOfInput
in class XmlTokenizer
buffer
- byte array containing the first bytes of the input about to
be tokenizedoffset
- position of the first byte to be tokenizedcount
- number of bytes to be tokenizedpublic void foundStartTagName(byte[] buffer, int offset, int count)
XmlTokenizer
Derived class may override this method.
foundStartTagName
in class XmlTokenizer
buffer
- byte array containing the name of the tag that startedoffset
- position of the first character of the tag name in the arraycount
- number of bytes the tag name is made ofpublic void foundEndTagName(byte[] buffer, int offset, int count)
XmlTokenizer
Derived class may override this method.
foundEndTagName
in class XmlTokenizer
buffer
- byte array containing the name of the tag that endedoffset
- position of the first character of the tag name in the arraycount
- number of bytes the tag name is made ofpublic void foundEndEmptyTag()
XmlTokenizer
This method is called just after all events related to the starting tag have been reported. The implied tag name is the one of the starting tag (e.g.: the most recently reported start tag.)
Derived class may override this method.
Example:
<FOO A=B> generates: - foundStartTagName("FOO"); - foundAttributeName("A"); - foundAttributeValue("B"); - foundEndEmptyTag();
foundEndEmptyTag
in class XmlTokenizer
public void foundCharacterData(byte[] buffer, int offset, int count)
XmlTokenizer
Derived class may override this method.
foundCharacterData
in class XmlTokenizer
buffer
- byte array containing the character data that was foundoffset
- position of the first character data in the arraycount
- number of bytes the character data content is made ofpublic void foundCharacter(char charFound)
XmlTokenizer
Derived class may override this method.
foundCharacter
in class XmlTokenizer
charFound
- resolved character - if the character is invalid, this value
is set to '\uffff', which is not a unicode character.XmlTokenizer.foundReference(byte[],int,int)
public void foundAttributeName(byte[] buffer, int offset, int count)
XmlTokenizer
Derived class may override this method.
foundAttributeName
in class XmlTokenizer
buffer
- byte array containing the attribute nameoffset
- position of the first character of the attribute name in the
arraycount
- number of bytes the attribute name is made ofpublic void foundAttributeValue(byte[] buffer, int offset, int count, byte dlm)
XmlTokenizer
Derived class may override this method.
foundAttributeValue
in class XmlTokenizer
buffer
- byte array containing the attribute valueoffset
- position of the first character of the attribute value in the
arraycount
- number of bytes the attribute value is made ofdlm
- delimiter that started the attribute value (' or "). '\0' if
nonepublic void foundEndOfInput(int count)
XmlTokenizer
Derived class may override this method.
foundEndOfInput
in class XmlTokenizer
count
- number of bytes parsed