[xsd-users] Q: schemaLocation in schema file

Rangarajan, Ravi_Sowmian raviraja at qti.qualcomm.com
Fri Feb 14 01:23:54 EST 2014


Hi Boris,
Excellent analysis and behavior of the parser was very well explained. Now options are quite clear to me.
Thanks so much
Ravi

-----Original Message-----
From: Boris Kolpackov [mailto:boris at codesynthesis.com] 
Sent: Thursday, February 13, 2014 7:10 PM
To: Rangarajan, Ravi_Sowmian
Cc: xsd-users at codesynthesis.com
Subject: Re: [xsd-users] Q: schemaLocation in schema file

Hi Ravi,

Rangarajan, Ravi_Sowmian <raviraja at qti.qualcomm.com> writes:

> Earler, with just don't_initialize directive, we got the same error as 
> you (library.xml:13:65 error: schemaLocation does not contain 
> namespace location pairs) even though we were overriding 
> schemaLocation as shown below.

Overriding schemaLocation doesn't help in this case since the parser still validates (and then ignores) this attribute's content which should be a sequence of namespace/path pairs. To put it another way, according to the XML Schema spec, the document that contains mal- formed schemaLocation attribute is invalid.


> After adding don't_validate in addition to don't_initialize, now 
> parser doesn't throw exception and is able to proceed. I do think 
> doing validation is a good thing, but for an optional param like 
> schemaLocation per 3GPP spec, skipping validation shouldn't be too 
> bad?

If you are sure that the documents you will be parsing are valid (except for the schemaLocation attribute as mentioned above), then disabling validation should be ok. The only other approach that I can think of is to pre-process the XML document and remove the schemaLocation attribute altogether.

Boris



More information about the xsd-users mailing list