java.lang.Object
org.htmlunit.html.XmlSerializer
Utility to handle conversion from HTML code to XML string.
- Author:
- Ahmed Ashour, Ronald Brill, Marc Guillemot
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the text content of the specified node.asXml(DomElement node) Returns the XML representation of the specified element.getAttributesFor(HtmlImage image) Returns the attributes to serialize for the specified image.getAttributesFor(HtmlLink link) Returns the attributes to serialize for the specified link.protected booleanisExcluded(DomElement element) Determines whether the specified element should be excluded from serialization.protected voidprintOpeningTag(DomElement node) Prints the content between "<" and ">" (or "/>") in the output of the tag name and its attributes in XML format.protected voidPrints the text content from this node and all children.protected voidprintXml(DomElement node) voidSaves the specified page to the given file.
-
Constructor Details
-
XmlSerializer
public XmlSerializer()
-
-
Method Details
-
save
Saves the specified page to the given file.- Parameters:
page- the page to savefile- the destination- Throws:
IOException- in case of error
-
asXml
Returns the XML representation of the specified element.- 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
Returns the text content of the specified node.- Parameters:
node- a node- Returns:
- the text representation according to the setting of this serializer
-
printText
Prints the text content from this node and all children.- Parameters:
node- the node
-
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
-
getAttributesFor
Returns the attributes to serialize for the specified link.- Parameters:
link- the link to get the attributes from- Returns:
- the attribute map
- Throws:
IOException- in case of error
-
getAttributesFor
Returns the attributes to serialize for the specified image.- Parameters:
image- the image to get the attributes from- Returns:
- the attribute map
-
isExcluded
Determines whether the specified element should be excluded from serialization.- Parameters:
element- the element to check- Returns:
- true if the element is a HtmlScript
-