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 StringBuilderprivate static final Patternprivate static final Stringprivate final StringBuilderprivate static final org.apache.commons.logging.Logprivate File -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionasXml(DomElement node) createAttributesCopyWithClonedAttribute(HtmlElement elt, String attrName) private FilecreateFile(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 StringgetFileExtension(Page enclosedPage) private static StringgetSuffix(WebResponse response) protected booleanisExcluded(DomElement element) protected voidprintOpeningTag(DomElement node) Prints the content between "<" and ">" (or "/>") in the output of the tag name and its attributes in XML format.protected voidprotected voidprintXml(DomElement node) readAttributes(DomElement node) voidprivate 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
-