Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hosting W3 XML Schema files locally

I work at a company where we have our own XML language with its own set of schemas that validate against the W3 schema. For business reasons, I need to host these files internally instead of relying on the web hosted versions. I have little experience with XML schemas and am wondering what exactly this means. Is it as simple as copying and pasting the page source into my own file and pointing our other schemas there? Do I need to worry about the namespace documents as well? Any help here is appreciated. Thanks.

like image 302
shinytinsmile Avatar asked Nov 03 '16 14:11

shinytinsmile


People also ask

Where are XSD files stored?

XSD files are stored to disc in plain text file format that is human readable.

What is the difference between XSD and XML?

XSD defines elements and structures that can appear in the document, while XML does not. XSD ensures that the data is properly interpreted, while XML does not. An XSD document is validated as XML, but the opposite may not always be true. XSD is better at catching errors than XML.

How do I document an XML Schema?

To generate documentation for an XML Schema document, select XML Schema Documentation from the Tools > Generate Documentation menu or from the Generate Documentation submenu in the contextual menu of the Project view. You can also open the tool by using the Generate Documentation toolbar button.


1 Answers

To host external XSDs, including any from W3C, locally:

  1. Identify external XSD dependencies.

    You can identify an XSD's external dependencies through the transitive closure of all XSD's given by xs:include and xs:import @schemaLocation attributes. (No xs:include or xs:import implies no dependencies.)

  2. Copy the XSDs locally.

    Note that to actually retrieve xml.xsd, use a tool other than a browser (e.g. wget) or view the source of the file served to your web browser.

  3. Adjust references to the XSDs.

    Update the @schemaLocation attributes to reference the local rather than the remote copy. See How to reference a local XML Schema file correctly? Or, use an XML Catalog to remap to a local location.

Note that you do not need to change any namespace URIs, which are lexical constructs that do not need to be retrievable.

like image 125
kjhughes Avatar answered Oct 04 '22 09:10

kjhughes