Solved

validate schema

Posted on 2002-07-09
2
501 Views
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?

0
Comment
Question by:jdaues
2 Comments
 
LVL 6

Accepted Solution

by:
wbradney earned 50 total points
ID: 7158294
jdaues,

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:

http://www.w3.org/TR/2000/REC-xml-20001006#sec-prolog-dtd

Regards,
WMB
0
 

Author Comment

by:jdaues
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.

Thanks.
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

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 look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

757 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

22 Experts available now in Live!

Get 1:1 Help Now