Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/xml/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 如何适当地包括schemalocation以引用xml中的xsd文件_C#_Xml_Xsd - Fatal编程技术网

C# 如何适当地包括schemalocation以引用xml中的xsd文件

C# 如何适当地包括schemalocation以引用xml中的xsd文件,c#,xml,xsd,C#,Xml,Xsd,我正在构建一个用于语音识别的xml语法文件,因此我创建了一个词典文件,并添加了词典元素,如下所示,模式位置给出了错误 文档中从此位置引用的架构包含错误 操作已超时 粗体线导致错误 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/pron

我正在构建一个用于语音识别的xml语法文件,因此我创建了一个词典文件,并添加了词典元素,如下所示,模式位置给出了错误

  • 文档中从此位置引用的架构包含错误
  • 操作已超时
  • 粗体线导致错误

    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
    **http://www.w3.org/TR/2007/CR-pronunciation-lexicon-20071212/pls.xsd"**
    alphabet="x-microsoft-ups" xml:lang="en-IN"
    

    我该怎么办?

    您所指向的架构是有效的。问题是,W3C网站上承载的模式有时会受到限制;在您的例子中更是如此,因为pls.xsd引用了xml.xsd(这一个肯定是限制的)

    W3C限制对众所周知的XSD的响应,作为保护自身免受不必要流量影响的手段

    下载您的本地副本并引用它们,一切都应该很好(假设其他一切都适合您)

    根据您的评论,XML文件应该是这样的:

    <?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:/some/folder/where/your/xsd/file/is/pls.xsd" 
        alphabet="x-microsoft-ups" xml:lang="en-IN">
        <lexeme>
    
        </lexeme>
    </lexicon>
    
    
    
    这就是pls.xsd顶部的样子(在更改xml.xsd的模式位置后,假设它们位于同一文件夹中):

    
    导入依赖名称空间
    ...
    

    在VS2010及更高版本中一切正常。

    谢谢您,先生……在您更改xml(如图所示)后,会导致错误,即在打开外部DTD时发生错误file:///C:/xsdforproject/XMLSchema.dtd“:找不到文件“C:\xsdforproject\XMLSchema.dtd您正在使用什么工具?”?我们正在讨论的XSD文件没有引用您正在引用的DTD。。。你的问题很可能是不同性质的。是的,我知道我也对dtd错误感到困惑…我正在处理VS2010你有一些不相关的问题。。。我已经尝试了VS2010中发布的文件,一切都很好(智能感知、验证等)。你必须去别处看看,理想的情况是尝试某种复制,然后发布一个不同的问题……先生,我的c代码有什么问题吗?我的意思是,这个问题与编码有关吗?
    <?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 &#251; 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>