|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.mockrunner.util.web.XmlUtil
public class XmlUtil
Util class for HTML and XML parsing.
Constructor Summary | |
---|---|
XmlUtil()
|
Method Summary | |
---|---|
static org.jdom.Document |
createJDOMDocument(org.w3c.dom.Document document)
Creates a JDOM Document from a specified
W3C Document . |
static java.lang.String |
createStringFromJDOMDocument(org.jdom.Document document)
Returns the documents XML content as a string. |
static org.jdom.Element |
getBodyFragmentFromJDOMDocument(org.jdom.Document document)
Convinience method for HTML fragments. |
static org.jdom.Element |
getBodyFragmentJDOMDocument(org.jdom.Document document)
Deprecated. use getBodyFragmentFromJDOMDocument(org.jdom.Document) |
static org.apache.xerces.parsers.DOMParser |
getHTMLParser()
Returns a parser suitable for parsing HTML documents. |
static org.w3c.dom.Document |
parse(org.apache.xerces.parsers.DOMParser parser,
java.lang.String source)
Parses the specified XML with the specified parser. |
static org.w3c.dom.Document |
parseHTML(java.lang.String source)
Parses the specified HTML with the NekoHTML parser. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public XmlUtil()
Method Detail |
---|
public static org.jdom.Element getBodyFragmentFromJDOMDocument(org.jdom.Document document)
Element
.
If an HTML documents looks like this:
<html> <head> </head> <body> <h1> </h1> </body> </html>the method returns the h1 tag as
Element
.
document
- the org.jdom.Document
Element
public static org.jdom.Element getBodyFragmentJDOMDocument(org.jdom.Document document)
getBodyFragmentFromJDOMDocument(org.jdom.Document)
public static java.lang.String createStringFromJDOMDocument(org.jdom.Document document)
document
- the org.jdom.Document
public static org.jdom.Document createJDOMDocument(org.w3c.dom.Document document)
Document
from a specified
W3C Document
.
document
- the org.w3c.dom.Document
org.jdom.Document
public static org.apache.xerces.parsers.DOMParser getHTMLParser()
parseHTML(java.lang.String)
.
org.apache.xerces.parsers.DOMParser
with Neko configurationpublic static org.w3c.dom.Document parseHTML(java.lang.String source)
parse
method.
source
- the HTML as String
public static org.w3c.dom.Document parse(org.apache.xerces.parsers.DOMParser parser, java.lang.String source)
parseHTML(java.lang.String)
.
parser
- the parser (must extend
org.apache.xerces.parsers.DOMParser
),
e.g. the one returned by getHTMLParser()
source
- the XML as String
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |