Hello,
I've tried to validate the XML document defined in RFC 4479 section 7.1
( http://tools.ietf.org/html/rfc4479#section-7.1 ) with the schema defined
in section 5.1.2 ( http://tools.ietf.org/html/rfc4479#section-5.1.2 ).
This failed with the error:
element presence: Schemas validity error : Element
'{urn:ietf:params:xml:ns:pidf}presence':
No matching global declaration available for the validation root.
I've thought that this happens because there is no 'presence' element
defined in the above schema. So, I have tried to scan the document and
validate each element with the "urn:ietf:params:xml:ns:pidf:data-model"
namespace using the xmlSchemaValidateOneElement function. But when I
have called this function with the first "dm:deviceID" element, the
function failed with the same error message.
I've tried to search the net for more information on xmlSchemaValidateOneElement
but I couldn't find too much. So, I had a look in the source code of
libxml 2.7.3 and I have noticed this strange thing in xmlschemas.c:
In function xmlSchemaValidateOneElement on line 28002 the following attribution
is made
ctxt->validationRoot = elem;
Then xmlSchemaVStart function is called. This function calls the
xmlSchemaVDocWalk function.
xmlSchemaVDocWalk, on line 27723 overwrites the validationRoot with the root of
the document.
27716: valRoot = xmlDocGetRootElement(vctxt->doc);
[...]
27723: vctxt->validationRoot = valRoot;
So it seems that xmlSchemaValidateOneElement always validates the root element
of the document
( this means it validates the entire document )
I've tried to see if there is a path to call xmlSchemaVDocWalk without
initializing
the validationRoot. I have found one more path through xmlSchemaValidateDoc,
but also,
on line 28031 the validationRoot is initialized.
The next thing that I have tried was to remove the reinitialization of
validationRoot
from xmlSchemaVDocWalk on line 27723. After doing this, I could succesifully
validate
the elements from "urn:ietf:params:xml:ns:pidf:data-model" namespace.
Is this a bug, or an intended behaviour?
Regards,
Tiberius Duluman
_______________________________________________
xml mailing list, project page http://xmlsoft.org/
[email protected]
http://mail.gnome.org/mailman/listinfo/xml