xsd as contract, best practice for access (searched)

  • Thread starter thomas.porschberg
  • Start date
T

thomas.porschberg

Hi XML-gurus,

imagine a provider of some information in XML format and
a client who reads this data.
Both sides share a XSD as a contract.
I think this is quite common.

Now the client wants to validate the XML data.
Unfortunatly the provider of the XML data is not able
to offer XSD access at a webserver
(e.g. he wants not afford the maintenance of a webserver)
and he wants also not refer to a XSD location at client side(e.g.
he has much clients with different local XSD locations).

However the offerer of the XML data is willing to refer to
a generic XSD placeholder in the XML which could the client map
to a XSD at a local webserver or to a XSD file at client side.
Is this possible ? If yes, a example/link would be great.

Or is it possible to omit the reference to the XSD entirly and
the client is still possible to validate the XML against a XSD
which is not refered within the XML ?
Again an example would fine.

Best regards,
Thomas
 
G

George Bina

Both cases are possible. If you decide to have the documents refer to a
schema location then you can use an XML catalog to map that schema
location to a local copy of the file. In general it is good to have the
schema available also at that location to allow also the clients that
do not use the catalog to validate the document. For examples see
Xerces XML catalog support:
http://xerces.apache.org/xerces2-j/faq-xcatalogs.html
The second case is also possible, you can ignore what schemas the
document provides and perform a validation against a specified schema.
See
http://xerces.apache.org/xerces2-j/properties.html
the "http://apache.org/xml/properties/schema/external-schemaLocation"
and
"http://apache.org/xml/properties/schema/external-noNamespaceSchemaLocation"
properties and also see
http://xerces.apache.org/xerces2-j/faq-grammars.html

Best Regards,
George
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,020
Latest member
GenesisGai

Latest Threads

Top