diff --git a/doc/3_Other_node_tree_representations.markdown b/doc/3_Other_node_tree_representations.markdown index 9000412..f59988a 100644 --- a/doc/3_Other_node_tree_representations.markdown +++ b/doc/3_Other_node_tree_representations.markdown @@ -211,119 +211,4 @@ This will result in the following output (which includes attributes): ``` There is currently no mechanism to convert JSON back into a node tree. Furthermore, not all ASTs -can be JSON encoded. In particular, JSON only supports UTF-8 strings. - -Serialization to XML --------------------- - -It is also possible to serialize the node tree to XML using `PhpParser\Serializer\XML->serialize()` -and to unserialize it using `PhpParser\Unserializer\XML->unserialize()`. This is useful for -interfacing with other languages and applications or for doing transformation using XSLT. - -```php -create(PhpParser\ParserFactory::PREFER_PHP7); -$serializer = new PhpParser\Serializer\XML; - -try { - $stmts = $parser->parse($code); - - echo $serializer->serialize($stmts); -} catch (PhpParser\Error $e) { - echo 'Parse Error: ', $e->getMessage(); -} -``` - -Produces: - -```xml - - - - - - - - - - - - msg - - - - - - - - - - - - - - - - - - - - - msg - - - - - - - - - - - - - - - printLine - - - - - - - - printLine - - - - - - - - - - - Hello World!!! - - - - - - - - - - - - -``` +can be JSON encoded. In particular, JSON only supports UTF-8 strings. \ No newline at end of file