Re: Validating with XML::LibXML::RelaxNG?

Petr Pajas <[email protected]>
Newsgroups gmane.comp.lang.perl.xml
Message-ID <[email protected]>
Fixed version now in SVN ( svn co svn://axkit.org/XML-LibXML/trunk )

-- Petr


2009/7/16 Petr Pajas <[email protected]>:
> 2009/7/7 Vaclav Barta <[email protected]>:
>> On Tuesday 07 July 2009 11:56:53 Petr Pajas wrote:
>>> I just looked into the libxml2 source code to find out that it stores
>>> some per-node psvi information based on previous successful
>>> validation. If the node->psvi pointer equals the pointer to the
>>> definition it is currently being tested against, the validation of
>>> that node is skipped. This means that nodes that were once valid
>> ...
>>> Not sure how to deal with this in XML::LibXML. Options include:
>> If you're concerned about efficiency, I suppose you can maintain a 3-state
>> flag per document:
>>  - either it hasn't been validated before (and therefore has no validation
>> info)
>>  - or it has been validated but hasn't changed since then (so the validation
>> info is correct)
>>  - or has changed after validation - this is the only case when the next
>> validation must clear the cached info before it starts
>
> In fact I can never be completely sure about the second case, since
> the validator simply compares node->psvi's as pointers. It you free
> one schema and load another one, there is a nonzero (though little)
> chance that some node->psvi pointers will again point to a grammar
> rule from the new schema it is supposed to match and the validator
> will skip the actual check. Esp. if the first and second schema are
> very similar.
>
> This is in fact nice, since it reduces the situation to just two
> cases: validated before / never validated. When a document is
> validated, I just have to taint the document node and keep it tainted
> forever. This means I won't have to worry about linking nodes with the
> same owner document to the document tree (i.e. the remove nodes,
> validate, append nodes, re-validate scenario does not influence the
> status). However, when a node from a tainted document is imported to
> the current document tree, the current document must also get tainted
> (or, the psvi information from the imported subtree must be cleared).
>
> -- Petr
>
>
> -- Petr
>
_______________________________________________
Perl-XML mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.