Title: validating with schema
yes, if I declared that attribute in the dtd, it does get parsed. BUT, actually that attribute is used by XML Schema to
specify where the schema file is, so it's not supposed to be declared by dtd author(I think). And when I declared it,
the xml was parsed OK but it seemed the xml is not validated against the schema (personal.xsd).
 
it looks like the parser doesn't know XML Schema. but xml.apache.org says it support XML schema.
 
the xml file, dtd file and schema file I used come with the Xerces 1.3.1 distribution.
 
thanks,
 
James
-----Original Message-----
From: Sebastien Marechal [mailto:[EMAIL PROTECTED]
Sent: Friday, May 18, 2001 10:47 AM
To: '[EMAIL PROTECTED]'
Subject: RE: 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