I am trying to get TenderTyp, TypeCode, AuthorizationCode and then all the info from:

<arts:TenderCreditDebit>
<arts:IssuerIdentificationNumber>999=99</arts:IssuerIdentificationNumber>
<arts:ExpirationDate>1970-01</arts:ExpirationDate>
<arts:ReconcilliationCode>19</arts:ReconcilliationCode>
<arts:PrimaryAccountNumber>OTk5OTk5KioqKioqMDM1MQ==</arts:PrimaryAccountNumber>
</arts:TenderCreditDebit>

Which is buried in the XML shown below....

I seem to get so close the correct element but just cannot get the correct value!
Could anyone help please?

Thanks

<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<arts:POSLog xmlns:arts="http://www.nrf-arts.org/IXRetail/namespace/" xmlns:xsi="http=//www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.nrf-arts.org/IXRetail/namespace/ARTSTransactionFinishedV1.0.0.xsd">
<arts:Transaction MajorVersion="4">
<arts:BusinessUnit>
<arts:UnitID Name="999" TypeCode="STO">999</arts:UnitID>
</arts:BusinessUnit>
<arts:RevenueCenterID>REGULAR</arts:RevenueCenterID>
<arts:WorkstationID>1</arts:WorkstationID>
<arts:SequenceNumber>2</arts:SequenceNumber>
<arts:BusinessDayDate>2010-10-12</arts:BusinessDayDate>
<arts:BeginDateTime>2010-10-12T12:53:54+00:00</arts:BeginDateTime>
<arts:EndDateTime>2010-10-12T12:54:16+00:00</arts:EndDateTime>
<arts:OperatorID OperatorName="TEST">232323</arts:OperatorID>
<arts:CurrencyCode>RUB</arts:CurrencyCode>
<arts:RetailTransaction Version="2.2">
<arts:ItemCount>4</arts:ItemCount>
<arts:ReceiptDateTime>2010-10-12T11:14:22+00:00</arts:ReceiptDateTime>
<arts:LineItem>
<arts:SequenceNumber>1</arts:SequenceNumber>
<arts:Sale>
<arts:POSIdentity>
<arts:POSItemID>20082293</arts:POSItemID>
</arts:POSIdentity>
<arts:ItemID Type="ArticleItemType">20082293</arts:ItemID>
<arts:Description>SOME DESCRIPTION</arts:Description>
<arts:TaxIncludedInPriceFlag>true</arts:TaxIncludedInPriceFlag>
<arts:ExtendedAmount>15.00 </arts:ExtendedAmount>
<arts:RegularSalesUnitPrice>15.00 </arts:RegularSalesUnitPrice>
<arts:Quantity>1.000</arts:Quantity>
<arts:Tax>
<arts:TaxGroupID>A</arts:TaxGroupID>
</arts:Tax>
</arts:Sale>
</arts:LineItem>
<arts:LineItem>
<arts:SequenceNumber>2</arts:SequenceNumber>
<arts:Sale>
<arts:POSIdentity>
<arts:POSItemID>89</arts:POSItemID>
</arts:POSIdentity>
<arts:ItemID Type="ArticleItemType">30000=89</arts:ItemID>
<arts:Description>AN ARTICLE</arts:Description>
<arts:TaxIncludedInPriceFlag>true</arts:TaxIncludedInPriceFlag>
<arts:ExtendedAmount>25.00</arts:ExtendedAmount>
<arts:RegularSalesUnitPrice>25.00</arts:RegularSalesUnitPrice>
<arts:Quantity>1.000</arts:Quantity>
<arts:Tax>
<arts:TaxGroupID>A</arts:TaxGroupID>
</arts:Tax>
</arts:Sale>
</arts:LineItem>
<arts:LineItem>
<arts:SequenceNumber>3</arts:SequenceNumber>
<arts:Tax>
<arts:TaxableAmount>40.00</arts:TaxableAmount>
<arts:Amount>8.00</arts:Amount>
<arts:Percent>20.000 </arts:Percent>
</arts:Tax>
</arts:LineItem>
<arts:LineItem>
<arts:SequenceNumber>4</arts:SequenceNumber>
<arts:Tender TenderType="Visa Credit" TypeCode="Sale">
<arts:Amount>40.00 </arts:Amount>
<arts:Authorization>
<arts:RequestedAmount/>
<arts:AuthorizationCode>000002700</arts:AuthorizationCode>
</arts:Authorization>
<arts:TenderCreditDebit>
<arts:IssuerIdentificationNumber>999=99</arts:IssuerIdentificationNumber>
<arts:ExpirationDate>1970-01</arts:ExpirationDate>
<arts:ReconcilliationCode>19</arts:ReconcilliationCode>
<arts:PrimaryAccountNumber>OTk5OTk5KioqKioqMDM1MQ==</arts:PrimaryAccountNumber>
</arts:TenderCreditDebit>
</arts:Tender>
</arts:LineItem>
<arts:Total TotalType="TransactionGrossAmount">25.00</arts:Total>
</arts:RetailTransaction>
</arts:Transaction>
</arts:POSLog>

Recommended Answers

All 3 Replies

Thanks for that but the code in the tutorial also did not find the "Tender" element after chaning the code for
my XML file....

Back to the drawing board...

You have two TypeCode attributes, so I made an assumption you wanted the TenderType.TypeCode.
Of course, depending on how many total elements and descendents you need, you maght do this a different way, but here is a sample:

Imports System.IO
Imports System.Collections.Generic
Imports System
Imports System.IO
Imports System.Collections.Generic
Imports System.IO
Imports System.Linq
Imports System.Xml.Linq

Module Module1
   Function GetAuthCode(ByVal xd As XDocument) As String
      Return xd.Descendants.ToList() _
      .Where(Function(a) a.Name.LocalName.Equals("AuthorizationCode")) _
      .First()
   End Function

   Function GetTenderType(ByVal xd As XDocument) As String
      Return xd.Descendants.ToList() _
         .Where(Function(s) s.Name.LocalName.Equals("Tender")) _
         .Select(Function(s) s.Attributes("TenderType").First().Value).First()
   End Function

   Function GetTenderTypeCode(ByVal xd As XDocument) As String
      Return xd.Descendants.ToList() _
         .Where(Function(s) s.Name.LocalName.Equals("Tender")) _
         .Select(Function(s) s.Attributes("TypeCode").First().Value).First()
   End Function
   Sub Main()
      Dim xd As XDocument = XDocument.Load("..\../XmlFile.xml")

      Console.WriteLine(GetAuthCode(xd))
      Console.WriteLine(GetTenderType(xd))
      Console.WriteLine(GetTenderTypeCode(xd))
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.