Using jQuery and JavaScript, how do I distinguish between two XML levels
that have the same Name attr?
So this is an example Documentation.XML file of what I am trying to parse
using jQuery
<DocPortal Version="">
<Folder Name="Sample Drawings" User="*">
<File Type="TILES" Name="Sample1" FileName="Sample1.zip"/>
</Folder>
<Folder Name="Sample Site Information" User="*">
<Folder Name="SampleInnerFolder1" User="*">
<File Type="PDF" Name="Sample1" FileName="Sample1.pdf"/>
<File Type="PDF" Name="Sample2" FileName="Sample2.pdf"/>
</Folder>
<Folder Name="SampleInnerFolder2" User="*">
<File Type="PDF" Name="Sample1" FileName="Sample1.pdf"/>
<File Type="PDF" Name="Sample2" FileName="Sample2.pdf"/>
</Folder>
<File Type="PDF" Name="Sample1" FileName="Sample2.pdf" QR=""/>
<File Type="PDF" Name="Sample2" FileName="Sample2.pdf" QR=""/>
</Folder>
</DocPortal>
When I perform the following code, I get a list of all Folder names in
both levels
$.get(lDocumentationFilePath , function(data){
$('#content').empty();
$(data).find('Folder').each(function(){
var $Folder = $(this);
console.log($Folder.attr('Name'));
});
});
What I want is just a list of each of the top-level Folder Names. So just
"Sample Drawings" and "Sample Site Information".
Any ideas?
No comments:
Post a Comment