|
|
 |
Article:
 |
 |
Very Dynamic Web Interfaces
|
| Subject: |
I realize that I'm on XML.com, but.... |
| Date: |
2005-04-06 23:06:21 |
| From: |
mdchaney |
|
Response to: I realize that I'm on XML.com, but....
|
|
|
That's great... until you want to reuse the logic for something that isn't JavaScript on the otherside. This is exactly the type of thing that XML is for.
It's easier to parse the JavaScript object literal notation than it is to parse XML. Also, there are various libraries already available to do so, check www.json.org for more details.
Given the simplification of using a simple object over using DOM methods to get at your data (again: "response.method" vs. "response.getElementsByTagName('method')[0].firstChild.data") it just seems unlikely that bloating your code and making it unreadable on the JavaScript side in the off chance you'll want to reuse this data elsewhere is the way to go. Particularly given that using DOM methods in any language is likely to be as painful.
|
Previous Message
|
Up
|
Next Message
|
- I realize that I'm on XML.com, but....
2005-04-26 15:58:43 krufty
[Reply]
incidentally, a programmer mistake by parsing literals on a data feed could result in something like
If your datafeed contained:
alert("oops, thought i took this debug line out of here");
you'd execute it. The datafeed cannot accidentally cause the calling page to execute javascript code unless you eval the data coming back.
- I realize that I'm on XML.com, but....
2005-04-26 15:54:22 krufty
[Reply]
I think the point is that if you have relatively complex data being returned, and relatively complex data being parsed, its easier to absorb the cost on the hardware side than the development side.
Sticking to XML when you can afford to makes it easier to validate common logic between different languages (think C, C++) .. if you have diff data formats, and diff parsers, and diff developers working on them, you're bound to have more problems than if you data feed is built from a consistant, human readable format. Sure, XML is expensive, but thats the whole concept of data abstraction.
|
 |
Sponsored By:
|