Top Description Inners Fields Constructors Methods
org.eclipse.jetty.xml

public Class XmlParser

extends Object
Class Inheritance
Known Direct Subclasses
org.eclipse.jetty.xml.XmlConfiguration.ConfigurationParser
Imports
java.io.File, .IOException, .InputStream, java.net.URI, .URL, java.util.AbstractList, .ArrayList, .HashMap, .Iterator, .List, .Map, .NoSuchElementException, .Stack, .StringTokenizer, javax.xml.catalog.Catalog, .CatalogFeatures, .CatalogManager, .CatalogResolver, javax.xml.parsers.SAXParser, .SAXParserFactory, org.eclipse.jetty.util.LazyList, org.eclipse.jetty.util.thread.AutoLock, org.slf4j.Logger, .LoggerFactory, org.xml.sax.Attributes, .ContentHandler, .EntityResolver, .InputSource, .SAXException, .SAXParseException, .XMLReader, org.xml.sax.helpers.DefaultHandler

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

By default, the parser is created as a validating parser only if xerces is present. This can be configured by setting the "org.eclipse.jetty.xml.XmlParser.Validating" system property.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
XmlParser.Attribute

XML Attribute.

private class
public static class
XmlParser.Node

XML Node.

private class

Field Summary

Modifier and TypeField and Description
private String
private List<EntityResolver>
private final AutoLock
private Map<String, ContentHandler>
private Stack<ContentHandler>
private SAXParser
private String
private Object
private static final Logger

Constructor Summary

AccessConstructor and Description
public
XmlParser()

Construct XmlParser

public
XmlParser(boolean
true to enable validation, false to disable
validating
)

Construct XmlParser

Method Summary

Modifier and TypeMethod and Description
public void
addCatalog(URI
the URI pointing to the XML catalog
catalogXml
,
Class<?>
the base class to use for finding relative resources defined in the Catalog XML. This is resolved to the Class location with package location and is used as the XML Catalog Base URI.
baseClassLocation
)

Load the specified URI as a catalog for entity mapping purposes.

public void
addCatalog(URI
the uri to the catalog
catalogXml
)

Load the specified URI as a catalog for entity mapping purposes.

public void
addContentHandler(String
Tag local or q name.
trigger
,
ContentHandler
SAX ContentHandler
observer
)

Add a ContentHandler.

public String
public SAXParser
private static boolean
public String
getXpath()

Returns: Returns the xpath.

public boolean
pack-priv AutoLock
lock()

protected SAXParserFactory
public XmlParser.Node
public XmlParser.Node

Returns:

the root node of the xml
parse
(String
the url to the xml to parse
url
)

Parse String URL.

public XmlParser.Node

Returns:

the root node of the xml
parse
(File
the file to the xml to parse
file
)

Parse File.

public XmlParser.Node

Returns:

the root node of the xml
parse
(InputStream
the input stream of the xml to parse
in
)

Parse InputStream.

pack-priv InputSource
public void
setValidating(boolean validating)

public void
setXpath(String
The xpath to set.
xpath
)

Set an XPath A very simple subset of xpath is supported to select a partial tree.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait