ruby-on-rails - 如何在 XML 中定义多次出现
问题描述
我正在尝试将 FedEx 集成到我的应用程序中。在一个模块中,我必须将一个元素定义为多次出现。请检查下面的图片
我需要如何定义 EVENTS 元素?我尝试了以下方法
1
<ON_DELIVER type="EVENTS"/>
2
<EVENTS>ON_DELIVER</EVENTS>
3
<EVENTS>[ON_DELIVER]</EVENTS>
4
<EVENTS>
<ON_DELIVER>TRUE</ON_DELIVER>
</EVENTS>
我得到以下错误Element 'Events' is a simple type, so it must have no element information item [children]
我想知道如何用这 5 个值定义 EVENTS 元素。
解决方案
下面的 XML 应该可以帮助您设置多个通知。一份给客户,一份给您的客户服务团队
<SpecialServicesRequested>
<SpecialServiceTypes>EVENT_NOTIFICATION</SpecialServiceTypes>
<EventNotificationDetail>
<AggregationType>PER_SHIPMENT</AggregationType>
<PersonalMessage>This is a notification sent by Fedex, for your order: XXXX-XXXX</PersonalMessage>
<EventNotifications>
<Role>RECIPIENT</Role>
<Events>ON_SHIPMENT</Events>
<Events>ON_EXCEPTION</Events>
<Events>ON_ESTIMATED_DELIVERY</Events>
<Events>ON_DELIVERY</Events>
<NotificationDetail>
<NotificationType>EMAIL</NotificationType>
<EmailDetail>
<EmailAddress>XXXX@hotmail.com</EmailAddress>
<Name>Claire Pounder</Name>
</EmailDetail>
<Localization>
<LanguageCode>EN</LanguageCode>
</Localization>
</NotificationDetail>
<FormatSpecification>
<Type>HTML</Type>
</FormatSpecification>
</EventNotifications>
<EventNotifications>
<Role>SHIPPER</Role>
<Events>ON_SHIPMENT</Events>
<Events>ON_EXCEPTION</Events>
<Events>ON_ESTIMATED_DELIVERY</Events>
<Events>ON_DELIVERY</Events>
<NotificationDetail>
<NotificationType>EMAIL</NotificationType>
<EmailDetail>
<EmailAddress>XXXX@YOUREMAIL.com</EmailAddress>
<Name>MANAGER Email</Name>
</EmailDetail>
<Localization>
<LanguageCode>EN</LanguageCode>
</Localization>
</NotificationDetail>
<FormatSpecification>
<Type>HTML</Type>
</FormatSpecification>
</EventNotifications>
</EventNotificationDetail>
</SpecialServicesRequested>
推荐阅读
- python - 通过连接来自 n 个相邻行的字符串值来折叠 DataFrame
- matlab - MATLAB 单个图中的多个箱形图
- php - 将输入从“GET”发送到php中的xml文件
- c++ - 如何设置(而不是构建)PortAudio?
- hibernate - 使用 JPA EntityManager 时,实体的数据库持久化很慢
- python - 通过下拉菜单搜索并通过文本选择元素
- swift - 添加两个 UILabel 的值
- vim - Proxmox/NoVNC 防止/重新映射 ESCAPE 键
- json - wget递归下载问题
- postgresql - 如何根据多个数据库表获取用户访问的国家/地区列表?