Note that there are some explanatory texts on larger screens.

plurals
  1. POGeneric component for XML using SAX parser
    primarykey
    data
    text
    <p>I am an Android developer, I have to create a generic component for parsing xml using sax parser. For any kind of schema I should create a common component through which we can parse the xml and save that into a data file (bean or model object).</p> <p>Is this possible with SAX, if so can you please assist me?</p> <p>For ex,</p> <pre><code>&lt;ns:multiStockDataDownloadResponse xmlns:ns="http://service.tcs.web"&gt; &lt;ns:return&gt; &lt;StockList&gt; &lt;Stock changeData="-0.10" companyData="Sprint Nextel Corporation" lastData="5.21" marketCapData="15586.73" percChangeData="-1.88" tkr="S" &gt; &lt;customerProfile value="false" name="isNWCustomer" /&gt; &lt;customerProfile value="English" name="custLangPref" /&gt; &lt;customerProfile value="karthi.muthusamy@bankofamerica.com" name="fullEmailAddress" /&gt; &lt;/Stock&gt; &lt;Stock changeData="+0.43" companyData="Vodafone Group Plc (ADR)" lastData="26.43" marketCapData="135649.83" percChangeData="2.05" tkr="VOD" &gt; &lt;customerProfile value="false" name="isNWCustomer" /&gt; &lt;customerProfile value="English" name="custLangPref" /&gt; &lt;/Stock&gt; &lt;Stock changeData="+0.12" companyData="Verizon Communications Inc." lastData="35.24" marketCapData="98672.00" percChangeData="0.34" tkr="VZ" &gt; &lt;customerProfile value="false" name="isNWCustomer" /&gt; &lt;/Stock&gt; &lt;Stock changeData="+0.08" companyData="AT&amp;amp;T Inc." lastData="30.43" marketCapData="180206.46" percChangeData="0.26" tkr="T" /&gt; &lt;Stock changeData="-0.22" companyData="Telefonica S.A. (ADR)" lastData="23.47" marketCapData="107117.00" percChangeData="-0.93" tkr="TEF" /&gt; &lt;/StockList&gt; &lt;/ns:return&gt; &lt;/ns:multiStockDataDownloadResponse&gt; </code></pre> <p>Another sample is </p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;ns:getProductDescriptionResponse xmlns:ns="http://services.tcs.web"&gt;&lt;ns:return&gt;&lt;Service&gt; &lt;ServiceDescription serviceClass="TEST" serviceId="getProductDescription1" serviceName="Get Customer Product Info" serviceVersion="1.0" /&gt; &lt;ProductDescription disclosureStatus="Green" displaySize="3.7&amp;quot;" distributionSites="Fort Worth TX, USA&amp;lt;br/&gt;Jaguariuna, Brazil" formFactor="QWERTY Side Slider" franchise="Social Messaging" hwDesignCentre="Libertyville" keyFeatures="Rich Web Experience- Webkit, Flash with Huge 16:9 WVGA Screen&amp;lt;br/&gt;The Premier 2.X Android Experience from Google&amp;lt;br/&gt;Thinnest QWERTY Slider available at 13.7mm Thin&amp;lt;br/&gt;Work &amp;amp; Personal Life Integrated: Unified Calendars, Email &amp;amp; Contacts" launchPriceTier="$301-$400" manufacturingSites="Tianjin, China (Lead Site)" marketName="DROID" modelNumber="A855" popi="Shareable" productId="1875" productName="Sholes CDMA" productSADate="10/22/2009" productSegment="Performance Smartphones" productStatus="End of Life" swDesignCentre="Libertyville" swPlatform="Android Eclair 1.0" technologies="CDMA 800/1900, CDMA EV-DO Release A, Bluetooth Class 2 Version 2.0+EDR, WiFi 802.11b/802.11g, aGPS (assisted)" /&gt; &lt;ShipAcceptanceDates&gt; &lt;Launch country="United States" customer="Verizon" launchType="Initial Launch" region="North America" saDate="10/22/2009" saStatus="FULL SA" /&gt; &lt;Launch country="United States" customer="Verizon" launchType="UPGRADE 1" region="North America" saDate="05/31/2011" saStatus="On Plan" /&gt; &lt;/ShipAcceptanceDates&gt; &lt;ProductTeam&gt; &lt;Role coreId="Q14993" name="Mayur Talati" role="Supply Chain Program Manager" /&gt; &lt;Role coreId="GWNQ46" name="Chippindale Cindy" role="Program Manager" /&gt; &lt;Role coreId="KHALLMAN" name="KENNETH HALLMAN" role="Product Family Lead" /&gt; &lt;Role coreId="WLMR06" name="Mike Reich" role="Device Project/Program Lead" /&gt; &lt;/ProductTeam&gt; &lt;/Service&gt;&lt;/ns:return&gt;&lt;/ns:getProductDescriptionResponse&gt; </code></pre> <p>In both the cases this component has to parse the xml and create different data file based on the schema. Thanks in Advance.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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