Jump to content

XML


astralaaron
 Share

Recommended Posts

Hello, I am working toward learning about AJAX, and w3schools recommends to learn javascript xml html and cssi am comfortable with css and html.I want to start learning about XML, so.. if anyone can shed some light on what XML is about, why use it? and what kinds of things it can do that would be great :)

Link to comment
Share on other sites

... http://www.w3schools.com/xml/default.aspBut yes, naming it XMLHttpRequest is a bit of a misnomer as it really just loads the document as text.Though for XML developers of course the responseXML property can come in very handy.

Link to comment
Share on other sites

Receiving XML instead of text allows you to have structured data i.e. instead of receiving one big pile of text to process with regular expressions, you can have a few pieces of data which you can jump between with ease. The same applies to JSON, but JSON is parsed into JavaScript object(s), instead of nodes, which may feel less intuitive to you if you like HTML more than JavaScript.

Link to comment
Share on other sites

nodes are XML things that list where they are in the XML document. Thats about the best way i can describe it to you. I'll try to explain it with a bit more example

//assume all of that fun encoding stuff is on the top of this page<notes> <note to="Bob" from="Joey">  <message>	Hey bob, tomorrow we should go clubbin'! 1337 sauce.   </message> </note> <note to="Joey" from="Bob">  <message>   Sure, let's go clubbin'! ROFLCopter!  </message> </note></notes>

The top post parent Node is the tag "notes". "note" tags are child nodes to "notes", i.e., they are the next sublevel down in the XML tree.The first note node is a sibling node to the second note node. the parent node for the message tag, however, would be the corresponding <note> tag which the message tag is in.(calling parentNode from the second message tag would not be the same as calling parentNode from the first basically).I know its probably not a very good definition, but its the best i can give you.

Link to comment
Share on other sites

nodes are XML things that list where they are in the XML document. Thats about the best way i can describe it to you. I'll try to explain it with a bit more example
//assume all of that fun encoding stuff is on the top of this page<notes> <note to="Bob" from="Joey">  <message>	Hey bob, tomorrow we should go clubbin'! 1337 sauce.   </message> </note> <note to="Joey" from="Bob">  <message>   Sure, let's go clubbin'! ROFLCopter!  </message> </note></notes>

The top post parent Node is the tag "notes". "note" tags are child nodes to "notes", i.e., they are the next sublevel down in the XML tree.The first note node is a sibling node to the second note node. the parent node for the message tag, however, would be the corresponding <note> tag which the message tag is in.(calling parentNode from the second message tag would not be the same as calling parentNode from the first basically).I know its probably not a very good definition, but its the best i can give you.

document.getElementById("notes").innerHTML=xmlDoc.getElementsByTagName("note")[0].childNodes[0].nodeValue;document.getElementById("notes").innerHTML=xmlDoc.getElementsByTagName("note")[1].childNodes[0].nodeValue;so i would get both of those messages by doing this???
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...