Validating XML in Perl with libxml and an XSD file -


I am trying to get an Xxml file from my Perl script online and validate it according to an XSD file .

The code to do this is as follows:

  My $ url = shift @ARGV; My $ response = $ ua- & gt; Get ($ url) || "File can not be brought" dead; My $ file = $ response- & gt; material; My $ schema_file = "schema.xsd"; My $ schema = XML :: LibXML :: Schema- & gt; New (place = & gt; $ schema_file); My $ parse = xml :: libaxem-> new; My $ doc = $ parser- & gt; Parse_string ($ file); Eval {$ schema- & gt; Valid ($ doc)}; Die $ @ if $ @;  

Run this error in a secret error: "Element Crudadata Content Check Failure" (Cropdata is the first of my nonontot tags).

My XSD file looks like an entry in:

   

Then a bunch of " >" and then:

  & Lt; / XS: sequence & gt; & Lt; / XS: complexType & gt; & Lt; / XS: element & gt;  

Going to Perl Debugger shows that the line "my $ doc = $ parseer-> parse_string ($ file);" After running , the $ doc prints as XML :: LibXML :: document = SCALAR (0x6b99f0).

Can anyone help me highlight what I'm doing? (Warning: this can be a filthy mistake, I do not keep it in myself).

is turned on The sample xml file that I was provided was invalid, and And see, everything works in xmllint on checking and correcting it.


Comments

Popular posts from this blog

Eclipse CDT variable colors in editor -

AJAX doesn't send POST query -

wpf - Custom Message Box Advice -