Swift I can't convert html tag to string -
i create web-service pull html tag here result.
<currentoilpriceresult><ptt_ds> <dataaccess> <price_date>2016-01-09t05:00:00+07:00</price_date> <product>blue gasoline 95</product> <price>30.46</price> </dataaccess> <dataaccess> <price_date>2015-06-05t05:00:00+07:00</price_date> <product>blue gasoline 91</product> </dataaccess> <dataaccess> <price_date>2016-01-14t05:00:00+07:00</price_date> <product>blue diesel</product> <price>19.69</price> </dataaccess> <dataaccess> <price_date>2016-01-09t05:00:00+07:00</price_date> <product>blue gasohol 91</product> <price>23.08</price> </dataaccess> </ptt_ds></currentoilpriceresult></currentoilpriceresponse></soap:body></soap:envelope>
i want pull pain-text html tag, there possible solution?
the nsxmlparser can extract information xml data. here's example showing text arrives. i'm reading file here can xml stream.
import foundation class myxmldelegate : nsobject, nsxmlparserdelegate { func parser(parser: nsxmlparser, foundcharacters string: string){ // cdata content arrives here } } var delegate = myxmldelegate() let url = nsbundle.mainbundle().urlforresource("file", withextension: "xml") let xmlparser = nsxmlparser(contentsofurl: url!) xmlparser!.delegate = delegate xmlparser!.parse()
Comments
Post a Comment