<!DOCTYPE html PUBLIC "- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>jQuery Demo: Using jQuery With XML</title>
<script type="text/javascript" src="jquery-latest.pack.js"></script>
<script type="text/javascript">
function XmlOnLoad( xmlData, strStatus ){
var jData = $( xmlData );
var jGirl = jData.find( "person[ type = 'girl' ]");
var jSections = jGirl.children();
var jList = $( "#girl" );
jSections.each(
function( intSectionIndex ){
var jSection = $( this );
var jTerm = $( "<dt></dt>" );
jTerm.text( jSection[ 0 ].nodeName );
jList.append( jTerm );
jSection.children().each(
function( intPartIndex ){
var jPart = $( this );
var jDef = $( "<dd></dd>" );
jDef.text(
" - " +
jPart[ 0 ].nodeName + ": " +
jPart.attr( "value" )
);
jList.append( jDef );
}
);
}
);
}
$(
function(){
$.get(
"girl.xml.cfm",
{},
XmlOnLoad
);
}
);
</script>
</head>
<body>
<h1>
jQuery Demo: Using jQuery With XML
</h1>
<dl id="girl"></dl>
</body>
</html>