XML
  Home arrow XML arrow Page 4 - XML Responses and AJAX
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
XML

XML Responses and AJAX
By: Jayaram Krishnaswamy
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 25
    2006-02-27

    Table of Contents:
  • XML Responses and AJAX
  • A brief explanation of innerHTML
  • AJAX returning an XML document
  • A Quick look at XMLDOM
  • Student Nodes Collection

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    XML Responses and AJAX - A Quick look at XMLDOM


    (Page 4 of 5 )

    In this section we look at the parsing of the XML document in some detail. The responseXML is an XML document, and its properties can also be accessed.

    responseXML's basic properties

    document.getElementById("x4").innerHTML=xhr.responseXML.
    firstChild.nodeName
    document.getElementById("x5").innerHTML=xhr.responseXML.
    lastChild.nodeName

    Displayed result for the above snippet

    xml
    wclass

    Relevant portion of the XML Document


    responseXML.documentElement's basic properties

    document.getElementById("x2").innerHTML= xhr.responseXML.documentElement.firstChild.nodeName
    document.getElementById("x3").innerHTML= xhr.responseXML.documentElement.lastChild.nodeName

    Displayed result for the above snippet

    The responseXML is considered as a document with root wclass. The boundary is the document. The first child is comment and the lastChild is student.

    #comment
    student

    Relevant portion of the XML Document


    documentElement's children

    In this case, it is the responseXML document's children. Let's take the example of item 3. The following snippet captures this child's properties.

    document.getElementById("x6").innerHTML= xhr.responseXML.documentElement.childNodes.item(3).text
    document.getElementById("x7").innerHTML= xhr.responseXML.documentElement.childNodes.item(3).
         attributes[0].name
    document.getElementById("x8").innerHTML=
         attributes[0].value

    Displayed result for the above snippet

    Charles Boyer HTML, Photoshop
    id
    3

    Relevant portion of the XML Document


    More XML Articles
    More By Jayaram Krishnaswamy


       · There was some good information in that article but I had to "view source" to see...
       · I saw some errors and tried to fix them. If you're still seeing problems, please...
       · Hi, thank you for pointing this out to us.I found one line on the last page that...
       · Appears like there was some problem with on of the pages and seems to have been...
       · I've tried taking the xml example and the code example, placing them on my server...
     

    XML ARTICLES

    - Using Regions with XSL Formatting Objects
    - Using XSL Formatting Objects
    - More Schematron Features
    - Schematron Patterns and Validation
    - Using Schematron
    - Datatypes and More in RELAX NG
    - Providing Options in RELAX NG
    - An Introduction to RELAX NG
    - Path, Predicates, and XQuery
    - Using Predicates with XQuery
    - Navigating Input Documents Using Paths
    - XML Basics
    - Introduction to XPath
    - Simple Web Syndication with RSS 2.0
    - Java UI Design with an IDE







    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 4 Hosted by Hostway
    Stay green...Green IT