com.caucho.xml
Class LooseXml

java.lang.Object
  |
  +--com.caucho.xml.AbstractParser
        |
        +--com.caucho.xml.XmlParser
              |
              +--com.caucho.xml.LooseXml
All Implemented Interfaces:
Locator, Parser, XMLReader

public class LooseXml
extends XmlParser

Loose XML parser interface. The parser can parse directly into the DOM, or it can be used as a SAX parser.

Loose XML is forgiving for some common lazy cases, e.g. the following is allowed in LooseXml, but not XML


   <elt attr=1/>
 

Also, Loose XML adds a convenient shortcut that's standard SGML but not XML. <foo/any text/> is equivalent to <foo>any text</foo>

To parse a file into a DOM Document use


 Document doc = new LooseXml().parseDocument("foo.xml");
 

To parse a string into a DOM Document use


 String xml = "<top>small test</top>";
 Document doc = new LooseXml().parseDocumentString(xml);
 

To parse a file using the SAX API use


 LooseXml xml = new LooseXml();
 xml.setContentHandler(myContentHandler);
 xml.parse("foo.xml");
 


Constructor Summary
LooseXml()
          Create a new LooseXml parser.
 
Methods inherited from class com.caucho.xml.XmlParser
getColumnNumber, getLineNumber, getPublicId, getSystemId
 
Methods inherited from class com.caucho.xml.AbstractParser
getContentHandler, getDTDHandler, getEntityResolver, getErrorHandler, getFeature, getForgiving, getProperty, getResinInclude, getSearchPath, getSkipComments, parse, parse, parse, parse, parseDocument, parseDocument, parseDocument, parseDocument, parseDocumentString, parseString, setAutodetectXml, setContentHandler, setDocumentHandler, setDTDHandler, setEntitiesAsText, setEntityResolver, setErrorHandler, setExpandEntities, setFeature, setForgiving, setLocale, setProperty, setResinInclude, setSearchPath, setSkipComments
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LooseXml

public LooseXml()
Create a new LooseXml parser.