0

i am coding a little program to interact with a huawei umts stick. The api from this stick is webbased, xml.

For several reasons, i need to implement this in C. I am not familiar with libxml but as far as i have learned from my websearch this one should be my best option. (if someone has a better proposal i am happy to hear ;))

I´ve done through the big api description and was left a little bit confused. It seams, thar most of the functions are used for documents or websites.

An example for the code i receive is like this:

<response>
<ConnectionStatus>901</ConnectionStatus>
<SignalStrength>96</SignalStrength>
<SignalIcon>5</SignalIcon>
<CurrentNetworkType>3</CurrentNetworkType>
<CurrentServiceDomain>3</CurrentServiceDomain>
<RoamingStatus>0</RoamingStatus>
<BatteryStatus></BatteryStatus>
<BatteryLevel></BatteryLevel>
<simlockStatus></simlockStatus>
<WanIPAddress>10.140.3.121</WanIPAddress>
<PrimaryDns>84.235.6.55</PrimaryDns>
<SecondaryDns>84.235.57.230</SecondaryDns>
<CurrentWifiUser></CurrentWifiUser>
<TotalWifiUser></TotalWifiUser>
<ServiceStatus>2</ServiceStatus>
<SimStatus>1</SimStatus>
<WifiStatus></WifiStatus>
</response>

which i reveive as a char array. Can anyone give me a hint which function would be best to use to parse such xml structures? They are not very complicated. THe worst is a list of sms messages which i would like to walk through and save in structs.

Thanks in advance and kind regards

Solick

solick
  • 2,325
  • 3
  • 17
  • 29
  • 1
    http://www.xmlsoft.org/tutorial, and http://www.xmlsoft.org/examples, would seem to be obvious places to start learning about libxml ... – keshlam Jan 06 '14 at 22:32
  • Also, see http://stackoverflow.com/questions/5465965/how-can-libxml2-be-used-to-parse-data-from-xml (from the "Related" list at right) – keshlam Jan 07 '14 at 01:54
  • Hi, i already had a look into the tutorials and examples. My question was which function should be used to work with an xml char array because as far as i can see all the examples uses files. – solick Jan 07 '14 at 07:07
  • Hi, this one http://stackoverflow.com/questions/12554792/how-to-parse-a-xml-string-instead-of-xml-doc-in-c-using-libxml2-library?rq=1 answered my question. – solick Jan 07 '14 at 09:09

0 Answers0