简体   繁体   English

cvc-elt.1:找不到元素“DataModel”的声明

[英]cvc-elt.1: Cannot find the declaration of element 'DataModel'

What is wrong with my XML?我的 XML 有什么问题?

I am trying to import a metric family into PM, and it gives me the following error:我正在尝试将公制系列导入 PM,但出现以下错误:

cvc-elt.1: Cannot find the declaration of element 'DataModel' cvc-elt.1:找不到元素“DataModel”的声明

<?xml version="1.0" encoding="UTF-8"?>
<!--Auto-generated by the type catalog local manager.-->
<DataModel xmlns="http://im.ca.com/normalizer" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://im.ca.com/normalizer IMDBCertificationFacet.xsd">
  <Author>JMEDRAN</Author>
  <Version>1.0</Version>
  <FacetType name="NormalizedUPSInfoEltek" descriptorClass="com.ca.im.core.datamodel.certs.NormalizedFacetDescriptorImpl">
    <Documentation>Defines the identification information and polled metrics for UPS-Eltek-S</Documentation>
    <FacetOf namespace="http://im.ca.com/core" name="Item" />
</DataModel>

To place DataModel into the http://im.ca.com/normalizer namespace, rather thanDataModel放入http://im.ca.com/normalizer命名空间,而不是

namespace="http://im.ca.com/normalizer" 

use

xmlns="http://im.ca.com/normalizer" 

and change和改变

xsi:noNamespaceSchemaLocation="IMDBCertificationFacet.xsd"

to

xsi:schemaLocation="http://im.ca.com/normalizer IMDBCertificationFacet.xsd"

Still having problems?仍然有问题?

See these two references for how to specify the location of your XSD:有关如何指定 XSD 位置的信息,请参阅以下两个参考资料:

See this reference to understand how XML and XSD namespace-related attributes work together:请参阅此参考资料以了解 XML 和 XSD 命名空间相关属性如何协同工作:


Update after OP added full XML to question OP 将完整的 XML 添加到问题后更新

It appears that your XML has a namespace model that's being managed by the XML application, thus the namespace="http://im.ca.com/normalizer" attributes.看起来您的 XML 有一个由 XML 应用程序管理的命名空间模型,因此namespace="http://im.ca.com/normalizer"属性。 Given that, the above advice to use xmlns instead may be misguided.鉴于此,上述使用xmlns建议可能会被误导。

Your question may actually be more about the particular XML application that uses the XML than it is about XML validation against an XSD.您的问题实际上可能更多地是关于使用 XML 的特定 XML 应用程序,而不是关于针对 XSD 的 XML 验证。 If you feel that you simply wish to validate the XML against an XSD, please post a MCVE that includes a minimal XML instance and a minimal XSD to receive specific further guidance, or see the general XML validation reference links provided above.如果您觉得您只是希望针对 XSD 验证 XML,请发布包含最小 XML 实例和最小 XSD 的 MCVE 以接收具体的进一步指导,或查看上面提供的一般 XML 验证参考链接。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM