Can I access local XML files as data in jqGrid?
You can load the contents of the XML file in a string variable and use datatype: 'xmlstring' (see http://www.trirand.com/jqgridwiki/doku.php?id=wiki:retrieving_data#xml_string). It will work.
I could run a local example using xmlstring method after modify the example code that I saw in: http://www.trirand.com/jqgridwiki/doku.php?id=wiki:retrieving_data#xml_string
My modified code is:
var mystr =
"<?xml version='1.0' encoding='utf-8'?>"+
"<invoices>"+
"<rows>"+
"<row>"+
"<cell>data1</cell>"+
"<cell>data2</cell>"+
"<cell>data3</cell>"+
"<cell>data4</cell>"+
"<cell>data5</cell>"+
"<cell>data6</cell>"+
"</row>"+
"</rows>"+
"</invoices>";
Instead of:
var mystr =
"<?xml version='1.0' encoding='utf-8'?>
<invoices>
<rows>
<row>
<cell>data1</cell>
<cell>data2</cell>
<cell>data3</cell>
<cell>data4</cell>
<cell>data5</cell>
<cell>data6</cell>
</row>
</rows>
</invoices>";
You want to access an XML file stored on the client's machine via JavaScript? I don't think that can be done.
The more common scenario is pulling your XML via an Ajax call. I'd also look at the "local" option on the jqGrid wiki. You could embed your data as JSON/XML in the HTML page and read it in when setting up your jqGrid.
Related
I have a raw xml file on Gist:
https://gist.githubusercontent.com/EmDubeu/196d95b561fa83a4ef360654ed919fe5/raw/9e2dde8d08a2ea4e45871bf8c55693334f8a69e1/NEIPA.xml
I store the above url in a cell in my Google spreadsheet (Settings!E27).
I'm trying to use importxml from my google sheet with the following formula:
=IMPORTXML(Settings!E27, "//HOP/NAME"), but it returns "Error Imported Xml content can not be parsed."
My formula works with this url:
http://www.beerxml.com/recipes.xml
Why is it not working with my Gist hosted xml file?
GitHub is not for file-hosting and Content-Type headers is not set properly. If you type http://www.beerxml.com/recipes.xml in the browser, it will render the page as XML contents, but not for your https://gist.githubusercontent.com/EmDubeu/... since it cannot recognize it as a XML page.
In this case, people(at least, I) usually use sites like https://rawgit.com/. For your gist file, rawgit URL is https://rawgit.com/EmDubeu/196d95b561fa83a4ef360654ed919fe5/raw/fcb019a0db249ea90a9512f9162725547f4a43b5/NEIPA.xml.
But when I type this URL, my browser says it cannot parse the page because of characters like &. It should be HTML(XML) character encoded. You can verify this by viewing the source of http://www.beerxml.com/recipes.xml, in which & is encoded to & properly. You should html-encode your gist too.
Insert a break line between <?xml version="1.0" encoding="ISO-8859-1"?> and <RECIPES>
I have created a really simple xml file for testing plivo:
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Speak>Hello, Input your 4-digit pin number</Speak>
<GetDigits action="https://example.com/voice/plivo/renderVoiceCallDirective/wGather" method="POST">
<Speak>Enter your 4-digit pin number, followed by the hash key</Speak>
</GetDigits>
<Speak>Input not received. Thank you</Speak>
<Redirect>/voice/plivo/timeoutRedirect/xxx</Redirect>
</Response>
In theory, plivo will read the content of and gather the input digits
but it seems like the Speak and GetDigits doesn't work, because after getting this xml, plivo directly goes to the redirect url. The call will last several second and hangup. Any one know why this happens? Thanks
The XML is validated first before executing it. The URL given in "Redirect" tag is not a valid URL. So the XML fails the validation and the call hangs up.
Try using a valid URL in Redirect XML.
AM developing a auto completion or suggestion box using AJAX and servlets . My problem is how to parse the XML response in java script to show it in a div tag.My xml response is like contains one parent tag RESULTS , it contains number of children tags called RESULT.
How to get result values in java script variables.
You could do this using jQuery.parseXML
Take look on this thread: Parse XML from XMLHttpRequest
I think it contains information you need.
Can someone help me with this:
I am using xpath extractor of jmeter to retrieve sessionId value from the below response.
I need the value of the sessionId to be stored in some file, so that i can use that value in succeeding calls..My basic response is as below:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ns2:createUserResponse xmlns:ns2="http://www.musicthp.com"
isNewUser="false"
profileId="32109"
sessionId="ryIlb+E5yj7FReA2w96uag=="
success="true">
<duration>316</duration>
</ns2:createUserResponse>`
In order to use the results in a future call, you simply need to use the "Reference Name" as a variable.
If you configure the Xpath Extractor reference name as sessionID, subsequent calls would use ${sessionID}
I have a currency converter application for iphone which uses web service. The web service is returning result in the following format:-
<Date>4/5/2010</Date>
<Time>7:18:09 AM</Time>
<Amount>20</Amount>
<ExchangeRate>44.7336419443466</ExchangeRate>
<Result>894.672839</Result>
I'm storing the whole xml file in an NSString variable called theXML. I want to show the value inside the result tag.How can i read the data from the xml file or from the string..
Thanks in advance..
Use XPath.