Class 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 Detail

      • foundStartOfInput

        public void foundStartOfInput​(char[] buffer,
                                      int offset,
                                      int count)
        Description copied from class: XmlTokenizer
        Method called before to start tokenizing.

        Derived class may override this method, for doing whatever appropriate housekeeping (sniffing at the encoding, etc.)

        Overrides:
        foundStartOfInput in class XmlTokenizer
        Parameters:
        buffer - byte array containing the first bytes of the input about to be tokenized
        offset - position of the first byte to be tokenized
        count - number of bytes to be tokenized
      • foundStartTagName

        public void foundStartTagName​(char[] buffer,
                                      int offset,
                                      int count)
        Description copied from class: XmlTokenizer
        Method called when a start-tag has been found.

        Derived class may override this method.

        Overrides:
        foundStartTagName in class XmlTokenizer
        Parameters:
        buffer - byte array containing the name of the tag that started
        offset - position of the first character of the tag name in the array
        count - number of bytes the tag name is made of
      • foundEndTagName

        public void foundEndTagName​(char[] buffer,
                                    int offset,
                                    int count)
        Description copied from class: XmlTokenizer
        Method called when an end-tag has been found.

        Derived class may override this method.

        Overrides:
        foundEndTagName in class XmlTokenizer
        Parameters:
        buffer - byte array containing the name of the tag that ended
        offset - position of the first character of the tag name in the array
        count - number of bytes the tag name is made of
      • foundEndEmptyTag

        public void foundEndEmptyTag()
        Description copied from class: XmlTokenizer
        Method 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:
        foundEndEmptyTag in class XmlTokenizer
      • foundCharacterData

        public void foundCharacterData​(char[] buffer,
                                       int offset,
                                       int count)
        Description copied from class: XmlTokenizer
        Method called when a character data content has been found.

        Derived class may override this method.

        Overrides:
        foundCharacterData in class XmlTokenizer
        Parameters:
        buffer - byte array containing the character data that was found
        offset - position of the first character data in the array
        count - number of bytes the character data content is made of
      • foundCharacter

        public void foundCharacter​(char charFound)
        Description copied from class: XmlTokenizer
        Method 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:
        foundCharacter in class XmlTokenizer
        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: XmlTokenizer
        Method called when an attribute name has been found.

        Derived class may override this method.

        Overrides:
        foundAttributeName in class XmlTokenizer
        Parameters:
        buffer - byte array containing the attribute name
        offset - position of the first character of the attribute name in the array
        count - 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: XmlTokenizer
        Method called when an attribute value has been found.

        Derived class may override this method.

        Overrides:
        foundAttributeValue in class XmlTokenizer
        Parameters:
        buffer - byte array containing the attribute value
        offset - position of the first character of the attribute value in the array
        count - number of bytes the attribute value is made of
        dlm - delimiter that started the attribute value (' or "). '\0' if none
      • foundEndOfInput

        public void foundEndOfInput​(int count)
        Description copied from class: XmlTokenizer
        Method called when the end of the input was found, and the tokenization is about to end.

        Derived class may override this method.

        Overrides:
        foundEndOfInput in class XmlTokenizer
        Parameters:
        count - number of bytes parsed