Currently I have XML in the following format:
-<collection>
-<beanRepresentation>
<beanRepName>1</beanRepName>
-<group>
</group>
-<relationships>
<inputBeanId>1</inputBeanId>
<outputBeanId>2</outputBeanId>
</relationships>
-<relationships>
<inputBeanId>1</inputBeanId>
<outputBeanId>3</outputBeanId>
</relationships>
</beanRepresentation>
</beanRepresentation>
<beanRepresentation>
<collection>
I want to loop through each <beanRepresentation>'s and get the <outputBeanId>. Right now my code works when there is ONLY ONE <relationships>, but the above XML, has two <relationships>'s. and I need to go in and get BOTH of the <outputBeanId>'s so I can put them into my function connectPort().
$(window).load(function(){
var $xml = $(xmlDoc);
$xml.find('beanRepresentation').has('outputBeanId').has('inputBeanId').each(function () {
var $br = $(this);
connectPort($br.find('beanRepName').text(), $br.find('outputBeanId').text());
})
});
This only works when is there only one <relationships>, how do I add a loop in here so I can get N amount of <relationships> to work.
beanRepIdin your XML but your try to find it in the jquery code..