如何从 XML 引用 XSD 文件



1) pls.xsd文件

我已将pls.xsd包含在同一个文件夹中的xml.xsd

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<!-- Externals changed by QTAssistant (http://www.paschidev.com) -->
<!--
  This is a draft schema for the XML language defined in the 
  Pronunciation Lexicon Specification 
  (latest version at <http://www.w3.org/TR/pronunciation-lexicon/>)
  At the time of writing, the specification as well as this schema are
  subject to change, and no guarantee is made on their accuracy or the fact
  that they are in sync.
  Last modified: $Date: 2007/12/11 12:08:40 $
  Copyright û 2006 World Wide Web Consortium, (Massachusetts Institute
  of Technology, ERCIM, Keio University). All Rights Reserved. See
    http://www.w3.org/Consortium/Legal/.
-->
<xs:schema
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:p="http://www.w3.org/2005/01/pronunciation-lexicon"
targetNamespace="http://www.w3.org/2005/01/pronunciation-lexicon"
elementFormDefault="qualified" version="1.0">
<xs:annotation>
    <xs:documentation>Importing dependent namespaces</xs:documentation>
</xs:annotation>
<xs:import namespace="http://www.w3.org/XML/1998/namespace" schemaLocation="xml.xsd" />
 ...
</xs:schema>

2)我的 XML 文件从这个文件中,我引用了pls.xsd

<?xml version="1.0" encoding="utf-8"?> 
<lexicon version="1.0"
xmlns="http://www.w3.org/2005/01/pronunciation-lexicon"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.w3.org/2005/01/pronunciation-lexicon
file://C:/xsdforproject/pls.xsd" 
alphabet="x-microsoft-ups" xml:lang="en-IN">
    <lexeme>
    </lexeme>
</lexicon>

我有上述两个代码,这些代码在我的XMLpls.xsd文件中都给我带来了错误,打开外部"DTD"file:///C:/xsdforproject/XMLSchema.dtd': Could not find file 'C:xsdforprojectXMLSchema.dtd时出错

我正在使用"Visual Studio 2010"。

如何解决此问题?

您正在使用的内容似乎引用了XMLSchema.dtd,那么您是否尝试过下载它并将其放在xsdforproject文件夹中?

http://www.w3.org/2009/XMLSchema/XMLSchema.dtd

最新更新