Package org.htmlunit.html
Class XmlSerializer
java.lang.Object
org.htmlunit.html.XmlSerializer
Utility to handle conversion from HTML code to XML string.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final StringBuilder
private static final Pattern
private static final String
private final StringBuilder
private static final org.apache.commons.logging.Log
private File
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionasXml
(DomElement node) createAttributesCopyWithClonedAttribute
(HtmlElement elt, String attrName) private File
createFile
(String url, String extension) Computes the best file to save the response to the given URL.getAttributesFor
(BaseFrameElement frame) getAttributesFor
(HtmlImage image) getAttributesFor
(HtmlLink link) private static String
getFileExtension
(Page enclosedPage) private static String
getSuffix
(WebResponse response) protected boolean
isExcluded
(DomElement element) protected void
printOpeningTag
(DomElement node) Prints the content between "<" and ">" (or "/>") in the output of the tag name and its attributes in XML format.protected void
protected void
printXml
(DomElement node) readAttributes
(DomElement node) void
private void
-
Field Details
-
FILE_SEPARATOR
- See Also:
-
CREATE_FILE_PATTERN
-
LOG
private static final org.apache.commons.logging.Log LOG -
builder_
-
indent_
-
outputDir_
-
-
Constructor Details
-
XmlSerializer
public XmlSerializer()
-
-
Method Details
-
save
- Throws:
IOException
-
save
- Throws:
IOException
-
asXml
- Parameters:
node
- a node- Returns:
- the xml representation according to the setting of this serializer
- Throws:
IOException
- in case of problem saving resources
-
printXml
- Throws:
IOException
-
asText
- Parameters:
node
- a node- Returns:
- the text representation according to the setting of this serializer
-
printText
-
printOpeningTag
Prints the content between "<" and ">" (or "/>") in the output of the tag name and its attributes in XML format.- Parameters:
node
- the node whose opening tag is to be printed- Throws:
IOException
- in case of problem saving resources
-
readAttributes
- Throws:
IOException
-
getAttributesFor
- Throws:
IOException
-
getFileExtension
-
getAttributesFor
- Throws:
IOException
-
getAttributesFor
-
getSuffix
-
createAttributesCopyWithClonedAttribute
private static Map<String,DomAttr> createAttributesCopyWithClonedAttribute(HtmlElement elt, String attrName) -
isExcluded
-
createFile
Computes the best file to save the response to the given URL.- Parameters:
url
- the requested URLextension
- the preferred extension- Returns:
- the file to create
- Throws:
IOException
- if a problem occurs creating the file
-