11.12.2012 Views

JavaScript 2.0-The Complete Reference, Second ... - freecodingtutorial

JavaScript 2.0-The Complete Reference, Second ... - freecodingtutorial

JavaScript 2.0-The Complete Reference, Second ... - freecodingtutorial

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<br />

<br />

If you inspect the preceding example closely, you‘ll notice that the use of the try/catch block to<br />

address cross-platform code issues as well as an indication of some potential security issues.<br />

Netscape in particular will want you to grant explicit privilege to access a remote site.<br />

This makes sense if you consider the implications of remote XML access. As you probe the<br />

frontiers of <strong>JavaScript</strong>, you will find differences between browsers, such as security policies, to<br />

be significant. <strong>The</strong> next few chapters will give you some help here, but as always, you should<br />

be very cautious lest you develop code that only works in the browser you happen to use.<br />

Summary<br />

With <strong>JavaScript</strong> and the DOM, you can directly manipulate the contents of an XML document.<br />

This chapter presented a very brief introduction to XML and some examples of how Internet<br />

Explorer and Mozilla implement <strong>JavaScript</strong>-XML interaction. Unfortunately, we saw once again<br />

that the two browsers do things in very different ways. Yet even if that were not the case, the<br />

actual value of manipulating XML documents client-side has really yet to be tapped by most<br />

developers. Some may question the usefulness of doing this because of the major bugs and<br />

the problems with down-level browser support for client-side XML manipulation. Because of<br />

such problems, at the time of this edition‘s writing, in most cases XML documents are being<br />

transformed server-side first before delivery to the browser. Hopefully, in the future, direct<br />

viewing and manipulation of XML documents will certainly become more prevalent whether<br />

implemented using proprietary features like Microsoft‘s XML data islands, loading of XML files,<br />

or via direct use of XML by the browser. However, for now, given the emerging standards and<br />

somewhat volatile mixture of markup, style, and scripting, <strong>JavaScript</strong> developers might first<br />

want to fully master the DOM as it relates to (X)HTML before proceeding to interact with XML.<br />

In doing so, their experience should serve them well since the core concepts are similar<br />

regardless of the markup language in use.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!