code: def asXML( self, doctag=None, namedItemsOnly=False, indent="", formatted=True ):
          
          nl = "\n"
          out = []
          namedItems = dict((v[1],k) for (k,vlist) in self.__tokdict.items()
                                                              for v in vlist)
          nextLevelIndent = indent + "  "
  
          # collapse out indents if formatting is not desired
          if not formatted:
              indent = ""
              nextLevelIndent = ""
              nl = ""
  
          selfTag = None
          if doctag is not None:
              selfTag = doctag
          else:
              if self.__name:
                  selfTag = self.__name
  
          if not selfTag:
              if namedItemsOnly:
                  return ""
              else:
                  selfTag = "ITEM"
  
          out += [ nl, indent, "<", selfTag, ">" ]
  
          for i,res in enumerate(self.__toklist):
              if isinstance(res,ParseResults):
                  if i in namedItems:
                      out += [ res.asXML(namedItems[i],
                                          namedItemsOnly and doctag is None,
                                          nextLevelIndent,
                                          formatted)]
                  else:
                      out += [ res.asXML(None,
                                          namedItemsOnly and doctag is None,
                                          nextLevelIndent,
                                          formatted)]
              else:
                  # individual token, see if there is a name for it
                  resTag = None
                  if i in namedItems:
                      resTag = namedItems[i]
                  if not resTag:
                      if namedItemsOnly:
                          continue
                      else:
                          resTag = "ITEM"
                  xmlBodyText = _xml_escape(_ustr(res))
                  out += [ nl, nextLevelIndent, "<", resTag, ">",
                                                  xmlBodyText,
                                                  "</", resTag, ">" ]
  
          out += [ nl, indent, "</", selfTag, ">" ]
          return "".join(out)
docs: (Deprecated) Returns the parse results as XML. Tags are created for tokens and lists that have defined results names.