Package totalcross.xml
Class DumpXml
- java.lang.Object
-
- totalcross.xml.XmlTokenizer
-
- totalcross.xml.DumpXml
-
public class DumpXml extends XmlTokenizer
Dumb Xml class used only to dump to the Debug Console the contents of a XML. It implements each of the methods that are called by the XmlTokenizer class. You can run this to understand how to handle a XML. Here's a sample: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.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidfoundAttributeName(char[] buffer, int offset, int count)Method called when an attribute name has been found.voidfoundAttributeValue(char[] buffer, int offset, int count, char dlm)Method called when an attribute value has been found.voidfoundCharacter(char charFound)Method called when a character has been found in the contents, which is resulting from a character reference resolution.voidfoundCharacterData(char[] buffer, int offset, int count)Method called when a character data content has been found.voidfoundEndEmptyTag()Method called when an empty-tag has been found.voidfoundEndOfInput(int count)Method called when the end of the input was found, and the tokenization is about to end.voidfoundEndTagName(char[] buffer, int offset, int count)Method called when an end-tag has been found.voidfoundStartOfInput(char[] buffer, int offset, int count)Method called before to start tokenizing.voidfoundStartTagName(char[] buffer, int offset, int count)Method called when a start-tag has been found.-
Methods inherited from class totalcross.xml.XmlTokenizer
disableReferenceResolution, foundComment, foundDeclaration, foundInvalidData, foundProcessingInstruction, foundReference, getAbsoluteOffset, hashCode, isDataCDATA, resolveCharacterReference, setCdataContents, setStrictlyXml, tokenize, tokenize, tokenize, tokenize
-
-
-
-
Constructor Detail
-
DumpXml
public DumpXml()
Must call tokenize by yourself.
-
DumpXml
public DumpXml(Stream stream) throws SyntaxException, IOException, java.io.UnsupportedEncodingException
- Throws:
SyntaxExceptionIOExceptionjava.io.UnsupportedEncodingException
-
-
Method Detail
-
foundStartOfInput
public void foundStartOfInput(char[] buffer, int offset, int count)Description copied from class:XmlTokenizerMethod called before to start tokenizing.Derived class may override this method, for doing whatever appropriate housekeeping (sniffing at the encoding, etc.)
- Overrides:
foundStartOfInputin classXmlTokenizer- Parameters:
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 tokenized
-
foundStartTagName
public void foundStartTagName(char[] buffer, int offset, int count)Description copied from class:XmlTokenizerMethod called when a start-tag has been found.Derived class may override this method.
- Overrides:
foundStartTagNamein classXmlTokenizer- Parameters:
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 of
-
foundEndTagName
public void foundEndTagName(char[] buffer, int offset, int count)Description copied from class:XmlTokenizerMethod called when an end-tag has been found.Derived class may override this method.
- Overrides:
foundEndTagNamein classXmlTokenizer- Parameters:
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 of
-
foundEndEmptyTag
public void foundEndEmptyTag()
Description copied from class:XmlTokenizerMethod called when an empty-tag has been found.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();- Overrides:
foundEndEmptyTagin classXmlTokenizer
-
foundCharacterData
public void foundCharacterData(char[] buffer, int offset, int count)Description copied from class:XmlTokenizerMethod called when a character data content has been found.Derived class may override this method.
- Overrides:
foundCharacterDatain classXmlTokenizer- Parameters:
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 of
-
foundCharacter
public void foundCharacter(char charFound)
Description copied from class:XmlTokenizerMethod called when a character has been found in the contents, which is resulting from a character reference resolution.Derived class may override this method.
- Overrides:
foundCharacterin classXmlTokenizer- Parameters:
charFound- resolved character - if the character is invalid, this value is set to '\uffff', which is not a unicode character.- See Also:
XmlTokenizer#foundReference(byte[],int,int)
-
foundAttributeName
public void foundAttributeName(char[] buffer, int offset, int count)Description copied from class:XmlTokenizerMethod called when an attribute name has been found.Derived class may override this method.
- Overrides:
foundAttributeNamein classXmlTokenizer- Parameters:
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 of
-
foundAttributeValue
public void foundAttributeValue(char[] buffer, int offset, int count, char dlm)Description copied from class:XmlTokenizerMethod called when an attribute value has been found.Derived class may override this method.
- Overrides:
foundAttributeValuein classXmlTokenizer- Parameters:
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 none
-
foundEndOfInput
public void foundEndOfInput(int count)
Description copied from class:XmlTokenizerMethod called when the end of the input was found, and the tokenization is about to end.Derived class may override this method.
- Overrides:
foundEndOfInputin classXmlTokenizer- Parameters:
count- number of bytes parsed
-
-