01: /*
02: * Copyright (c) 1998-2008 Caucho Technology -- all rights reserved
03: *
04: * This file is part of Resin(R) Open Source
05: *
06: * Each copy or derived work must preserve the copyright notice and this
07: * notice unmodified.
08: *
09: * Resin Open Source is free software; you can redistribute it and/or modify
10: * it under the terms of the GNU General Public License as published by
11: * the Free Software Foundation; either version 2 of the License, or
12: * (at your option) any later version.
13: *
14: * Resin Open Source is distributed in the hope that it will be useful,
15: * but WITHOUT ANY WARRANTY; without even the implied warranty of
16: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, or any warranty
17: * of NON-INFRINGEMENT. See the GNU General Public License for more
18: * details.
19: *
20: * You should have received a copy of the GNU General Public License
21: * along with Resin Open Source; if not, write to the
22: * Free SoftwareFoundation, Inc.
23: * 59 Temple Place, Suite 330
24: * Boston, MA 02111-1307 USA
25: *
26: * @author Scott Ferguson
27: */
28:
29: package com.caucho.xml;
30:
31: /**
32: * Loose XML parser interface. The parser can parse directly into
33: * the DOM, or it can be used as a SAX parser.
34: *
35: * <p>Loose XML is forgiving for some common lazy cases, e.g. the following
36: * is allowed in LooseXml, but not XML
37: * <pre><code>
38: * <elt attr=1/>
39: * </code></pre>
40: *
41: * <p>Also, Loose XML adds a convenient shortcut that's standard SGML but
42: * not XML.
43: * <code><foo/any text/></code> is equivalent to
44: * <code><foo>any text</foo></code>
45: *
46: * <p>To parse a file into a DOM Document use
47: * <pre><code>
48: * Document doc = new LooseXml().parseDocument("foo.xml");
49: * </code></pre>
50: *
51: * <p>To parse a string into a DOM Document use
52: * <pre><code>
53: * String xml = "<top>small test</top>";
54: * Document doc = new LooseXml().parseDocumentString(xml);
55: * </code></pre>
56: *
57: * <p>To parse a file using the SAX API use
58: * <pre><code>
59: * LooseXml xml = new LooseXml();
60: * xml.setContentHandler(myContentHandler);
61: * xml.parse("foo.xml");
62: * </code></pre>
63: */
64: public class LooseXml extends XmlParser {
65: /**
66: * Create a new LooseXml parser.
67: */
68: public LooseXml() {
69: super (new Policy(), null);
70: }
71: }
|