note 81068 added to function.dom-domdocument-schemavalidate
| From: | poletto at jeuxvideo dot com | Date: | Wed, 13 Feb 2008 08:32:47 +0000 |
| Subject: | note 81068 added to function.dom-domdocument-schemavalidate | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-136099@lists.php.net to get a copy of this message | ||
I had a tricky issue using this method, i thought it was bug but i realized i misundestood something
about namespaces.
When you want to use a schema to describe an xml document, you basically put the default namespace
to a personnal namespace (and you refer to this namespace in the targetNamespace attribute of your
schema).
<?xml version="1.0" encoding="utf-8"?>
<root xmlns="http://my.uri.net">
<elt>
<x>blabla</x>
<y>blabla</y>
</elt>
</root>
That xmlns attribute specifies a "default namespace" and means that the root element and
its children are in this namespace.
What i misunderstood is that, there's no way with the DOM api to specify a "default
namespace" for each children of the root element.
Thus you may need to use createElementNS() and createAttributeNS() methods for each created element
or attribute in the document specifying the URI of your namespace each time ("http://my.uri.net").
This only applies if you want to validate a document built with the API, not with a document loaded
from an xml file or stream.
----
Server IP: 69.147.83.197
Probable Submitter: 83.206.74.241
----
Manual Page -- http://www.php.net/manual/en/function.dom-domdocument-schemavalidate.php
Edit -- https://master.php.net/note/edit/81068
Del: integrated -- https://master.php.net/note/delete/81068/integrated
Del: useless -- https://master.php.net/note/delete/81068/useless
Del: bad code -- https://master.php.net/note/delete/81068/bad+code
Del: spam -- https://master.php.net/note/delete/81068/spam
Del: non-english -- https://master.php.net/note/delete/81068/non-english
Del: in docs -- https://master.php.net/note/delete/81068/in+docs
Del: other reasons-- https://master.php.net/note/delete/81068
Reject -- https://master.php.net/note/reject/81068
Search -- https://master.php.net/manage/user-notes.php