Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
457 views
in Technique[技术] by (71.8m points)

xsd - 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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...