Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » JDOM User »

[jdom-interest] Schema Validation Error

Trikannad, Mahesh

2005-03-24


Hi All,

 

I get the following error, when I do a schema validation.

 

Error on line 1: Content is not allowed in prolog.

 

I want through, the jdom archives, but did not get a resolution. Some say it is a parser problem. Iam using xerces.jar, the one distributed via the jdom-1.0 distriution.

Some say, it is a windows file encoding problem. I tried saving it , with notepad in different formats, that did not work

 

The XML is as follows

 

<?xml version="1.0" encoding="UTF-8"?>

<ESBMessage>

      <Header>

            <MessageId>mahesh</MessageId>

            <OrigSys>ICOM</OrigSys>

            <origSubSys>ICOMS1</origSubSys>

      </Header>

      <Body>

                  </Body>

</ESBMessage>

 

The code for schema validation

-------

 

SAXBuilder builder =

                                      new SAXBuilder("org.apache.xerces.parsers.SAXParser", true);

                                    builder.setFeature("http://apache.org/xml/features/validation/schema", true);

                                    builder.setProperty("http://apache.org/xml/properties/schema/external-noNamespaceSchemaLocation",

                                                            schemaFileName);

           

                                   

                                    Document tmpdoc = builder.build(new StringReader(myDocument.toString()));

                                    System.out.println("myValidate Done");

 

Appreciate your experiences.

 

Mahesh Trikannad

 

This message contains information that may be privileged or confidential and is the property of the Capgemini Group. It is intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorized to read, print, retain, copy, disseminate, distribute, or use this message or any part thereof. If you receive this message in error, please notify the sender immediately and delete all copies of this message.

_______________________________________________
To control your jdom-interest membership:
http://www.jdom.org/mailman/options/jdom-interest/youraddr@(protected)
©2008 junlu.com - Jax Systems, LLC, U.S.A.