Note that there are some explanatory texts on larger screens.

plurals
  1. POLarge a XML data in jQuery
    primarykey
    data
    text
    <p>I am working on a JavaScript library that is supposed to be used by different applications targeting various platforms such as Web/iOS/Android. </p> <p>In this, the application would need to make REST-calls to retrieve and parse a large multilevel XML data(with namespace). Planning to use jQuery here.</p> <p>The large-XML can contain data that may not be useful at times. </p> <p>For example, depending on the Locale-setting in the application that uses this library, only a subset of a meta-data need to be parsed.</p> <pre><code> &lt;meta&gt; &lt;data&gt; ... ... ... &lt;/data&gt; &lt;component local="EN-US"&gt; ... &lt;/component&gt; &lt;component local="EN-UK"&gt; ... &lt;/component&gt; &lt;component local="EN-AU"&gt; ... &lt;/component&gt; &lt;/meta&gt; </code></pre> <p>So, parsing all the data received in the Ajax-response seems to be a waste of effort.</p> <p>Keeping this in mind, I wonder if the following is a good way to approach this problem: 1. Store the "responseXML" received in the JQuery's Ajax success callback. 2. When the application requests the data for say "EN-US", parse the appropriate sub-nodes from the stored "responseXML" document, and return the result. (If the user changes the Locale-setting, no problem, we can go and parse the appropriate section of the XML-Data).</p> <p>I do understand that, parsing on the go will add a delay to the application, but it seems to me that, overall application performance will be better. No need to parse all the data upfront and use only portion of it.</p> <p>Please share your thoughts/ideas.</p> <p><strong>EDIT:</strong> Server is controlled by a different team with different priorities. So, changing the server-side code to return appropriate data is not an option at the moment. </p> <p>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.
 

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