Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3597290
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T20:05:56+00:00 2026-05-18T20:05:56+00:00

I am trying to have my perl script get an Xxml file from online

  • 0

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

The code to do this is as follows:

my $url = shift @ARGV;
my $response = $ua->get($url) || die "Can't fetch file";
my $file = $response->content;

my $schema_file = "schema.xsd";
my $schema = XML::LibXML::Schema->new(location => $schema_file);
my $parser = XML::LibXML->new;
my $doc    = $parser->parse_string($file);
eval { $schema->validate($doc) };
die $@ if $@;

Running this results in a cryptic error: “Element cropdata content check failure” (cropdata is the first of my nonroot tags).

In my XSD file, the entry looks like:

<xs:element name="cropdata">
<xs:complexType>
<xs:sequence>

Then a bunch of “<xs:element..../>”
and then:

</xs:sequence>
</xs:complexType>
</xs:element>

Going into the perl debugger shows that after letting the line "my $doc = $parser->parse_string($file);" run, $doc prints as XML::LibXML::Document=SCALAR(0x6b99f0).

Can anyone help me shed light on what I am doing wrong? (Warning: it may be a dumb mistake, I wouldn’t put it past myself).

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T20:05:57+00:00Added an answer on May 18, 2026 at 8:05 pm

    Turns out that the sample xml file I had been provided was invalid, and lo and behold, upon checking and correcting it in xmllint, everything works.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to have my perl script get an Xxml file from online
Trying to get a simple test perl script working. Have the following files/folder structure
I have been trying to write a perl script to get all of the
I have a Perl script and I am trying to make it print out
I'm trying to update some existing code that normally runs a Perl script which
I'm still learning Perl at the moment and have been trying to get a
Has anyone run perl script given at http://oreilly.com/pub/h/974#code ? This is a famous one,
Here is what im trying to achieve. I have a perl script that looks
I have the following Perl script. I am trying to run it in Windows
I have a perl script that is used to monitor databases and I'm trying

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.