了解通用客户端接口的实现中的问题

时间:2018-06-13 14:22:40

标签: java xml adapter jdeveloper saxparser

我是XML新手,但我被要求将DOMParser实现替换为SAXParser。我提到了一些关于XML解析器的教程,尽管如此,我还是无法理解这里实现的内容。

    import javax.xml.transform.dom.DOMSource;
    import javax.xml.transform.sax.SAXSource;
    import org.w3c.dom.Document;
    import org.xml.sax.InputSource;

    import oracle.xml.parser.v2.DOMParser;
    import oracle.xml.parser.v2.SAXParser;
    import oracle.tip.adapter.api.record.XMLRecordFactory;
    import oracle.tip.adapter.fw.record.XMLRecordFactoryImpl;
    import oracle.tip.adapter.api.record.XMLRecord;
    import oracle.tip.adapter.api.record.RecordElement;
    DOMSource payloadData = getAsDOMSource(xmlPayload);     

    XMLRecordFactory xmlRecordFactory = new XMLRecordFactoryImpl();
    XMLRecord result = xmlRecordFactory.createXMLRecord();

    RecordElement headersRecordElement = xmlRecordFactory.createHeaderRecordElement();
    RecordElement payloadRecordElement = xmlRecordFactory.createPayloadRecordElement();

    payloadRecordElement.setData(payloadData);
    result.setHeaderRecordElement(headersRecordElement);
    result.setPayloadRecordElement(payloadRecordElement);

请帮助解决,概述就够了,我会尝试其余的。

0 个答案:

没有答案