c# - 如何从 xml 引用 xsd 文件

标签 c# xml xsd

1) pls.xsd 文件

我在同一文件夹的 xml.xsd 中包含了 pls.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>

我有以上两个代码,这些代码在我的 XML 和我的 pls.xsd 文件中都出现了错误, 打开外部“DTD”时发生错误

我正在使用“Visual Studio 2010”。

如何解决这个问题?

最佳答案

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

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

关于c# - 如何从 xml 引用 xsd 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21657347/

相关文章:

c# - 如何使用 PostSharp 实现延迟加载?

.net - 如何在 .NET App.Config 文件中存储 XML 值

java - 无法解析 org.xml.sax.SAXParseException : cvc-elt. 1:找不到元素 'soapenv:Envelope' 的声明

java - 我如何在 jaxb 中解码并在不使用显式模式文件的情况下享受模式验证

xml - cvc-complex-type.2.3 : Element 'group' cannot have character [children], 因为类型的内容类型是仅元素

c# - 在单个解决方案中处理多个项目中的公共(public)类

c# - #if(DEBUG) 和 log4net 行号源/运行时不匹配

c# - bobj 未在 VS 2010 中定义

java - cxf-xjc 插件 "Must specify xsdOptions"错误

xml - xslt 向 xml 根节点添加属性