From 3959083837c7d2bfa6e922980b4a58faa68e5176 Mon Sep 17 00:00:00 2001 From: Asmir Mustafic Date: Tue, 17 Jun 2014 09:46:08 +0200 Subject: Documentation about #45 --- README.md | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index f3dfa8a..5732748 100644 --- a/README.md +++ b/README.md @@ -136,7 +136,9 @@ issues known issues that are not presently on the roadmap: - Namespaces: HTML5 only [supports a selected list of namespaces](http://www.w3.org/TR/html5/infrastructure.html#namespaces) and they do not operate in the same way as XML namespaces. A `:` has no special - meaning. The parser does not support XML style namespaces via `:`. + meaning. + By default the parser does not support XML style namespaces via `:`; + to enable the XML namespaces see the [XML Namespaces section](#xml-namespaces) - Scripts: This parser does not contain a JavaScript or a CSS interpreter. While one may be supplied, not all features will be supported. @@ -164,6 +166,37 @@ issues known issues that are not presently on the roadmap: - PLAINTEXT: Unsupported. - Adoption Agency Algorithm: Not yet implemented. (8.2.5.4.7) +##XML Namespaces + +To use XML style namespaces you have to configure well the main `HTML5` instance. + +```php +$html = new HTML5(array( + "xmlNamespaces" => true +)); + +$dom = $html->loadHTML(''); + +$dom->documentElement->namespaceURI; // http://www.example.com + +``` + +You can also add some default prefixes that will not require the namespace declaration, +but it's elements will be namespaced. + +```php +$html = new HTML5(array( + "implicitNamespaces"=>array( + "t"=>"http://www.example.com" + ) +)); + +$dom = $html->loadHTML(''); + +$dom->documentElement->namespaceURI; // http://www.example.com + +``` + ## Thanks to... The dedicated (and patient) contributors of patches small and large, -- cgit v1.2.3