internet data handling and encoding startdocument(called at the start of document startelement(nameattrscalled whenever new xml element is encountered name is the name of the elementand attrs is an object containing attribute information for exampleif the xml element is ''name is set to 'fooand attrs contains information about the bar and spam attributes the attrs object provides number of methods for obtaining attribute informationmethod description attrs getlength(attrs getnames(attrs gettype(nameattrs getvalue(namereturns the number of attributes returns list of attribute names gets the type of attribute name gets the value of attribute name startelementns(nameqnameattrscalled when new xml element is encountered and xml namespaces are being used name is tuple (urilocalnameand qname is fully qualified element name (normally set to none unless the sax namespace-prefixes feature has been enabledattrs is an object containing attribute information for exampleif the xml element is '<foo:bar xmlns:foo="name is ( 'when accessing attributes in the startelement(method shown earlier in additionthe following additional methods are added to deal with namespacesmethod description attrs getvaluebyqname(qnameattrs getnamebyqname(qnamereturns value for qualified name returns (namespacelocalnametuple for name returns qualified name for name specified as tuple (namespacelocalnamereturns qualified names of all attributes attrs getqnamebyname(nameattrs getqnames( startprefixmapping(prefixuricalled at the start of an xml namespace declaration for exampleif an element is defined as '<foo:bar xmlns:foo="'fooand uri is set to 'example the following example illustrates sax-based parserby printing out the ingredient list from the recipe file shown earlier this should be compared with the example in the xml dom minidom section lib fl ff