Android Question I can not open the XML file using the XOM library

Valeriy Lakhtin

Member
Licensed User
I try to read information from the XML file, I created a simple XML file

<?xml version="1.0" encoding="UTF-8"?>
<dataroot xmlns:eek:d="urn:schemas-upnp-org:device-1-0" generated="2015-12-11T15:07:54">
<S>
<in>A1</in>
</S>
<S>
<in>A2</in>
</S>
<S>
<in>A3</in>
</S>
<S>
<in>A4</in>
</S>
<S>
<in>D1</in>
</S>
</dataroot>

and activated it in the right pane file manager
but in the emulator CML file is not initialized. I think the problem with the file location?

Sub Activity_Create(FirstTime As Boolean)

Activity.LoadLayout("StartScreen")
' 'the BuildFromString method is used here as the BuildFromFile method cannot access files in assets
Dim XmlString As String
XmlString=File.GetText(File.DirAssets, "spravin.xml")

Dim XOMBuilder1 As XOMBuilder
XOMBuilder1.Initialize("XOMBuilder1")

XOMBuilder1.BuildFromString(XmlString, "", Null)

Msgbox(XOMBuilder1.IsInitialized,"")

End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub

Sub XOMBuilder1_BuildDone(XOMDoc As XOMDocument, Tag As Object)
If XOMDoc.IsInitialized Then

Dim RootElement As XOMElement=XOMDoc.RootElement
Dim ItemsElements As XOMElements
ItemsElements= RootElement.GetChildElementsByName("S")

N_Item = ItemsElements.Size

Else
Msgbox("File problem","")
End If
End Sub
 

DonManfred

Expert
Licensed User
Longtime User
Upvote 0

Valeriy Lakhtin

Member
Licensed User
I installed USB Google driver conect USB cable LG3 but Win device manager i can't see new device? May be need seach other driver special LG celphone?
 
Upvote 0

Valeriy Lakhtin

Member
Licensed User
I started usb-debugging in my LG3, I installed LG3 USB driver on PC. But when I to run B4A, I don't know where I can to see conection celphone with B4A
 
Upvote 0

Valeriy Lakhtin

Member
Licensed User
Now I to have connection on the phone, aftere click point "transfer files and pictures" :). The telephone displays the warning included USB debugging. But for me is not clear where need search the connection in B4A interfeis or panel SDK manager?
 
Upvote 0

Valeriy Lakhtin

Member
Licensed User
The computer sees the folders in the phone. On my phone, written USB debuging enabled. When I click Release mode -> pops up window with mesage "device not found" :-(. I undestand that indicator conection in B4A is not :-(
 
Last edited:
Upvote 0

Valeriy Lakhtin

Member
Licensed User
I Installed B4A bridge on my phone. On PC i installed SDK lib Android 6. API 23. I right understand the B4A bridge is used only for the WiFi or Bluetoth connections only. Or B4A bridge used and connect with USB cable too?. Now in window B4A bridge written "connection is not" but USB cable is plugged in PC and phone have a connection with PC
 
Last edited:
Upvote 0

Valeriy Lakhtin

Member
Licensed User
XOM could not parsed the XML file, because the problem was in the file encoding. I used encoding UTF-8 with BOM, but need use UTF-8 without BOM. When I changed the encoding, problem disappeared !!!!
 
Upvote 0

Valeriy Lakhtin

Member
Licensed User
I try to read information from the XML file, I created a simple XML file

<?xml version="1.0" encoding="UTF-8"?>
<dataroot xmlns:eek:d="urn:schemas-upnp-org:device-1-0" generated="2015-12-11T15:07:54">
<S>
<in>A1</in>
</S>
<S>
<in>A2</in>
</S>
<S>
<in>A3</in>
</S>
<S>
<in>A4</in>
</S>
<S>
<in>D1</in>
</S>
</dataroot>

and activated it in the right pane file manager
but in the emulator CML file is not initialized. I think the problem with the file location?

Sub Activity_Create(FirstTime As Boolean)

Activity.LoadLayout("StartScreen")
' 'the BuildFromString method is used here as the BuildFromFile method cannot access files in assets
Dim XmlString As String
XmlString=File.GetText(File.DirAssets, "spravin.xml")

Dim XOMBuilder1 As XOMBuilder
XOMBuilder1.Initialize("XOMBuilder1")

XOMBuilder1.BuildFromString(XmlString, "", Null)

Msgbox(XOMBuilder1.IsInitialized,"")

End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub

Sub XOMBuilder1_BuildDone(XOMDoc As XOMDocument, Tag As Object)
If XOMDoc.IsInitialized Then

Dim RootElement As XOMElement=XOMDoc.RootElement
Dim ItemsElements As XOMElements
ItemsElements= RootElement.GetChildElementsByName("S")

N_Item = ItemsElements.Size

Else
Msgbox("File problem","")
End If
End Sub

XOM could not parsed the XML file, because the problem was in the file encoding. I used encoding UTF-8 with BOM, but need use UTF-8 without BOM. When I changed the encoding, problem disappeared !!!!
 
Upvote 0
Top