简体   繁体   中英

What is the best way to validate XML against XML Schema, parsing it and storing data back to MySQL Database using Perl?

Currently I am working with XML and I want to know what would be best approach to validate XML against XML Schema, parse it and store it back to MySQL database using Perl ?

I think of XML::Xerces for parsing purpose but not sure if it's the right approach.

Note: I have very large XML file >1GB size.

XML Xerces will match your needs. I am using it and i really like it.

In addition to your first edit:

Since your XMl File is very big you have to think of optimizing your parsing process since lot of memory and time can be used for that.

Found an nice small example to get started:

XML Validation with Perl

Another Add:

If you dont want to write simple XML to your Database...it is important that you have an eye on your data, since your validation is outdated after you've written it to the Database in a different form. Be sure that you validate with a good scheme and some extra validators. Large XML can be tricky sometimes.

You could use a XSD to validate the XML and if you can format the XML into something MySQL can just import/insert. Here is an example

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM