Title: validating with schema
Ok james,
I've done a little test for you. If I introduce a spelling mistake in the xml file on any attribute of any element itself I get the same error.
Basically, it seems that you are using an Element called "personnel" which own an attribute called "noNamespaceSchemaLocation", this Element should have a proper declaration within the dtd followed by its proper attribute declaration. see attribute declaration example bellow
 
[DTD...]
<!ELEMENT Skill  (SkillName , SummaryText? )>
<!ATTLIST Skill  yearsOfExperience CDATA  #IMPLIED
                 level              (1 | 2 | 3 | 4 | 5 )  #IMPLIED
                 interest           (1 | 2 | 3 | 4 | 5 )  #IMPLIED
                 yearLastUsed      CDATA  #IMPLIED
                 category          CDATA  #IMPLIED >
[...DTD]
 
[XML...]
<Skill level="2">JAVA</Skill>
[...XML]
 
1st possibility:
You haven't got at all such a delaration.
 
2nd possibility:
spelling mistake in your xml file. (upper and lower case?)
 
It souldn't be anything else.
 
Regards,
 
Seb

***********************************************************************
S�bastien Mar�chal
Analyst Programmer
Job Partners Ltd.
Mobile: 0044 (0) 775 994 1124
[EMAIL PROTECTED]
***********************************************************************

-----Original Message-----
From: James Liu [mailto:[EMAIL PROTECTED]
Sent: 17 May 2001 16:54
To: '[EMAIL PROTECTED]'
Subject: RE: validating with schema

Sebastien,
 
Thanks for your response. it helps to eliminate those elements not defined errors. but there still is an error:
 
[Error] :4:59: Attribute "xsi:noNamespaceSchemaLocation" must be declared for element type "personnel".
 
Both your code and mine work with the DTD-only xml file, but both report the same error if I added the
schema to the xml file.
 
any idea to validate an xml file against a schema?
 
James
-----Original Message-----
From: Sebastien Marechal [mailto:[EMAIL PROTECTED]
Sent: Thursday, May 17, 2001 10:34 AM
To: '[EMAIL PROTECTED]'
Subject: RE: validating with schema

James,
 
Check if you have you dtd included within the xml file as shown below:
 
<!DOCTYPE JobPositionSeeker SYSTEM "JobPositionSeeker-v1.0.dtd">
 
Then check your dtd is in the right path.
 
If this doesn't work u can have a look at the two classes which only validate the xml document against the dtd. This is the one I use and it works fine.
 
Hope this helps
 
 
regards
 
Seb

***********************************************************************
S�bastien Mar�chal
Analyst Programmer
Job Partners Ltd.
Mobile: 0044 (0) 775 994 1124
[EMAIL PROTECTED]
***********************************************************************

-----Original Message-----
From: James Liu [mailto:[EMAIL PROTECTED]
Sent: 17 May 2001 15:01
To: [EMAIL PROTECTED]
Subject: validating with schema

Hi,

I'm trying to validate the example xml file personal-schema.xml, but it seems the SAXparser doesn't know the schema,
when I set the validation to true, it always reports the elements in the xml are not defined. Do I have to set something

special for the schema? anybody knows why?

BTW, the parser works with the DTD.

thanks in advance.

James

Reply via email to