Search in sources :

Example 1 with IDocIllegalTypeException

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;
        }
    }
}
Also used : IDocSegment(com.sap.conn.idoc.IDocSegment) IDocIllegalTypeException(com.sap.conn.idoc.IDocIllegalTypeException) JCoException(com.sap.conn.jco.JCoException) IDocMetaDataUnavailableException(com.sap.conn.idoc.IDocMetaDataUnavailableException) SAXException(org.xml.sax.SAXException)

Aggregations

IDocIllegalTypeException (com.sap.conn.idoc.IDocIllegalTypeException)1 IDocMetaDataUnavailableException (com.sap.conn.idoc.IDocMetaDataUnavailableException)1 IDocSegment (com.sap.conn.idoc.IDocSegment)1 JCoException (com.sap.conn.jco.JCoException)1 SAXException (org.xml.sax.SAXException)1