Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #16692

Re: Display XML content in HTML page

Message-ID <10917678.yukSOJlrKS@PointedEars.de> (permalink)
From Thomas 'PointedEars' Lahn <PointedEars@web.de>
Organization PointedEars Software (PES)
Date 2012-10-17 20:05 +0200
Subject Re: Display XML content in HTML page
Newsgroups comp.lang.javascript
References <1a067dc0-9d64-4b7c-ba61-736bf747bb78@googlegroups.com> <7cbt78t4o9lq18ta0tisg2ftq8gmp3pm9k@4ax.com> <pRBfs.2677$7h4.909@newsfe10.iad>
Followup-To comp.lang.javascript

Followups directed to: comp.lang.javascript

Show all headers | View raw


Daniel Pitts wrote:

> On 10/17/12 6:11 AM, Jim T. wrote:
>> Pervez Mulla wrote:
>>> I am newbie , I have application in which check-box tree is present. I
>>> want to pre-populate the check-box's if user before checked some of
>>> those check box.
>>>
>>> For that am getting XML format from my back-end perl script as shown
>>> below.like , in below XML only 0, 43,44,45,46 and 50 are coming so only
>>> those respective checkbox need to checked on page load.I want to display
>>> those checked check-box on page load .How can I do this .......?
>>>
>>> I tried with so many examples . but am not getting solution for my
>>> problem .Below is my XML format data which is am getting from perl
>>> script .
>>
>> Is the problem parsing the XML? If so RegExp should be up to the job
>> in this case. If that's the the problem please be more specific.
> 
> No. Just no.
> RegExp is *never* the solution to XML parsing. Bad! Bad!

Utter nonsense.  It can be *a* solution, but it has to be done carefully, 
with the Chomsky hierarchy in mind.  In particular, never try to use a 
*single* RegExp to match a *self-nesting* or otherwise *several times 
occuring* element in an XML document.  (An XML parser can be written that 
uses a RegExp to match language atoms efficiently and builds a document tree 
object reliably from the markup.  Same for HTML, BTW, but its lacking well-
formedness makes it harder.)

In this case, however, using the `responseXML' XHR property is the best 
solution; no additional parsing necessary.  For that property to be useful, 
the server must send a proper XML-related Content-Type; if there is none 
specific, text/xml should work and is appropriate.


PointedEars
-- 
Sometimes, what you learn is wrong. If those wrong ideas are close to the 
root of the knowledge tree you build on a particular subject, pruning the 
bad branches can sometimes cause the whole tree to collapse.
  -- Mike Duffy in cljs, <news:Xns9FB6521286DB8invalidcom@94.75.214.39>

Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Display XML content in HTML page Pervez Mulla <mullapervez@gmail.com> - 2012-10-17 05:23 -0700
  Re: Display XML content in HTML page Jim T. <x@y.z> - 2012-10-17 09:11 -0400
    Re: Display XML content in HTML page Jim T. <x@y.z> - 2012-10-17 09:20 -0400
    Re: Display XML content in HTML page Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2012-10-17 10:24 -0700
      Re: Display XML content in HTML page Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-10-17 20:05 +0200
      Re: Display XML content in HTML page Jim T. <x@y.z> - 2012-10-17 21:31 -0400
      Re: Display XML content in HTML page Pervez Mulla <mullapervez@gmail.com> - 2012-10-17 21:42 -0700
  Re: Display XML content in HTML page Hans-Georg Michna <hans-georgNoEmailPlease@michna.com> - 2012-10-17 15:39 +0200
  Re: Display XML content in HTML page Cezary Tomczyk <cezary.tomczyk@gmail.com> - 2012-10-17 20:03 +0200
    Re: Display XML content in HTML page Pervez Mulla <mullapervez@gmail.com> - 2012-10-17 21:38 -0700
      Re: Display XML content in HTML page Cezary Tomczyk <cezary.tomczyk@gmail.com> - 2012-10-18 07:41 +0200
        Re: Display XML content in HTML page Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-10-29 12:09 +0100
          Re: Display XML content in HTML page Cezary Tomczyk <cezary.tomczyk@gmail.com> - 2012-11-09 23:03 +0100
  Re: Display XML content in HTML page Danny <dann90038@gmail.com> - 2012-10-17 13:19 -0700
  Re: Display XML content in HTML page Bart Van der Donck <bart@nijlen.com> - 2012-10-31 00:50 -0700

csiph-web