I think you are talking in part about "XML Schema Inference", that is generating an XSD schema from an existing instance of XML.
As far as I know there is no module on CPAN that provides this facility (though I would be delighted to be proved wrong.) The basic problem of schema inference (or extraction if you would rather) is described in this paper.
The code currently pipes the string out to "java dom. Should I compile my own Or the (seemingly old and totally undocumented) Or put another way: given a $xml string in perl, how can I validate it as XML? Of immediate interest may be XML:: Twig, XML:: Parser or XML:: Lib XML for validating XML documents.
I simply need a validation step after generating an XML string in perl. And XML-Xerces is like 20 lines of code just to validate -- and you ahve to read the C documentation, which does not quite line up with the perl reality. There are a large number of Perl modules available for working with XML.
As for validating an instance against an existing schema, you have a choice - you can use XML:: Validator:: Schema or the facilities in XML:: Lib XML among others that you will have seen when you performed the search on CPAN as davorg suggested. I've tried XML:: Validator:: Schema lately and was not quite happy with it.
How I can generate the xsd doument in perl and how to vaildate the xml file datas while saving in the xml file.The perl validator program file is : The for schema handling does not have entry for how to handle a "group" element.So it exits by throwing an error after compairing with all the available cases (complex Type, Documentation etc ...). Thank you for posting your code and data sample(s).Errors in XML documents will stop your XML applications.The W3C XML specification states that a program should stop processing an XML document if it finds an error.