Extensible Markup Language (XML) : CSE 190 M (Web Programming), Spring 2007
Extensible Markup Language (XML) : CSE 190 M (Web Programming), Spring 2007
Extensible Markup Language (XML) : CSE 190 M (Web Programming), Spring 2007
What is XML?
a specification for creating markup languages to store hierarchical data
used to facilitate sharing data between different systems
XHTML is a subset of XML
a language created using XML specifications
an adaptation of old HTML to fit XML's syntax requirements
tag syntax:
<element attributes>
text or tags
</element>
get an array of all children of the given type ("p", "div", etc.)
can be called on the overall document or on a specific node
element.getAttribute("attributeName")
var p = document.createElement("p");
p.innerHTML = title + ", by " + author;
document.body.appendChild(p);
}
}
<node id="id">
<answer>answer</answer>
</node>
ajaxHelper("http://www.example.com/foo.html", myFunction);
...
function myFunction(ajax) {
alert(ajax.responseText);
}
using this Ajax template, you can handle text or XML data easily
you may want to comment out the error message alert code in the template, depending on how you want to
handle various errors
Ajax code can only be run on a web page stored on a web server
can only fetch files from the same site that the page is on
to test/debug your Ajax code, must upload it to UW web space
Net tab shows each request, its parameters, response, any errors