Progress OpenEdge XML 可选子节点
我需要有关如何使用 write-xml 编写以下 XML 的建议? 这可能吗?谢谢
注意最后一个材质节点有不同的元素。在编写输出时如何使元素可选和“显示/不显示”?
def temp-table ttMaterials no-undo serialize-name "Materials"
field MatsID as int serialize-hidden.
def temp-table ttMaterial no-undo serialize-name "Material"
field MatsID as int serialize-hidden
field MaterialNumber as char
field PalletNumber as char
field Quantity as char
field UnitOfMeasure as char
field StorageLocation as char
field OperationCode as char
field ReasonCode as char
field CancellationFlag as char
field ItemNo as char.
def dataset dsMaterial xml-node-name "ns1:Message" for
ttMaterials, ttMaterial.
data-relation Rel1 for ttMaterials, ttMaterial nested relation-fields(MatsID, MatsID).
<?xml version="1.0"?>
<ns1:Message xmlns:ns1="http://google.envelope">
<Materials>
<Material>
<MaterialNumber>00111</MaterialNumber>
<PalletNumber>1888845001</PalletNumber>
<Quantity>91.0000000000</Quantity>
<UnitOfMeasure>PAC</UnitOfMeasure>
<StorageLocation>700</StorageLocation>
<OperationCode>101</OperationCode>
<ReasonCode/>
<CancellationFlag>false</CancellationFlag>
<ItemNo>10</ItemNo>
</Material>
<Material>
<MaterialNumber>00112</MaterialNumber>
<PalletNumber>45828760</PalletNumber>
<Quantity>58.3100000000</Quantity>
<UnitOfMeasure>PAC</UnitOfMeasure>
<StorageLocation>700</StorageLocation>
<OperationCode>543</OperationCode>
<ReasonCode/>
<CancellationFlag>false</CancellationFlag>
<ItemNo>10</ItemNo>
</Material>
<Material>
<FromMaterialNumber>000000000000063299</FromMaterialNumber>
<ToMaterialNumber>000000000000063299</ToMaterialNumber>
<FromPalletNumber>81592826</FromPalletNumber>
<ToPalletNumber>81592826</ToPalletNumber>
<Quantity>8</Quantity>
<UnitOfMeasure>PAC</UnitOfMeasure>
<FromStorageLocation>300</FromStorageLocation>
<ToStorageLocation>300</ToStorageLocation>
<OperationCode>551</OperationCode>
<ReasonCode>12</ReasonCode>
<CancellationFlag>false</CancellationFlag>
</Material>
</Materials>
</ns1:Message>
I need a suggestion on how to write the following XML using write-xml?
is this possible? thank you
Notice the last material node has a different elements. How can I made elements optional and "show/notShow" when writing the output?
def temp-table ttMaterials no-undo serialize-name "Materials"
field MatsID as int serialize-hidden.
def temp-table ttMaterial no-undo serialize-name "Material"
field MatsID as int serialize-hidden
field MaterialNumber as char
field PalletNumber as char
field Quantity as char
field UnitOfMeasure as char
field StorageLocation as char
field OperationCode as char
field ReasonCode as char
field CancellationFlag as char
field ItemNo as char.
def dataset dsMaterial xml-node-name "ns1:Message" for
ttMaterials, ttMaterial.
data-relation Rel1 for ttMaterials, ttMaterial nested relation-fields(MatsID, MatsID).
<?xml version="1.0"?>
<ns1:Message xmlns:ns1="http://google.envelope">
<Materials>
<Material>
<MaterialNumber>00111</MaterialNumber>
<PalletNumber>1888845001</PalletNumber>
<Quantity>91.0000000000</Quantity>
<UnitOfMeasure>PAC</UnitOfMeasure>
<StorageLocation>700</StorageLocation>
<OperationCode>101</OperationCode>
<ReasonCode/>
<CancellationFlag>false</CancellationFlag>
<ItemNo>10</ItemNo>
</Material>
<Material>
<MaterialNumber>00112</MaterialNumber>
<PalletNumber>45828760</PalletNumber>
<Quantity>58.3100000000</Quantity>
<UnitOfMeasure>PAC</UnitOfMeasure>
<StorageLocation>700</StorageLocation>
<OperationCode>543</OperationCode>
<ReasonCode/>
<CancellationFlag>false</CancellationFlag>
<ItemNo>10</ItemNo>
</Material>
<Material>
<FromMaterialNumber>000000000000063299</FromMaterialNumber>
<ToMaterialNumber>000000000000063299</ToMaterialNumber>
<FromPalletNumber>81592826</FromPalletNumber>
<ToPalletNumber>81592826</ToPalletNumber>
<Quantity>8</Quantity>
<UnitOfMeasure>PAC</UnitOfMeasure>
<FromStorageLocation>300</FromStorageLocation>
<ToStorageLocation>300</ToStorageLocation>
<OperationCode>551</OperationCode>
<ReasonCode>12</ReasonCode>
<CancellationFlag>false</CancellationFlag>
</Material>
</Materials>
</ns1:Message>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用 write-xml 方法并确保此对于您需要隐藏的数据来说是正确的。
You can make use of parameter 9 (
omit-initial-values
) of the write-xml method and ensure that this is true for the data you need to hide.