3 namespace RemexHtml\Serializer;
4 use RemexHtml\Tokenizer\Attributes;
7 * The interface for classes that help Serializer to convert nodes to strings.
8 * Serializer assumes that the return values of these functions can be
9 * concatenated to make a document.
11 * It is not safe to assume that the methods will be called in any particular
12 * order, or that the return values will actually be retained in the final
17 * Get a string which starts the document
19 * @param string|null $fragmentNamespace
20 * @param string|null $fragmentName
23 function startDocument( $fragmentNamespace, $fragmentName );
26 * Encode the given character substring
28 * @param SerializerNode $parent The parent of the text node (at creation time)
30 * @param integer $start The offset within $text
31 * @param integer $length The number of bytes within $text
34 function characters( SerializerNode $parent, $text, $start, $length );
37 * Encode the given element
39 * @param SerializerNode $parent The parent of the node (when it is closed)
40 * @param SerializerNode $node The element to encode
41 * @param string|null $contents The previously-encoded contents, or null
42 * for a void element. Void elements can be serialized as self-closing
46 function element( SerializerNode $parent, SerializerNode $node, $contents );
50 * @param SerializerNode $parent The parent of the node (at creation time)
51 * @param string $text The inner text of the comment
54 function comment( SerializerNode $parent, $text );
57 * Encode a doctype. This event occurs when the source document has a doctype,
58 * it can return an empty string if the formatter wants to use its own doctype.
60 * @param string $name The doctype name, usually "html"
61 * @param string $public The PUBLIC identifier
62 * @param string $system The SYSTEM identifier
65 function doctype( $name, $public, $system );