XML.orgXML.org
FOCUS AREAS |XML-DEV |XML.org DAILY NEWSLINK |REGISTRY |RESOURCES |ABOUT
OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]
Re: [xml-dev] xml and javascript

I think the easiest thing to do is use something like Sarissa to get your  
DOM Document. Find the elements you want with XPath. Then use something  
like Mozilla/Sarissa's serialize to convert the element to a text string.  
Then stick the HTML where you need with innerHTML and eval the JS.

Of course this is pretty simple JS (even if browser specific) and you  
don't need a special library for it (XHR and serialize, that is, the rest  
is cross browser). Plus you don't have to send the other stuff that the  
client doesn't need or won't be using.

best,
-Rob



On Tue, 20 Mar 2007 15:52:37 -0400, Nathan Young -X (natyoung - Artizen at  
Cisco) <natyoung@cisco.com> wrote:

> Hi Rick.
>
> If what you want is to use XSL in the browser, start with sarissa as Joe
> advises.  It will take care of the cross browser issues and let you make
> XSL do what it's supposed to do.
>
> To be honest it looks like you are wanting to use the "the server is in
> charge, it's going to send orders to the client about what to do with
> the page" model. I'm not a great fan of that model overall because I
> think it creates a weird kind of tight binding between code running on
> the server and code running in the browser.
>
> That said, this model can be a great fit for some specific situations
> and if you want to go with it, there's a mature implementation out there
> called taconite.  You'd have to change your XML format to taconite XML,
> but in return you get a bunch of client side JS code that will recognize
> the incoming XML and do a bunch of the kinds of things it sounds like
> you want.
>
> ----------->Nathan
>
>
>
>
> .:||:._.:||:._.:||:._.:||:._.:||:._.:||:._.:||:._.:||:._.:||:._.:||:._.:
> ||:.
>
> Nathan Young
> Cisco.com->Interface Development
> A: ncy1717
> E: natyoung@cisco.com
>
>> -----Original Message-----
>> From: Joe Fawcett [mailto:joefawcett@hotmail.com]
>> Sent: Tuesday, March 20, 2007 6:02 AM
>> To: xml-dev@lists.xml.org
>> Cc: rjm@zenucom.com
>> Subject: RE: [xml-dev] xml and javascript
>>
>> Rick
>>
>> I don't see a problem with this, use a cross-browser library such as
>> Sarissa, or zXml which I find simpler, to get the basic
>> XmlHttpRequest,
>> either COM or built in depending on the browser. Send the
>> request and parse
>> the XML for the id and the executable JavaScript.
>>
>> Have I missed something?
>>
>> Joe
>>
>>
>> >From: Rick Marshall <rjm@zenucom.com>
>> >To: "xml-dev DEV'" <xml-dev@lists.xml.org>
>> >Subject: [xml-dev] xml and javascript
>> >Date: Tue, 20 Mar 2007 22:29:21 +1100
>> >
>> >can someone put me out of misery please...
>> >
>> >Having realised that xmlHTTPRequest is great, but HTML has
>> limitations - in
>> >particular if I want to update a DIV with the result and
>> execute some
>> >Javascript I can a) make up my own syntax or b) try to use builtin
>> >Javascript functions for processing XML.
>> >
>> >Hmmm... this seems to be browser dependent. Is this correct?
>> I need XPATH.
>> >
>> >I have a simple vocabulary to do the work - basically:
>> >
>> ><response>
>> >    <update id="xxx"> </update>
>> >    ...
>> >    <execute>...</execute>
>> >    </response>
>> >
>> >where updates go into innerHTMLs of the id's and executes
>> are handled by
>> >eval(); (the application takes care of making sure the
>> updates are valid
>> >html).
>> >
>> >(I know I should probably ask on the Mulberrytech list - but
>> I've never had
>> >success with that list - have to change all my email
>> settings to use it -
>> >unlike this friendly list).
>> >
>> >I'm looking for generic (ie IE + Firefox at least) solutions
>> - so MXML is
>> >possible but it seems only available in IE and I can't find
>> any simple
>> >solution for FF.
>> >
>> >All pointers and links accepted with grateful thanks.
>> >
>> >Rick



[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 1993-2007 XML.org. This site is hosted by OASIS