HTML data islands - xml

I am developing a web application and I intend to insert data into an xml island so that I can dynamically display it in a client side HTML table based on options that users will select.

I have general concepts, but I need to point out how to use the DOM to navigate the xml. And how do I update my xml site, perhaps to send to the server?

Please take a look at any links to online resources or quick advice.

NB: I understand most of the dynamic concepts of HTML and server-side and client-side components, so feel free to be very technical in your answer :)

+1


source to share


3 answers


There are no XML data islands in W3C HTML (unless you reference an external XML file linked through frames loaded with Javascript), but you can reuse HTML elements and insert metadata in class

, title

(if you want HTML4 validity), data-*

(HTML5 ) or your custom attributes.

For navigation you have a DOM DOM Core , such as element.childNodes

, .nextSibling

, .getAttribute()

, etc.



The DOM can be verbose and tedious to use (for example, when looking for elements in the DOM, you have to be careful to skip text nodes), so JS libraries like jQuery and Prototype offer a more user-friendly API based on it.

If you intend a lot of DOM transformations then the Javascript API for XPath and XSLT processor will come in handy.

+5


source


What you are describing can be accomplished with XML.



However, I think it would be much easier if you used JSON instead of XML. This way you can work directly with the Javascript object, which is friendlier than moving the XML DOM. Then you can send the serialized JSON form to the server using the JSON library

+1


source


Ajax Patterns has some good examples for using data islands: http://ajaxpatterns.org/wiki/index.php?title=XML_Data_Island

0


source







All Articles