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 7647919
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T10:34:53+00:00 2026-05-31T10:34:53+00:00

I am validating a SVG document (which I believe to be valid) against the

  • 0

I am validating a SVG document (which I believe to be valid) against the SVG spec. I’m using XMLReader in PHP, and would rather stick with that as I will be using XMLReader elsewhere; that said if there are other stream-based readers that will do this easier/better, do let me me know.

OK, here’s some code:

    // Set some values for the purpose of this example
    $this->path = '/Users/jon/Development/Personal/Visualised/master/test-assets/import-png.svg';
    $xsdPath = '/Users/jon/Development/Personal/Visualised/master/test-assets/xsd/SVG.xsd';

    $reader = new XMLReader();
    $reader->open($this->path);
    $valid = $reader->setSchema($xsdPath);
    $reader->close();

OK, so the XSD files I’ve got in my xsd folder are:

  • SVG.xsd
  • xlink.xsd
  • xml.xsd

It seems that the parser imports the second and third XSD from the first – I want any dependencies to be stored on disk, not retrieved from the internet.

OK, here’s the output:

    XMLReader::setSchema(): Element '{http://www.w3.org/2001/XMLSchema}import': Skipping import of schema located at '/Users/jon/Development/Personal/Visualised/master/test-assets/xsd/xml.xsd' for the namespace 'http://www.w3.org/XML/1998/namespace', since this namespace was already imported with the schema located at 'http://www.w3.org/2001/xml.xsd'. in /Users/jon/Development/Personal/Visualised/master/lib/Visualised/Document.php on line 45

    Warning: XMLReader::setSchema(): Element '{http://www.w3.org/2001/XMLSchema}attribute': The attribute 'type' is not allowed. in /Users/jon/Development/Personal/Visualised/master/lib/Visualised/Document.php on line 45

    Warning: XMLReader::setSchema(): Element '{http://www.w3.org/2001/XMLSchema}attribute': The attribute 'type' is not allowed. in /Users/jon/Development/Personal/Visualised/master/lib/Visualised/Document.php on line 45

    Warning: XMLReader::setSchema(): Element '{http://www.w3.org/2001/XMLSchema}attribute': The attribute 'type' is not allowed. in /Users/jon/Development/Personal/Visualised/master/lib/Visualised/Document.php on line 45

    Warning: XMLReader::setSchema(): Unable to set schema. This must be set prior to reading or schema contains errors. in /Users/jon/Development/Personal/Visualised/master/lib/Visualised/Document.php on line 45

It seems like maybe I have imported the wrong version of a schema somewhere – I found all the XSD docs just through a web search. Any ideas?

Edit: the last error suggests the schema should be set before reading the document. OK, so I’ve changed the code to this:

$reader = new XMLReader();
$valid = $reader->setSchema($xsdPath);
$reader->open($this->path);
$reader->close();

— some of the initial warnings go, but I still get the Unable to set schema one.

  • 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-31T10:34:55+00:00Added an answer on May 31, 2026 at 10:34 am

    The XSD file for SVG you link to is from an old working draft version of SVG 1.1. There’s currently no officially supported XML schema for SVG 1.1. Please see this answer for more details.

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

Sidebar

Related Questions

I'm validating a form using jQuery and against a database using PHP-MySQL. The AJAX
I am validating a zip code using Javascript that is generated server-side, and injected
I'm validating my field against decimal but I would like to support the EURO.
I'm validating a user password using an @Pattern regex. That works fine, but then
Have some validating problems which seem to appear only when using the Auth component.
I am validating a text box using javascript, now what happens is that if
When validating user inputs in an application that is to be run across multiple
When validating a document in the ItemAdding event there are many ways to display
I'm validating a textbox for valid email with this: <asp:RegularExpressionValidator ID=RegularExpressionValidator1 ControlToValidate=txtMailCustom Text=Invalid address
I am validating an AlertDialog, and I would like to raise a Toast on

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.