我对这种价值有疑问。
我使用 WebServices 类,我不能修改,它们是这样的..
Public ClientReference As String
Public Passenger1_Salutation As String
Public Passenger1_FamilyName As String
Public Passenger1_FirstName As String
Public Passenger1_PassengerType As String
Public Passenger1_PassengerAge As Integer
Public Passenger2_Salutation As String
Public Passenger2_FamilyName As String
Public Passenger2_FirstName As String
Public Passenger2_PassengerType As String
Public Passenger2_PassengerAge As Integer
并遵循直到Passenger12
(具有他的五个属性)
如果我只使用两个 passsengers 发送,默认情况下字符串值为空(没有 xml 标签),但如果它没有值,则打印一个整数值,打印一个 0,这对我来说是一个值。而且我不希望一个值为空或 0 的值不创建任何标签。
我的班级创造了这个..
<ClientReference>9124983</ClientReference>
<Passenger1_Salutation>MR/S</Passenger1_Salutation>
<Passenger1_FamilyName>TestAp11</Passenger1_FamilyName>
<Passenger1_FirstName>Test11</Passenger1_FirstName>
<Passenger1_PassengerType>AD</Passenger1_PassengerType>
<Passenger1_PassengerAge>30</Passenger1_PassengerAge>
<Passenger2_Salutation>MR/S</Passenger2_Salutation>
<Passenger2_FamilyName>TestAp12</Passenger2_FamilyName>
<Passenger2_FirstName>Test12</Passenger2_FirstName>
<Passenger2_PassengerType>CH</Passenger2_PassengerType>
<Passenger2_PassengerAge>10</Passenger2_PassengerAge>
<Passenger3_PassengerAge>0</Passenger3_PassengerAge>
<Passenger4_PassengerAge>0</Passenger4_PassengerAge>
<Passenger5_PassengerAge>0</Passenger5_PassengerAge>
<Passenger6_PassengerAge>0</Passenger6_PassengerAge>
<Passenger7_PassengerAge>0</Passenger7_PassengerAge>
<Passenger8_PassengerAge>0</Passenger8_PassengerAge>
<Passenger9_PassengerAge>0</Passenger9_PassengerAge>
<Passenger10_PassengerAge>0</Passenger10_PassengerAge>
<Passenger11_PassengerAge>0</Passenger11_PassengerAge>
<Passenger12_PassengerAge>0</Passenger12_PassengerAge>
但我需要知道如何才能不将整数属性实例化为 xml 应该是这样的(不修改类,我可以将此属性作为字符串,但不能修改)
<ClientReference>9124983</ClientReference>
<Passenger1_Salutation>MR/S</Passenger1_Salutation>
<Passenger1_FamilyName>TestAp11</Passenger1_FamilyName>
<Passenger1_FirstName>Test11</Passenger1_FirstName>
<Passenger1_PassengerType>AD</Passenger1_PassengerType>
<Passenger1_PassengerAge>30</Passenger1_PassengerAge>
<Passenger2_Salutation>MR/S</Passenger2_Salutation>
<Passenger2_FamilyName>TestAp12</Passenger2_FamilyName>
<Passenger2_FirstName>Test12</Passenger2_FirstName>
<Passenger2_PassengerType>CH</Passenger2_PassengerType>
有人可以帮助我吗?