首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >我需要从xsd文件创建php类不能通过xsd2php创建

我需要从xsd文件创建php类不能通过xsd2php创建
EN

Stack Overflow用户
提问于 2020-09-27 13:47:20
回答 1查看 118关注 0票数 0

XSD文件: xsd2php显示如下错误- PHP致命错误:未捕获错误:未在/var/www/html/xsd2php- 'Symfony\Component\DependencyInjection\ContainerBuilder‘/bin/xsd2php中找到类主机:19

代码语言:javascript
运行
复制
<xs:schema xmlns="http://www.opentravel.org/OTA/2003/05" xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.opentravel.org/OTA/2003/05" elementFormDefault="qualified" version="4.001" id="OTA2008B">
 <xs:include schemaLocation="OTA_HotelReservation.xsd"/>
 <xs:annotation>
  <xs:documentation xml:lang="en">All Schema files in the OTA specification are made available according to the terms defined by the OTA License Agreement at http://www.opentravel.org/Specifications/Default.aspx</xs:documentation>
 </xs:annotation>
 <xs:element name="OTA_HotelResNotifRQ">
  <xs:annotation>
   <xs:documentation xml:lang="en">Hotel Reservation Notif Request supports the functionality of updating other systems with reservation data. The message assumes a push model, with the originating system pushing the data to another system.  The originating system would usually be a booking source, such as a Global Distribution System (GDS), a Central Reservation System (CRS) or some other agent of the hotel.</xs:documentation>
  </xs:annotation>
  <xs:complexType>
   <xs:sequence>
    <xs:element name="POS" type="POS_Type" minOccurs="0">
     <xs:annotation>
      <xs:documentation xml:lang="en">The point-of-sale data, contained in the element, communicates the information that allows the receiving system to identify the trading partner that is sending the request or the response message.  </xs:documentation>
     </xs:annotation>
    </xs:element>
    <xs:element name="MessageID" type="UniqueID_Type" minOccurs="0">
     <xs:annotation>
      <xs:documentation xml:lang="en">This represents a batch ID.</xs:documentation>
     </xs:annotation>
    </xs:element>
    <xs:element name="HotelReservations" type="HotelReservationsType" minOccurs="0"/>
   </xs:sequence>
   <xs:attributeGroup ref="OTA_PayloadStdAttributes"/>
   <xs:attribute name="ResStatus" type="TransactionActionType" use="optional"/>
   <xs:attribute name="HoldDuration" type="xs:duration" use="optional">
    <xs:annotation>
     <xs:documentation xml:lang="en">The time until a hold is released.</xs:documentation>
    </xs:annotation>
   </xs:attribute>
  </xs:complexType>
 </xs:element>
</xs:schema>
EN

回答 1

Stack Overflow用户

发布于 2020-12-25 17:37:06

我只是在文件的开头添加了这一行

代码语言:javascript
运行
复制
The result in the file

```javascript

/**

由XSD2PHPPHP版本5.3@category Util@package XSD2PHP@作者Ariel Garciaags@leirags.com@license GNU GPL - http://www.gnu.org/licenses/gpl.txt@link https://github.com/davidgillen/XSD2PHP生成

*/

/**

表示许可的类XSD2PHP@包XSD2PHP@作者Ariel Garciaags@leirags.com@license GNU GPL -http://www.gnu.org/licenses/gpl.txt@ OTA_HotelResNotifRQ@category https://github.com/davidgillen/XSD2PHP

*/

OTA_HotelResNotifRQ类

{

公共$POS;

公共$MessageID;

公共$HotelReservations;

代码语言:javascript
运行
复制
/**
代码语言:javascript
运行
复制
 * OTA_HotelResNotifRQ constructor
 *
 * @param POS_Type              $POS               {0, 1} Optional The point-of-sale data, contained in the element, communicates the information that allows the receiving system to identify the trading partner that is sending the request or the response message.
 * @param UniqueID_Type         $MessageID         {0, 1} Optional This represents a batch ID.
 * @param HotelReservationsType $HotelReservations {0, 1} Optional
 */
public function __construct($POS = null, $MessageID = null, $HotelReservations = null)
{
    if ( $POS == null ) {
        // Do nothing, $minOccurs is 0
    } else {
        if ( get_class($POS) != 'POS_Type' ) {
            throw new Exception('$POS must be of type POS_Type.');
        }
        $this->POS = $POS;
代码语言:javascript
运行
复制
    }
代码语言:javascript
运行
复制
    if ( $MessageID == null ) {
代码语言:javascript
运行
复制
        // Do nothing, $minOccurs is 0
代码语言:javascript
运行
复制
    } else {
代码语言:javascript
运行
复制
        if ( get_class($MessageID) != 'UniqueID_Type' ) {
代码语言:javascript
运行
复制
            throw new Exception('$MessageID must be of type UniqueID_Type.');
代码语言:javascript
运行
复制
        }
代码语言:javascript
运行
复制
        $this->MessageID = $MessageID;
代码语言:javascript
运行
复制
    }
代码语言:javascript
运行
复制
    if ( $HotelReservations == null ) {
代码语言:javascript
运行
复制
        // Do nothing, $minOccurs is 0
代码语言:javascript
运行
复制
    } else {
代码语言:javascript
运行
复制
        if ( get_class($HotelReservations) != 'HotelReservationsType' ) {
代码语言:javascript
运行
复制
            throw new Exception('$HotelReservations must be of type HotelReservationsType.');
代码语言:javascript
运行
复制
        }
代码语言:javascript
运行
复制
        $this->HotelReservations = $HotelReservations;
代码语言:javascript
运行
复制
    }
代码语言:javascript
运行
复制
}

}

代码语言:javascript
运行
复制

我希望对你有用。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/64085235

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档