[xsd-users] Q: schemaLocation in schema file

Boris Kolpackov boris at codesynthesis.com
Thu Feb 13 22:10:08 EST 2014


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