xmlr5.next();
if (xmlr5.isStartElement()) {
if (xmlr5.getLocalName().equals( "Agency")) {
xmlr5.require(XMLStreamConstants.START_ELEMENT, null, "Agency");
JAXBElement<Agency> agencyJAXB = unmarshaller.unmarshal(xmlr5, Agency.class);
Agency agencyElement = (Agency)agencyJAXB.getValue();
//iterate through all the sites in this agency
for (TSite site : agencyElement.getSite()) {
//Get the Site Key from this Agency
//This is tricky, because of JAXB's automated model creator
for (Serializable content : site.getContent()) {
//for (JAXBElement<?> content : site.getContent()) {
if (content instanceof JAXBElement<?>) {
//How do I know this is key
JAXBElement<?> contentJAXBElement = (JAXBElement<?>)content;
if (contentJAXBElement.getName().getLocalPart().equals("Key")) {
BigInteger siteKey = (BigInteger) ((JAXBElement<?>)content).getValue();
if (siteKey.equals(siteID)) {
agencyKeyLong = agencyElement.getKey().longValue();
break;
}
}
}
}