Hello,
I am a little stuck trying to parse a XML file.
I have checked out some of the examples (such as: http://www.b4x.com/android/forum/threads/xml-parsing-with-the-xmlsax-library.6866/#content) but still couldn't work out how to open a XML file and parse a item within it.
I have the following XML file
events.xml
I am trying to return 'event 3' (Event_1003) but can't work out how to select a single node (Event_1003) and get it's value (event 3)?
I am trying to return the value such as:
I know I am doing it wrong, but can someone help me out?
I am a little stuck trying to parse a XML file.
I have checked out some of the examples (such as: http://www.b4x.com/android/forum/threads/xml-parsing-with-the-xmlsax-library.6866/#content) but still couldn't work out how to open a XML file and parse a item within it.
I have the following XML file
events.xml
B4X:
<?xml version="1.0"?>
<EVENTS>
<EVENT>
<Event_1001>event 1</Event_1001>
<Extended_1001>1</Extended_1001>
<Event_1002>event 2</Event_1002>
<Extended_1002>3</Extended_1002>
<Event_1003>event 3</Event_1003>
<Extended_1003>1</Extended_1003>
<Event_1004>event 4</Event_1004>
<Extended_1004>2</Extended_1004>
</EVENT>
</EVENTS>
I am trying to return 'event 3' (Event_1003) but can't work out how to select a single node (Event_1003) and get it's value (event 3)?
I am trying to return the value such as:
B4X:
Sub Process_Globals
Dim xml_file As SaxParser
End Sub
Sub GetItem(event as string) as string
xml_file.Initialize()
Dim myFile As InputStream
myFile = File.OpenInput(File.DirAssets, "events.xml")
parser.Parse(myFile, "parser")
End Sub
I know I am doing it wrong, but can someone help me out?
Last edited: