use of com.sap.conn.idoc.IDocIllegalTypeException in project iaf by ibissource.
the class IdocXmlHandler method startElement.
public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
// log.debug("startElement("+localName+")");
if (doc == null) {
log.debug("creating Idoc [" + localName + "]");
try {
doc = JCoIDoc.getIDocFactory().createIDocDocument(sapSystem.getIDocRepository(), localName);
} catch (IDocMetaDataUnavailableException e) {
throw new SAXException("could not create idoc document, idoc meta data unavailable", e);
} catch (JCoException e) {
throw new SAXException("could not create idoc document", e);
}
IDocSegment segment = doc.getRootSegment();
segmentStack.add(segment);
} else {
if (attributes.getIndex("SEGMENT") >= 0) {
if (localName.startsWith("EDI_DC")) {
parsingEdiDcHeader = true;
} else {
log.debug("creating segment [" + localName + "]");
IDocSegment parentSegment = (IDocSegment) segmentStack.get(segmentStack.size() - 1);
IDocSegment segment;
try {
segment = parentSegment.addChild(localName);
} catch (IDocIllegalTypeException e) {
throw new SAXException("could not parse segment, idoc illegal type", e);
} catch (IDocMetaDataUnavailableException e) {
throw new SAXException("could not parse segment, idoc meta data unavailable", e);
}
segmentStack.add(segment);
}
} else {
currentField = localName;
}
}
}
Aggregations