public class XmlParser
extends java.lang.Object
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.
Modifier and Type | Class and Description |
---|---|
static class |
XmlParser.Attribute
XML Attribute.
|
static class |
XmlParser.Node
XML Node.
|
Constructor and Description |
---|
XmlParser()
Construct
|
XmlParser(boolean validating) |
Modifier and Type | Method and Description |
---|---|
void |
addContentHandler(java.lang.String trigger,
org.xml.sax.ContentHandler observer)
Add a ContentHandler.
|
java.lang.String |
getDTD() |
java.lang.String |
getXpath() |
boolean |
isValidating() |
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 String URL.
|
void |
redirectEntity(java.lang.String name,
java.net.URL entity) |
protected org.xml.sax.InputSource |
resolveEntity(java.lang.String pid,
java.lang.String sid) |
void |
setValidating(boolean validating) |
void |
setXpath(java.lang.String xpath)
Set an XPath A very simple subset of xpath is supported to select a partial tree.
|
public XmlParser()
public XmlParser(boolean validating)
public void setValidating(boolean validating)
public boolean isValidating()
public void redirectEntity(java.lang.String name, java.net.URL entity)
public java.lang.String getXpath()
public void setXpath(java.lang.String xpath)
xpath
- The xpath to set.public java.lang.String getDTD()
public void addContentHandler(java.lang.String trigger, org.xml.sax.ContentHandler observer)
trigger
- Tag local or q name.observer
- SAX ContentHandlerpublic XmlParser.Node parse(org.xml.sax.InputSource source) throws java.io.IOException, org.xml.sax.SAXException
java.io.IOException
org.xml.sax.SAXException
public XmlParser.Node parse(java.lang.String url) throws java.io.IOException, org.xml.sax.SAXException
url
- the url to the xml to parsejava.io.IOException
- if unable to load the xmlorg.xml.sax.SAXException
- if unable to parse the xmlpublic XmlParser.Node parse(java.io.File file) throws java.io.IOException, org.xml.sax.SAXException
file
- the file to the xml to parsejava.io.IOException
- if unable to load the xmlorg.xml.sax.SAXException
- if unable to parse the xmlpublic XmlParser.Node parse(java.io.InputStream in) throws java.io.IOException, org.xml.sax.SAXException
in
- the input stream of the xml to parsejava.io.IOException
- if unable to load the xmlorg.xml.sax.SAXException
- if unable to parse the xmlprotected org.xml.sax.InputSource resolveEntity(java.lang.String pid, java.lang.String sid)
Copyright © 1995–2023 Webtide. All rights reserved.