如何解决如何从 xsd 中的 xml 定义 xmlns:ns2
我正在尝试从 XML 文件创建 XSD。 来自 xml 的根元素的命名空间为
<Poslog xmlns="http://www.nrf-arts.org/IXRetail/namespace/">
现在子元素之一出现
<SequenceNumber xmlns:ns2="http://www.nrf-arts.org/IXRetail/namespace/" xmlns="">1</SequenceNumber>
当我使用 XSD 文件验证 XML 时,它无法识别 SequenceNumber 元素。 我的 XSD 有以下定义
<xs:schema xmlns:tns="http://www.nrf-arts.org/IXRetail/namespace/" elementFormDefault="qualified" targetNamespace="http://www.nrf-arts.org/IXRetail/namespace/" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:import />
我该如何解决这个问题?无法修改 XML,因为我是接收文件的下游应用程序。
编辑:添加我试图解析的 xml。我有几个其他示例文件。目标是基于示例 xml 创建一个 xsd。 xsd 将用于在注入之前验证 xml。
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Poslog xmlns="http://www.nrf-arts.org/IXRetail/namespace/">
<Transaction TrainingModeFlag="false" TypeCode="RETAIL_AUTH">
<WorkstationID>25</WorkstationID>
<SequenceNumber>1</SequenceNumber>
<TransactionID>CA00001055</TransactionID>
<OperatorID AssociateID="3333"/>
<CurrencyCode>CAD</CurrencyCode>
<ReceiptDateTime TypeCode="refundExpiry">2021-08-28T21:32:55.000Z</ReceiptDateTime>
<CustomerOrderTransaction OrderChannel="IN_STORE" TypeCode="Transaction" TransactionStatus="RETAIL_AUTH" CartID="CA00001055">
<LineItem>
<Sale ProductClass="Merchandise" FulfillmentType="IN_STORE" OrderItemID="2">
<Associate>
<AssociateID AssociateID="3333" OperatorType="SalesAssociateID"/>
</Associate>
<Tax TaxClass="BPTX" LineItemTotalTax="true">
<TaxableAmount/>
<Amount>52.00</Amount>
</Tax>
<Tax TaxType="STATE" TaxCode="CA-STATE-ON-ANY" TaxName="HST" TaxClass="BPTX" LineItemTotalTax="false">
<TaxableAmount/>
<Amount>52.00</Amount>
<Percent>13</Percent>
<TaxPerUnitAmount>26.00</TaxPerUnitAmount>
</Tax>
<Item>
<ItemID Name="copper Amino Isolate Serum 5.00%">copper-amino-isolate-serum-5pct-15ml</ItemID>
<POSIdentity POSIDType="GTIN">
<POSItemID>769915150070</POSItemID>
</POSIdentity>
<RegularsalesUnitPrice>200.00</RegularsalesUnitPrice>
<ActualSalesUnitPrice>200.00</ActualSalesUnitPrice>
<Extendedamount>400.00</Extendedamount>
<discountAmount/>
<Quantity>2</Quantity>
</Item>
</Sale>
<SequenceNumber xmlns:ns2="http://www.nrf-arts.org/IXRetail/namespace/" xmlns="">1</SequenceNumber>
</LineItem>
<LineItem>
<Sale ProductClass="Merchandise" FulfillmentType="IN_STORE" OrderItemID="1">
<Associate>
<AssociateID AssociateID="3333" OperatorType="SalesAssociateID"/>
</Associate>
<Tax TaxClass="BPTX" LineItemTotalTax="true">
<TaxableAmount/>
<Amount>6.24</Amount>
</Tax>
<Tax TaxType="STATE" TaxCode="CA-STATE-ON-ANY" TaxName="HST" TaxClass="BPTX" LineItemTotalTax="false">
<TaxableAmount/>
<Amount>6.24</Amount>
<Percent>13</Percent>
<TaxPerUnitAmount>2.08</TaxPerUnitAmount>
</Tax>
<Item>
<ItemID Name="Pore Delete">finisher-poredelete-30ml</ItemID>
<POSIdentity POSIDType="GTIN">
<POSItemID>769915130393</POSItemID>
</POSIdentity>
<RegularsalesUnitPrice>16.00</RegularsalesUnitPrice>
<ActualSalesUnitPrice>16.00</ActualSalesUnitPrice>
<Extendedamount>48.00</Extendedamount>
<discountAmount/>
<Quantity>3</Quantity>
</Item>
</Sale>
<SequenceNumber xmlns:ns2="http://www.nrf-arts.org/IXRetail/namespace/" xmlns="">2</SequenceNumber>
</LineItem>
<LineItem>
<Tender TenderType="CreditCard">
<Amount>506.24</Amount>
<Authorization>
<ReferenceNumber>853598650372859C</ReferenceNumber>
</Authorization>
<CreditDebit CardType="mc">
<PrimaryAccountNumber Cryptogram="PARTIAL_DATA"/>
</CreditDebit>
</Tender>
<SequenceNumber xmlns:ns2="http://www.nrf-arts.org/IXRetail/namespace/" xmlns="">3</SequenceNumber>
</LineItem>
<LineItem>
<Tax xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ItemTaxType">
<TaxableAmount>448.00</TaxableAmount>
<Amount>58.24</Amount>
</Tax>
<SequenceNumber xmlns:ns2="http://www.nrf-arts.org/IXRetail/namespace/" xmlns="">4</SequenceNumber>
</LineItem>
<Delivery>
<Address Addresstype="Delivery">
<AddressLine></AddressLine>
<AddressLine/>
<City></City>
<Territory TypeCode="STATE"></Territory>
<PostalCode></PostalCode>
<Country></Country>
</Address>
</Delivery>
<Customer AlternateCustomerID="C-0000000039">
<CustomerID>0016s000003ZC2KAAW</CustomerID>
<EMail>
<EMailAddress>shi@deciem.com</EMailAddress>
</EMail>
</Customer>
</CustomerOrderTransaction>
<TillID>3333</TillID>
<BusinessDayDate>2020-08-28Z</BusinessDayDate>
<BeginDateTime>2020-08-28T21:32:55.000Z</BeginDateTime>
<EndDateTime>2020-08-28T21:32:55.000Z</EndDateTime>
</Transaction>
</Poslog>
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。