org.mortbay.xml
Class XmlParser

java.lang.Object
  |
  +--org.mortbay.xml.XmlParser

public class XmlParser
extends java.lang.Object

XML Parser wrapper. This class wraps any standard JAXP1.1 parser with convieniant error and entity handlers and a mini dom-like document tree.

By default, the parser is created as a validating parser. This can be changed by setting the "org.mortbay.xml.XmlParser.NotValidating" system property to true.

Version:
$Id: XmlParser.java,v 1.9.2.1 2004/03/29 12:51:44 gregwilkins Exp $
Author:
Greg Wilkins (gregw)

Nested Class Summary
static class XmlParser.Attribute
          XML Attribute.
static class XmlParser.Node
          XML Node.
 
Constructor Summary
XmlParser()
          Construct
XmlParser(boolean validating)
          Constructor.
 
Method Summary
 void addContentHandler(java.lang.String trigger, org.xml.sax.ContentHandler observer)
          Add a ContentHandler.
 XmlParser.Node parse(java.io.File file)
          Parse File.
 XmlParser.Node parse(org.xml.sax.InputSource source)
           
 XmlParser.Node parse(java.io.InputStream in)
          Parse InputStream.
 XmlParser.Node parse(java.lang.String url)
          Parse URL.
 XmlParser.Node parse(java.net.URL url)
          Parse URL.
 void redirectEntity(java.lang.String name, Resource entity)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XmlParser

public XmlParser()
Construct


XmlParser

public XmlParser(boolean validating)
Constructor.

Method Detail

redirectEntity

public void redirectEntity(java.lang.String name,
                           Resource entity)
Parameters:
name -
entity -

addContentHandler

public void addContentHandler(java.lang.String trigger,
                              org.xml.sax.ContentHandler observer)
Add a ContentHandler. Add an additional content handler that is triggered on a tag name. SAX events are passed to the ContentHandler provided from a matching start element to the corresponding end element. Only a single content handler can be registered against each tag.

Parameters:
trigger - Tag local or q name.
observer - SAX ContentHandler

parse

public XmlParser.Node parse(org.xml.sax.InputSource source)
                     throws java.io.IOException,
                            org.xml.sax.SAXException
java.io.IOException
org.xml.sax.SAXException

parse

public XmlParser.Node parse(java.lang.String url)
                     throws java.io.IOException,
                            org.xml.sax.SAXException
Parse URL.

java.io.IOException
org.xml.sax.SAXException

parse

public XmlParser.Node parse(java.io.File file)
                     throws java.io.IOException,
                            org.xml.sax.SAXException
Parse File.

java.io.IOException
org.xml.sax.SAXException

parse

public XmlParser.Node parse(java.io.InputStream in)
                     throws java.io.IOException,
                            org.xml.sax.SAXException
Parse InputStream.

java.io.IOException
org.xml.sax.SAXException

parse

public XmlParser.Node parse(java.net.URL url)
                     throws java.io.IOException,
                            org.xml.sax.SAXException
Parse URL.

java.io.IOException
org.xml.sax.SAXException


Copyright ? 2000 Mortbay Consulting Pty. Ltd. All Rights Reserved.