William Ricker wrote:
> I would have to think that... having the schema drive acceptance or
> rejection, would perform far better.

So you're suggesting the code should walk the schema once, and inspect
the document for compliance as it goes?

That wouldn't work, as the document contains items that aren't in the
schema, so you'd have to keep track of which nodes you validated, and
then still query or walk the document looking for things that weren't
covered by the schema.


> Parsing the Schema once should be cheaper than querying it.

That's my assumption as well, but what I don't know is how efficient
XML::LibXML's internal structures are. In theory, they could approach
the efficiency of Perl's native hash lookups.


> For Xpath-ish things (which I don't think you want here) I usually opt
> for XML::Twig.
>    http://www.perladvent.org/2009/6/

XML::Twig puts a Perl layer over XML::Parser (expat), so I don't think
that's going to be a performance win.

I haven't tried using XML::Twig::XPath, but it deviates from the DOM
API, which can make it harder to port your code to a different XML
library. (One of the advantages to using XML::LibXML's DOM API is that
you can often fill in documentation gaps using other DOM references.)

 -Tom

-- 
Tom Metro
Venture Logic, Newton, MA, USA
"Enterprise solutions through open source."
Professional Profile: http://tmetro.venturelogic.com/

_______________________________________________
Boston-pm mailing list
Boston-pm@mail.pm.org
http://mail.pm.org/mailman/listinfo/boston-pm

Reply via email to