I'm using a XML file like this:
<Test>
<Unit>
<Title>Test 1</Title>
<Date>01/07/2011</Date>
<Content format="html"><![CDATA[Here goes some content]]></Content>
</Unit>
<Unit>
<Title>Testing New XML</Title>
<Date>27/06/2011</Date>
<Content format="html"><![CDATA[Here goes some content]]></Content>
</Unit>
<!-- A lot of stuff like this -->
</Test>
I want to use jQuery to search on the XML document for a <Title> given and get its entire <Unit>, so I can work with the values like this:
function append(title, date, content) {
$("#Unit").append("<h1 id='title'><b>" + title + "</b></h1><h2 id='date'>" + date + "</h2><p>" + content + "</p>");
}
How can I do this?
PS: I've been using this as the base of my XML reading
Title? Your function doesn't even accept a parameter to make that work. How are your HTML and XML documents related?