validate schema

Posted on 2002-07-09
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: 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(
at org.enhydra.validation.SchemaParser.<init>(
at org.enhydra.validation.Validator.<init>(
at org.enhydra.validation.Validator.getInstance(
at ValidatorTest.main(

What is the problem?

Question by:jdaues

Accepted Solution

wbradney earned 50 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Magento Indexing 1 89
Path of Workbook 3 60
Formatting issues in XSL FO 3 30
Need VB Script to scan through XML file and export content to csv file 9 15
Most of the sites are being standardized with W3C Web Standards. W3C provides lot of web standard services to the web. They have the web specification, process and documentation for all the web standards. You can apply HTML, CSS and Accessibility st…
I found this questions asking how to do this in many different forums, so I will describe here how to implement a solution using PHP and AJAX. The logical flow for the problem should be: Write an event handler for the first drop down box to get …
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

910 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now