We are trying to fetch data for this META
TAG - using the following XML
<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.w3.org/2001/12/soap-envelope MIAL_SOAP_AIDX_Flight_Msg.xsd" xmlns:iata="http://www.iata.org/IATA/2007/00" xmlns:p="http://www.ibm.com/xmlns/transportation/airport/meta" xmlns:soap="http://www.w3.org/2001/12/soap-envelope" encodingStyle="http://www.w3.org/2001/12/soap-encoding">
<soap:Header>
<p:Meta>
<p:SNDR>AODB</p:SNDR>
<p:TMST>2011-01-10T11:00:00</p:TMST>
<p:SEQN>25</p:SEQN>
<p:TYPE>FLSH</p:TYPE>
<p:SUBT>DALY</p:SUBT>
</p:Meta>
</soap:Header>
The code is :
public List<Item> readConfig(String configFile) {
List<Item> items = new ArrayList<Item>();
try {
// First create a new XMLInputFactory
XMLInputFactory inputFactory = XMLInputFactory.newInstance();
// Setup a new eventReader
InputStream in = new FileInputStream(configFile);
XMLEventReader eventReader = inputFactory.createXMLEventReader(in);
// Read the XML document
Item item = null;
while (eventReader.hasNext()) {
XMLEvent event = eventReader.nextEvent();
System.out.println("in while:::");
if (event.isStartElement()) {
StartElement startElement = event.asStartElement();
//added
if (startElement.getName().getLocalPart() == (Meta)) {
item = new Item();
if (event.isStartElement()) {
if (event.asStartElement().getName().getLocalPart()
.equals(SUBT)) {
event = eventReader.nextEvent();
item.setSubt(event.asCharacters().getData());
continue;
}
if (event.isEndElement()) {
EndElement endElement = event.asEndElement();
if (endElement.getName().getLocalPart() == (Meta)) {
items.add(item);
}
}
But i am not getting any output. What can i do?