public class XmlParser extends 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.
| 限定符和类型 | 类和说明 |
|---|---|
static class |
XmlParser.Attribute
XML Attribute.
|
static class |
XmlParser.Node
XML Node.
|
| 限定符和类型 | 方法和说明 |
|---|---|
void |
addContentHandler(String trigger,
ContentHandler observer)
Add a ContentHandler.
|
String |
getDTD() |
String |
getXpath() |
boolean |
isValidating() |
XmlParser.Node |
parse(File file)
Parse File.
|
XmlParser.Node |
parse(InputSource source) |
XmlParser.Node |
parse(InputStream in)
Parse InputStream.
|
XmlParser.Node |
parse(String url)
Parse String URL.
|
void |
redirectEntity(String name,
URL entity) |
protected InputSource |
resolveEntity(String pid,
String sid) |
void |
setValidating(boolean validating) |
void |
setXpath(String xpath)
Set an XPath A very simple subset of xpath is supported to select a partial tree.
|
public void setValidating(boolean validating)
public boolean isValidating()
public String getXpath()
public void setXpath(String xpath)
xpath - The xpath to set.public String getDTD()
public void addContentHandler(String trigger, ContentHandler observer)
trigger - Tag local or q name.observer - SAX ContentHandlerpublic XmlParser.Node parse(InputSource source) throws IOException, SAXException
public XmlParser.Node parse(String url) throws IOException, SAXException
url - the url to the xml to parseIOException - if unable to load the xmlSAXException - if unable to parse the xmlpublic XmlParser.Node parse(File file) throws IOException, SAXException
file - the file to the xml to parseIOException - if unable to load the xmlSAXException - if unable to parse the xmlpublic XmlParser.Node parse(InputStream in) throws IOException, SAXException
in - the input stream of the xml to parseIOException - if unable to load the xmlSAXException - if unable to parse the xmlprotected InputSource resolveEntity(String pid, String sid)
Copyright © 2017. All rights reserved.