Android Question Find a value in a XML file

Penfound

Active Member
Licensed User
Longtime User
I am having trouble finding a search term within a XML file. The file itself is a library of music and parses correctly but I can't catch the value I want when running through the code.

Sample XML:

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<library>
<Music>
<CatNo>1</CatNo>
<Title>12 Christmas Carols</Title>
<Size>187516223</Size>
<Composer>Graham</Composer>
<Arranger>Colin</Arranger>
<Publisher>Penfound</Publisher>
<ISMN>14B5 37FD E5DA 773B C7EF D8C1 0B35 A6D7</ISMN>
<NumberOfParts>19</NumberOfParts>
<FullScore>Y</FullScore>
<Soprano>Y</Soprano>
<SoloCornet>Y</SoloCornet>
<Repiano>Y</Repiano>
<Cornet2>Y</Cornet2>
<Cornet3>Y</Cornet3>
<Flugel>Y</Flugel>
<SoloHorn>Y</SoloHorn>
<Horn1>Y</Horn1>
<Horn2>Y</Horn2>
<Trombone1>Y</Trombone1>
<Trombone2>Y</Trombone2>
<BassTrombone>Y</BassTrombone>
<Baritone1>Y</Baritone1>
<Baritone2>Y</Baritone2>
<Euphonium>Y</Euphonium>
<EbBass>Y</EbBass>
<BbBass>Y</BbBass>
<Drums>Y</Drums>
</Music>

I am trying to create a list of "Titles" that match a given searchText. My failed code so far...

B4X:
Sub parser_EndElement (Uri As String, Name As String, Text As StringBuilder)
    If parser.Parents.IndexOf("Music") > -1 Then
        Select Name
            Case "Title"
                currentEvent.title = Text.ToString
                If sf.at(currentEvent.title,searchText) >0 Then
                    LstTitlesView.AddSingleLine(currentEvent.Title)
                End If
            End Select
    End If
End Sub

I have tried .contains , ,instring previously without any joy.

I know this has got be be simple - but I can't see it.

Thanks for looking
Penfound
 
Top