Hosting W3 XML Schema files locally

冷暖自知 提交于 2019-12-28 07:02:41

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/40403580/hosting-w3-xml-schema-files-locally

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!