Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<h2>Parsing XML in Blackberry</h2> <blockquote> <p>Simple API for XML (SAX) was developed by the members of a public mailing list (XML-DEV).It gives an event based approach to XML parsing. It means that instead of going from node to node, it goes from event to event. SAX is an event driven interface. Events include XML tag, detecting errors etc, J2ME SAX - see <a href="https://stackoverflow.com/questions/2451356/blackberry-j2me-sax-parse-collection-of-objects-with-attributes">BlackBerry/J2ME - SAX parse collection of objects with attributes</a> </p> <p>XML pull parser - It is optimal for applications that require fast and a small XML parser. It should be used when all the process has to be performed quickly and efficiently to input elements kXML - J2ME pull parser - see <a href="https://stackoverflow.com/questions/877428/better-approach-for-xml-creation-in-blackberry">Better approach for XML Creation in Blackberry</a></p> </blockquote> <h2>Parsing XML with JSON</h2> <p>Blackberry standard for JSON parsing is <a href="https://stackoverflow.com/questions/1470406/how-to-parse-the-json-response-in-blackberry-j2me">JSON ME</a></p> <p>No idea... JSON can be represented and transported as a XML, but not vice versa.</p> <blockquote> <p>XML (Extensible Markup Language) is a set of rules for encoding documents electronically. It is defined in the XML 1.0 Specification produced by the W3C, and several other related specifications, all gratis open standards.</p> </blockquote> <p>XML sample: </p> <pre><code>&lt;?xml version="1.0" encoding='UTF-8'?&gt; &lt;painting&gt; &lt;img src="madonna.jpg" alt='Foligno Madonna, by Raphael'/&gt; &lt;caption&gt;This is Raphael's "Foligno" Madonna, painted in &lt;date&gt;1511&lt;/date&gt;–&lt;date&gt;1512&lt;/date&gt;. &lt;/caption&gt; &lt;/painting&gt; </code></pre> <blockquote> <p>JSON (an acronym for JavaScript Object Notation) is a lightweight text-based open standard designed for human-readable data interchange. It is derived from the JavaScript programming language for representing simple data structures and associative arrays, called objects (the “O” in “JSON”). Despite its relationship to JavaScript, it is language-independent, with parsers available for virtually every programming language.</p> </blockquote> <p>JSON sample: </p> <pre><code>{ "firstName": "John", "lastName": "Smith", "age": 25, "address": { "streetAddress": "21 2nd Street", "city": "New York", "state": "NY", "postalCode": "10021" }, "phoneNumber": [ { "type": "home", "number": "212 555-1234" }, { "type": "fax", "number": "646 555-4567" } ] } </code></pre> <p>Basically if your XML is a strong equivalent of JSON, like: </p> <pre><code>&lt;Person&gt; &lt;firstName&gt;John&lt;/firstName&gt; &lt;lastName&gt;Smith&lt;/lastName&gt; &lt;age&gt;25&lt;/age&gt; &lt;address&gt; &lt;streetAddress&gt;21 2nd Street&lt;/streetAddress&gt; &lt;city&gt;New York&lt;/city&gt; &lt;state&gt;NY&lt;/state&gt; &lt;postalCode&gt;10021&lt;/postalCode&gt; &lt;/address&gt; &lt;phoneNumber type="home"&gt;212 555-1234&lt;/phoneNumber&gt; &lt;phoneNumber type="fax"&gt;646 555-4567&lt;/phoneNumber&gt; &lt;/Person&gt; </code></pre> <p>there is a possibility to parse such XML with JSON.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload