Parsing HTML data
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-18-2019 10:30 AM
I have a response from web service in html format. I need to parse that out to extract the values. What is a good way to extract the data? Is there a way to convert html to xml and then parse the data?
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-19-2019 04:17 AM
var sm = new sn_ws.RESTMessageV2('store-data','get');
var response=sm.execute();
var responseBody = response.getBody();
Store-data is the rest message pointing to the endpoint.
The response is the info I posted above. Unfortunately it is returning Html and I am trying to get the data from it. This is like I am hitting yahoo finance and trying to parse information from it.
<!DOCTYPE html>
<html lang="en-us" class="no-js not-ie">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta charset="utf-8">
<input class="form-control col-sm-12" aria-label="Store Code" disabled="disabled" type="text" value="23456" name="name" id="user_name" /> </div>
<div class="entity-detail-form-group"> <label class="col-sm-12" for="store_description">Description</label>
<input class="form-control col-sm-12" aria-label="Store Description" disabled="disabled" type="text" value="test" name="store[description]" id="store_description" /> </div> <div class="entity-detail-form-group"> <label class="col-sm-12" for="store_loc_code">Store code</label> <input class="form-control col-sm-12" aria-label="Store Code" disabled="disabled" type="text" value="store23" name="store[office_code]" id="store_office_code" /> </div> <div class="entity-detail-form-group"> </div> <div class="entity-detail-form-group"> <label class="col-xs-6" for="store_active">Active</label>
{"text":Store1234",href:"1234","store code":"1234","description":"NewJersey store","store_office_code":"NJH","active":"true}
{"text":Store789",href:"789","store code":"789","description":"Newyork store","store_office_code":"NYS","active":"true}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-19-2019 04:56 AM
Hi,
Can you try setting content-type as application/xml or application/json in header parameter section on rest message.
Thanks,
Ashutosh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-19-2019 07:46 PM
Tried it, No luck. I get the same data.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-19-2019 10:13 AM
Same question here. Tried a bunch of variations on creating an XML document from the source but have had no luck.