Sha256: b31e83922c9ebb158dbb4a5ebfa67589dff4ffad41ced9cca944fce9edde391a
Contents?: true
Size: 1.67 KB
Versions: 2
Compression:
Stored size: 1.67 KB
Contents
{ "sampleData": ["<root>\n <parent1>\n <child1>5</child1>\n<child2>parent1 word</child2>\n </parent1>\n <parent2>\n <uniq attr=\"test_atr\">val</uniq>\n <child2>word2</child2>\n </parent2>\n</root>" ], "methods": [ { "desc": "Get response object", "method": "@exchange.response", "result": "# RestClient::Response or Savon::Response object" }, { "desc": "Value from unique element", "method": "@exchange['uniq']", "result": "'val' # String", "highlight": "<uniq " }, { "desc": "Value via XPath", "method": "@exchange['//parent1/child2']", "result": "'parent1 word' # String", "highlight": "\n<child2>" }, { "desc": "Value via first matching XPath", "method": "@exchange['//parent1/uniq|//parent2/uniq']", "result": "'val' # String. (First XPath didn't find anything so second was used)", "highlight": "<uniq " }, { "desc": "List of values matching XPath", "method": "@exchange.values_from_path('//child2')", "result": "['parent1 word', 'word2'] # Array", "highlight": "<child2>" }, { "desc": "Convert response into hash", "method": "@exchange.to_hash", "result": "{\"root\"=>{\"parent1\"=>{\"child1\"=>\"5\", \"child2\"=>\"parent1 word\"}, \"parent2\"=>{\"uniq\"=>\"val\", \"child2\"=>\"word2\"}}} # Hash" }, { "desc": "Extract attribute from hash", "method": "@exchange.to_hash.dig(:root, :parent2, :uniq).attributes['attr']", "result": "'test_atr' # String", "highlight": "attr" } ] }
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
soaspec-0.2.20 | demo/xml_extract.json |
soaspec-0.2.19 | demo/xml_extract.json |