1. parse XML
Two packages are used:
# Use moduleUse XML: simple;Use Data: dumper;
Process:
# Create object$ Xml = New XML: simple;
# Parsing
$ DATA = $ XML-> xmlin (XML file name );
# Value
My $ value = $ data-> {node name}
If a subnode exists
My $ value = $ data-> {node name}-> {child node name };
2. parse JSON
Per
here's how to get your Android app to have networking capabilities. Of course, the first to have a server, if only for testing, you can use the local area network instead (mobile phone and computer WiFi).
Requires that the computer is configured with Apache+php environment.
Here is a simple Android program, I believe that as long as there is a certain Java foundation can probably "guess" the meaning of it. (The program may not be well written)
Android Program
Layout file
Activity_vertical_m
C # parse Json into DateTable,
# Region parses Json into DateTable ///
Identify whether a string is in Json format: http://blog.csdn.net/jiankunking/article/details/42531209
The format is as follows:
{ "table": [ { "column1": 1, "column2": 2, "column3": 3 },
Header("content-type:text/html; Charset=utf-8 ");//try to read a piece of data from the database and put it in.$con=mysql_connect("localhost", "root", "root");mysql_query("SET NAMES ' UTF8 '"); mysql_select_db("Yun",$con);if(!$con){ die(' Could not connect: '.Mysql_error());}$s=mysql_query("SELECT * from Ofuser"); while($ss=Mysql_fetch_array($s)){$a[]=$ss[' username '];$b[]=$ss[' Phone '];$c[]=$ss[' Nickname '];}foreach($a as $k=$r) { $ARR 4[] =Array(' username ' =UrlEncode($a[$k]), ' phone
Transferred from: http://blog.csdn.net/u013628152/article/details/50481889In the output log times error:Java.lang.IllegalArgumentException:class Cn.cst.advert.rep.AdvertRep declares multiple JSON fields named status.The reason is that the child class and the parent class have the same field properties.Workaround: (1) Remove (not) the field from the parent class, or add annotations to the fields that need to be printed @expose(2): Because I have the er
Use json to parse stringsThe following is a json string array that looks slightly complex at both ends. Of course, the content in the two arrays is very long, but the format is the same. Array 1, citySchools = {"530" \: [["1", "530", "\ u5317 \ u4EAC \ u5927 \ u5B66"], ["2 ", "530", "\ u4E2D \ u56FD \ u4EBA \ u6C11 \ u5927 \ u5B66"], ["3", "530 ", "\ u6E05 \ u534
First, the solution is announced:The Uploadhttpdata method in Ajaxfileupload will be eval ("data =" + data); Change to data = Jquery.parsejson (jQuery (data). text ()); Can!In addition, because of the jquery version upgrade, the old version of the method deprecated causes the method does not exist, add this method in AjaxfileuploadHandleerror:function (S, xhr, status, E) {If a local callback is specified, fire itif (s.error) {S.error.call (S.context | | s, XHR, status, E);}Fire the global callb
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.