XML 验证:“没有可用于验证根的匹配全局声明"错误 [英] XML validation: 'No matching global declaration available for the validation root' error

查看:29
本文介绍了XML 验证:“没有可用于验证根的匹配全局声明"错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我验证以下 xml 时:

When I validate the following xml:

<?xml version="1.0" encoding="UTF-8"?>
<AvailRateUpdateRQ xmlns="http://www.expediaconnect.com/EQC/AR/2011/06"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
  xsi:schemaLocation="http://www.expediaconnect.com/EQC/AR/2011/06  ./XSD/AvailRateUpdateRQ.xsd">
  <Authentication username="user" password="ECLPASS"/>
  <Hotel id="111"/>
  <AvailRateUpdate>
    <DateRange from="2012-04-05" to="2012-04-07"/>
    <RoomType id="01">
      <Inventory totalInventoryAvailable="10"/>
      <RatePlan id="52ASD">
        <Rate currency="EUR">
          <PerDay rate="185.00"/>
        </Rate>
        <Restrictions minLOS="2" maxLOS="3" closedToArrival="true"/>
      </RatePlan>
    </RoomType>
  </AvailRateUpdate>
</AvailRateUpdateRQ>

使用此架构:

<?xml version="1.0" encoding="UTF-8"?>
<!-- Copyright 2011 Expedia, Inc. All Rights Reserved -->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" 
  xmlns="http://www.expediaconnect.com/EQC/AR/2011/06" 
  targetNamespace="http://www.expediaconnect.com/EQC/AR/2011/06" 
  elementFormDefault="qualified" 
  attributeFormDefault="unqualified" 
  version="2.0.0">

  <xs:element name="AvailRateUpdateRQ">
      <xs:complexType>
         <!-- Definitions of some other element there -->
      </xs:complexType>
  </xs:element>

我收到此错误:

错误:1845 元素AvailRateUpdateRQ":没有可用于验证根的匹配全局声明.

Error: 1845 Element 'AvailRateUpdateRQ': No matching global declaration available for the validation root.

推荐答案

真的很有趣.

$dom->loadXML($dom->saveXML) - 这是帮助我解决问题的代码的一部分.

$dom->loadXML($dom->saveXML) - this a part of code which help me in my problem.

这篇关于XML 验证:“没有可用于验证根的匹配全局声明"错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆