You need to sign in to do that
Don't have an account?
Max Alexander 4
parse XML question
I ned to parse xml that has tags with same name, i have no issues getting any unique ones
i need to extract effectiveFrom date out of mainBusinessPhysicalAddress
here is what i use
however it just pick the first one how do i point it to the second part of XML?
<mainName> <organisationName>Department of Innovation Industry Science and Research</organisationName> <effectiveFrom>2007-12-03</effectiveFrom> </mainName> <mainBusinessPhysicalAddress> <stateCode>ACT</stateCode> <postcode>2600</postcode> <effectiveFrom>2007-12-03</effectiveFrom> <effectiveT o>0001-01-01</effectiveT o> </mainBusinessPhysicalAddress>
i need to extract effectiveFrom date out of mainBusinessPhysicalAddress
here is what i use
if ('effectiveto' == reader.getLocalName()) { if(reader.getEventType() == XmlTag.START_ELEMENT) reader.next(); if(reader.hastext()) { resultRecord.effectiveAdressDate = reader.getText(); }
however it just pick the first one how do i point it to the second part of XML?
String lastParent = '';
if (reader.getLocalName() == 'mainName' || reader.getLocalName()=='mainBusinessPhysicalAddress') {
lastParent = reader.getLocalName();
}
use the last parent
if ('effectiveto' == reader.getLocalName() && lastParent == 'mainBusinessPhysicalAddress')