When I parse in an XML file it is only grabbing the first and last item.
This is the code in my app
And THIS is the output being logged.
As you can see is only parsing in the ID and the ErrDisc.
This is the XML file I am parsing.
This exact same code works fine in B4A so I am assuming I am missing something that is different in B4I.
This is the code in my app
B4X:
Sub Parser_EndElement (Uri As String, Name As String, Text As StringBuilder)
Dim txt1 As String
Dim RowCount As Int
If parser.Parents.IndexOf("CodeUpdate") > -1 Then
If Name = "Version" Then
Version = Text.ToString
Else If Name = "ID" Then
ID = Text.ToString
Else If Name = "DisAdvantage" Then
DisAdvantage = Text.ToString
Else If Name = "DisE500" Then
DisE500 = Text.ToString
Else If Name = "DisE300" Then
DisE300 = Text.ToString
Else If Name = "DisE700" Then
DisE700 = Text.ToString
Else If Name = "Tokheim" Then
Tokheim = Text.ToString
Else If Name = "Wayne" Then
Wayne = Text.ToString
Else If Name = "ServiceCode" Then
ServiceCode = Text.ToString
Else If Name = "ErrDisc" Then
ErrDisc = Text.ToString
RowCount = sql1.ExecQuerySingleResult ("Select count(*) FROM " & DBTableName1 & ";")
ID =RowCount +1
If thisVer < Version Then
txt1 = "REPLACE INTO " & DBTableName1
txt1 = txt1 & " (ID, DisAdvantage, DisE500, DisE300, DisE700, Tokheim, Wayne, ServiceCode, ErrDisc)"
txt1 = txt1 & " VALUES ('"
txt1 = txt1 & ID & "','"
txt1 = txt1 & DisAdvantage & "','"
txt1 = txt1 & DisE500 & "','"
txt1 = txt1 & DisE300 & "','"
txt1 = txt1 & DisE700 & "','"
txt1 = txt1 & Tokheim & "','"
txt1 = txt1 & Wayne & "','"
txt1 = txt1 & ServiceCode & "','"
txt1 = txt1 & ErrDisc & "')"
Log(txt1)
sql1.ExecNonQuery(txt1)
RowCount = 0
sql1.ExecQuerySingleResult ("PRAGMA user_version = " & Version & ";")
End If
End If
End If
End Sub
And THIS is the output being logged.
As you can see is only parsing in the ID and the ErrDisc.
B4X:
Copying updated assets files (10)
Application_Start
Configuring the default app.
The project's Bundle ID is inconsistent with either the Bundle ID in 'GoogleService-Info.plist', or the Bundle ID in the options if you are using a customized options. To ensure that everything can be configured correctly, you may need to make the Bundle IDs consistent.To continue with this plist file, you may change your app's bundle identifier to 'com.starportaurora.pumpcodespro'. Or you can download a new configuration file that matches your bundle identifier from https://console.firebase.google.com/ and replace the current one.
Application_Active
Select * from Service_Codes WHERE ServiceCode = '' AND DisAdvantage = '1'
[IsInitialized=1, Years=0, Months=0
, Days=530, Hours=22, Minutes=3
, Seconds=55]
going to download upddate
REPLACE INTO Service_Codes (ID, DisAdvantage, DisE500, DisE300, DisE700, Tokheim, Wayne, ServiceCode, ErrDisc) VALUES ('285','','','','','','','','Secure Pulser Lift Off Detection')
REPLACE INTO Service_Codes (ID, DisAdvantage, DisE500, DisE300, DisE700, Tokheim, Wayne, ServiceCode, ErrDisc) VALUES ('286','','','','','','','','Encrypted Pulser: Lid or Cover Removed')
REPLACE INTO Service_Codes (ID, DisAdvantage, DisE500, DisE300, DisE700, Tokheim, Wayne, ServiceCode, ErrDisc) VALUES ('287','','','','','','','','Door Opened')
REPLACE INTO Service_Codes (ID, DisAdvantage, DisE500, DisE300, DisE700, Tokheim, Wayne, ServiceCode, ErrDisc) VALUES ('288','','','','','','','','Door Closed')
REPLACE INTO Service_Codes (ID, DisAdvantage, DisE500, DisE300, DisE700, Tokheim, Wayne, ServiceCode, ErrDisc) VALUES ('289','','','','','','','','Hydraulics Panel Opened')
REPLACE INTO Service_Codes (ID, DisAdvantage, DisE500, DisE300, DisE700, Tokheim, Wayne, ServiceCode, ErrDisc) VALUES ('290','','','','','','','','Hydraulics Panel Closed')
REPLACE INTO Service_Codes (ID, DisAdvantage, DisE500, DisE300, DisE700, Tokheim, Wayne, ServiceCode, ErrDisc) VALUES ('291','','','','','','','','PPU Value Changed')
REPLACE INTO Service_Codes (ID, DisAdvantage, DisE500, DisE300, DisE700, Tokheim, Wayne, ServiceCode, ErrDisc) VALUES ('292','','','','','','','','Totalizer Not Present')
This is the XML file I am parsing.
B4X:
<?xml version="1.0"?>
<CodeUpdate>
<Code>
<Version>5</Version>
<ID>285</ID>
<DisAdvantage>0</DisAdvantage>
<DisE500>1</DisE500>
<DisE300>0</DisE300>
<DisE700>1</DisE700>
<Tokheim>0</Tokheim>
<Wayne>0</Wayne>
<ServiceCode>8046</ServiceCode>
<ErrDisc>Secure Pulser Lift Off Detection</ErrDisc>
</Code>
<Code>
<Version>6</Version>
<ID>286</ID>
<DisAdvantage>0</DisAdvantage>
<DisE500>1</DisE500>
<DisE300>0</DisE300>
<DisE700>1</DisE700>
<Tokheim>0</Tokheim>
<Wayne>0</Wayne>
<ServiceCode>8051</ServiceCode>
<ErrDisc>Encrypted Pulser: Lid or Cover Removed</ErrDisc>
</Code>
<Code>
<Version>6</Version>
<ID>287</ID>
<DisAdvantage>0</DisAdvantage>
<DisE500>1</DisE500>
<DisE300>0</DisE300>
<DisE700>1</DisE700>
<Tokheim>0</Tokheim>
<Wayne>0</Wayne>
<ServiceCode>5721</ServiceCode>
<ErrDisc>Door Opened</ErrDisc>
</Code>
<Code>
<Version>6</Version>
<ID>288</ID>
<DisAdvantage>0</DisAdvantage>
<DisE500>1</DisE500>
<DisE300>0</DisE300>
<DisE700>1</DisE700>
<Tokheim>0</Tokheim>
<Wayne>0</Wayne>
<ServiceCode>5722</ServiceCode>
<ErrDisc>Door Closed</ErrDisc>
</Code> <Code>
<Version>6</Version>
<ID>289</ID>
<DisAdvantage>0</DisAdvantage>
<DisE500>1</DisE500>
<DisE300>0</DisE300>
<DisE700>1</DisE700>
<Tokheim>0</Tokheim>
<Wayne>0</Wayne>
<ServiceCode>5723</ServiceCode>
<ErrDisc>Hydraulics Panel Opened</ErrDisc>
</Code> <Code>
<Version>6</Version>
<ID>290</ID>
<DisAdvantage>0</DisAdvantage>
<DisE500>1</DisE500>
<DisE300>0</DisE300>
<DisE700>1</DisE700>
<Tokheim>0</Tokheim>
<Wayne>0</Wayne>
<ServiceCode>5724</ServiceCode>
<ErrDisc>Hydraulics Panel Closed</ErrDisc>
</Code> <Code>
<Version>6</Version>
<ID>291</ID>
<DisAdvantage>0</DisAdvantage>
<DisE500>1</DisE500>
<DisE300>0</DisE300>
<DisE700>1</DisE700>
<Tokheim>0</Tokheim>
<Wayne>0</Wayne>
<ServiceCode>5300</ServiceCode>
<ErrDisc>PPU Value Changed</ErrDisc>
</Code>
<Code>
<Version>6</Version>
<ID>292</ID>
<DisAdvantage>0</DisAdvantage>
<DisE500>1</DisE500>
<DisE300>0</DisE300>
<DisE700>1</DisE700>
<Tokheim>0</Tokheim>
<Wayne>0</Wayne>
<ServiceCode>5181</ServiceCode>
<ErrDisc>Totalizer Not Present</ErrDisc>
</Code>
</CodeUpdate>
This exact same code works fine in B4A so I am assuming I am missing something that is different in B4I.