I'm currently getting user input from a very large form as an XML document. I'd like to validate this XML document against a schema before any database related operations. The problem is that users input dates according to their own preferences (US standard, ISO standard, etc.) and the database exp开发者_运维问答ects dates to be ISO standard. Is there anyway I can validate this XML document and change the dates to ISO format before adding it to the database? I'm using Perl for the back-end, any libraries that can help me do the same?
Cheers,
For date conversion
HTTP::Date
For dealing with xmls in general
Perl-XML
PM for processing XLST (you guessed it)
XML::XLST
There is Data::Validate::XSD with which I do not have any experience.
In the past, I did use XML::LibXML::Schema.
I would traverse the document, converting all dates using DateTime::Format::XSD (in conjunction with DateTime) and then attempt to validate.
You can have a little schema to validate your special date with a regexp, then an xslt to transform your date to other format, then a schema to validate all your xml document.
精彩评论