Hi

I'm a newbie to AXIOM. Appreciate your help in answering my questions below.

I'd like to parse a huge file without building complete object model (linked 
list of OM elements) in memory i.e., I don't want the effect of going back in 
the stream and reading elements.

I have following file structure:

<Soap-Envelope>
  <Soap-Header>
    ....
  </Soap-Header>

  <Soap-Body>
    <batch-request>
      <addRequest>
         ......
      </addRequest>

      <addRequest>
           <!--  thousands of addRequests here. I'd like to parse each 
addRequest one at a time without preserving OM elements of previous and 
subsequent elements  >
      <addRequest>

    </batch-request>
  </Soap-Body>
</Soap-Envelope>

I have following questions:

1. During my analysis, I found out that whenever I use an Iterator, as in the 
code snippet below, to get a childElement using iterator.next(), AXIOM builds a 
link list of all child elements (OM Element) i.e., whole document is parsed and 
OM elements are created in memory.

.....
QName qName = new QName("http://schemas.xmlsoap.org/soap/envelope";, "Body", 
"soap"); Iterator itr = soapEnvelope.getChildrenWithName(qName);
while(itr.hasNext()) {
   OMElement element = (OMElement) itr.next(); }

However, when I used StAXSOAPModelBuilder to extract SOAPEnvelope, SOAPElement, 
SOAPBody it is able to build without parsing the whole file. Following code 
does not build complete object model:

 StAXSOAPModelBuilder builder = new StAXSOAPModelBuilder(parser, 
"http://schemas.xmlsoap.org/soap/envelope/";);
            QName soapHeaderQName = new 
QName("http://schemas.xmlsoap.org/soap/envelope/";, "Header");
            SOAPEnvelope envelope = (SOAPEnvelope) builder.getDocumentElement();
            SOAPHeader soapHeader = envelope.getHeader();

            QName soapBodyQName = new 
QName("http://schemas.xmlsoap.org/soap/envelope/";, "Body");
            SOAPBody soapBody = envelope.getBody();
            OMElement elem = soapBody.getFirstElement();


2. What is the best way to parse above SOAP file one addRequest at a time 
without building OM elements for previous/subsequent addRequests? I cannot use 
SOAP builder as I have some XML files which are not SOAP based.

thanks
Chandru Ganesan
HP Select Identity
972.497.2403 (Work)
3000 Waterview Pkwy
Richardson TX 75080


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to