validate schema

Posted on 2002-07-09
Medium Priority
Last Modified: 2013-11-19
I have a few schema files that validate except for the very first line:

<?xml version="1.0"?>

Yet this line is in many of the examples of schema files I see on the net.

The error is:
java.io.IOException: Problems occurred:Error on line 4 of document file:foo.xsd: The processing instruction target matching "[xX][mM][lL]" is not allowed.
at org.enhydra.validation.SchemaParser.parseSchema(SchemaParser.java:122)
at org.enhydra.validation.SchemaParser.<init>(SchemaParser.java:57)
at org.enhydra.validation.Validator.<init>(Validator.java:40)
at org.enhydra.validation.Validator.getInstance(Validator.java:68)
at ValidatorTest.main(ValidatorTest.java:20)

What is the problem?

Question by:jdaues
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Accepted Solution

Wayne Bradney earned 200 total points
ID: 7158294

The answer would seem to lie here:

>>>> Error on line 4 of document file:foo.xsd
The <?xml... ?> declaration is not strictly a Processing Instruction, it's Prolog, and MUST appear before any elements in the document (it should really be the first line/character encountered by the parser). Anywhere else in the document, "[xX][mM][lL]" is not allowed as a PI.

My guess is that the parser is seeing other text or blank lines before encountering the Prolog.

See the spec for more info at:



Author Comment

ID: 7160053
The first 4 lines of the file were:

<!-- bla bla bla bla bla bla bla -->
<!-- bla bla bla bla bla bla bla -->
<!-- bla bla bla bla bla bla bla -->
<?xml version="1.0"?>

By simply placing the version line first, this corrects the problem:

<?xml version="1.0"?>
<!-- bla bla bla bla bla bla bla -->
<!-- bla bla bla bla bla bla bla -->
<!-- bla bla bla bla bla bla bla -->

I guess I was thinking the since the first 3 lines were comments, that it didn't matter.  But it does.


Featured Post

More Than Just A Video Library

Train for your certification. Learn the latest DevOps tools. Grow your skillset to do better work.

At Linux Academy, we release new training modules every week so you'll always be up to date on the latest tech.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

What is Node.js? Node.js is a server side scripting language much like PHP or ASP but is used to implement the complete package of HTTP webserver and application framework. The difference is that Node.js’s execution engine is asynchronous and event…
Create a Windows 10 custom Image with custom task bar and custom start menu using XML for deployment.
The viewer will learn how to dynamically set the form action using jQuery.
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…
Suggested Courses

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question