Examples of XMLInputFactory


Examples of javax.xml.stream.XMLInputFactory

        property.write(m, out, obj, namer, obj, attributes);
        return;
      }

      if (obj instanceof Node) {
        XMLInputFactory factory = _context.getXMLInputFactory();
        DOMSource source = new DOMSource((Node) obj);
        XMLStreamReader in = factory.createXMLStreamReader(source);

        StaxUtil.copyReaderToWriter(in, out);
       
        return;
      }
View Full Code Here

Examples of javax.xml.stream.XMLInputFactory

    private OMElement parseXMLString(String src, boolean coalesced) throws XMLStreamException {
        if (coalesced) {
            return AXIOMUtil.stringToOM(src);
        } else {
            StringReader strReader = new StringReader(src);
            XMLInputFactory xmlInFac = XMLInputFactory.newInstance();
            //Non-Coalescing parsing
            xmlInFac.setProperty("javax.xml.stream.isCoalescing", false);

            XMLStreamReader parser = xmlInFac.createXMLStreamReader(strReader);
            StAXOMBuilder builder = new StAXOMBuilder(parser);
            return builder.getDocumentElement();
        }
    }
View Full Code Here

Examples of javax.xml.stream.XMLInputFactory

        documentContext.setEncoding("UTF-8");
        InputProcessorChainImpl inputProcessorChain = new InputProcessorChainImpl(securityContext, documentContext);
        inputProcessorChain.addProcessor(new EventReaderProcessor());
        XMLSecurityStreamReader xmlSecurityStreamReader = new XMLSecurityStreamReader(inputProcessorChain, securityProperties);

        XMLInputFactory xmlInputFactory = XMLInputFactory.newInstance();
        xmlInputFactory.setProperty(XMLInputFactory.IS_COALESCING, true);
        xmlInputFactory.setProperty(XMLInputFactory.IS_NAMESPACE_AWARE, true);
        XMLStreamReader stdXmlStreamReader =
            xmlInputFactory.createXMLStreamReader(this.getClass().getClassLoader().getResourceAsStream(
                "org/apache/xml/security/c14n/inExcl/plain-soap-1.1.xml"));

        //hmm why does a streamreader return a DOCUMENT_EVENT before we did call next() ??
        int stdXMLEventType = stdXmlStreamReader.getEventType();
        int secXMLEventType = xmlSecurityStreamReader.getEventType();
View Full Code Here

Examples of javax.xml.stream.XMLInputFactory

        if (faultMethod == null) {
            return;
        }
        Object fault = faultMethod.invoke(ex);

        XMLInputFactory inputFactory = XMLInputFactory.newInstance();
        XMLOutputFactory outputFactory = XMLOutputFactory.newInstance();
        outputFactory.setProperty(XMLOutputFactory.IS_REPAIRING_NAMESPACES, Boolean.TRUE);

        ByteArrayOutputStream outStream = new ByteArrayOutputStream();
        XMLEventWriter evtWriter = outputFactory.createXMLEventWriter(outStream);
        writer.write(fault, faultPart, evtWriter);
        LOG.log(Level.INFO, "Found exception in the raises list.  Marshalling.");
        ByteArrayInputStream inStream = new ByteArrayInputStream(outStream.toByteArray());
        XMLEventReader evtReader = inputFactory.createXMLEventReader(inStream);
        CorbaObjectHandler obj = corbaStaxObject.readObjectFromStax(evtReader, exIdlType);
        CorbaStreamable streamable = new CorbaStreamable(obj, elName);
        message.setStreamableException(streamable);
    }
View Full Code Here

Examples of javax.xml.stream.XMLInputFactory

                    orb = (org.omg.CORBA.ORB) message.getExchange().get(org.omg.CORBA.ORB.class);
                }
                corbaStaxObject.setOrb(orb);
                QName elName = new QName("", exStreamable.getName());

                XMLInputFactory inputFactory = getXMLInputFactory();
                XMLOutputFactory outputFactory = getXMLOutputFactory();
               
                ByteArrayOutputStream outStream = new ByteArrayOutputStream();
                XMLEventWriter evtWriter = outputFactory.createXMLEventWriter(outStream);
                corbaStaxObject.writeObjectToStax(exStreamable.getObject(),
                                                  evtWriter,
                                                  XMLEventFactory.newInstance());
                evtWriter.flush();
                ByteArrayInputStream inStream = new ByteArrayInputStream(outStream.toByteArray());
                XMLEventReader evtReader = inputFactory.createXMLEventReader(inStream);
                FaultInfo fault = getFaultInfo(opInfo, elName);
                Object e = reader.read(fault.getMessageParts().get(0), evtReader);
                if (!(e instanceof Exception)) {
                    Class exClass = fault.getProperty(Class.class.getName(), Class.class);
                    Class beanClass = e.getClass();
View Full Code Here

Examples of javax.xml.stream.XMLInputFactory

       
        if (outMessage.getStreamableReturn() != null) {
            MessageInfo msgInfo = opInfo.getOutput();

            // Handle the parameters that are given for the operation
            XMLInputFactory inputFactory = XMLInputFactory.newInstance();
            XMLOutputFactory outputFactory = XMLOutputFactory.newInstance();
            outputFactory.setProperty(XMLOutputFactory.IS_REPAIRING_NAMESPACES,
                                      Boolean.TRUE);       

            ByteArrayOutputStream outStream = new ByteArrayOutputStream();
            XMLEventWriter evtWriter = outputFactory.createXMLEventWriter(outStream);
            CorbaStreamable retVal = outMessage.getStreamableReturn();
            corbaStaxObject.writeObjectToStax(retVal.getObject(), evtWriter,
                                              XMLEventFactory.newInstance());
            evtWriter.flush();
            ByteArrayInputStream inStream = new ByteArrayInputStream(outStream.toByteArray());
            XMLEventReader evtReader = inputFactory.createXMLEventReader(inStream);           
            MessagePartInfo part = getReturnMessagePartInfo(msgInfo);
            retValue = reader.read(part, evtReader);
            List<Object> args = new ArrayList<Object>();
            args.add(retValue);
            message.setContent(List.class, args);
View Full Code Here

Examples of javax.xml.stream.XMLInputFactory

                }
            } else if (param.getMode().equals(ModeType.IN)) {
                skipRead = true;
            }
            if (!skipRead) {
                XMLInputFactory inputFactory = getXMLInputFactory();
                XMLOutputFactory outputFactory = getXMLOutputFactory();
               
                ByteArrayOutputStream outStream = new ByteArrayOutputStream();
                XMLEventWriter evtWriter = outputFactory.createXMLEventWriter(outStream);
                corbaStaxObject.writeObjectToStax(streamables[i].getObject(),
                                                  evtWriter,
                                                  XMLEventFactory.newInstance());
                evtWriter.flush();
                ByteArrayInputStream inStream = new ByteArrayInputStream(outStream.toByteArray());
                XMLEventReader evtReader = inputFactory.createXMLEventReader(inStream);
                MessagePartInfo part = getMessagePartInfo(msgInfo,
                                                          index,
                                                          opType.getReturn() == null,
                                                          isOutput);
                Object partObj = reader.read(part, evtReader);
View Full Code Here

Examples of javax.xml.stream.XMLInputFactory

                                                              CorbaConstants.NT_CORBA_BOOLEAN,
                                                              orb.get_primitive_tc(TCKind.tk_boolean),
                                                              null);
        obj.setValueFromData("false");

        XMLInputFactory inputFactory = XMLInputFactory.newInstance();
        XMLOutputFactory outputFactory = XMLOutputFactory.newInstance();
        outputFactory.setProperty(XMLOutputFactory.IS_REPAIRING_NAMESPACES, Boolean.TRUE);
     
        ByteArrayOutputStream outStream = new ByteArrayOutputStream();
        XMLEventWriter evtWriter = null;
        try {
            evtWriter = outputFactory.createXMLEventWriter(outStream);
        } catch (XMLStreamException ex) {
        }
        assertNotNull(evtWriter);
       
        try {
            XMLEventFactory factory = XMLEventFactory.newInstance();
            StartElement startEl = factory.createStartElement(obj.getName(), null, null);
            evtWriter.add(startEl);
            staxObject.writeObjectToStax(obj, evtWriter, factory);
            EndElement endEl = factory.createEndElement(obj.getName(), null);
            evtWriter.add(endEl);
            evtWriter.flush();
        } catch (XMLStreamException ex) {
           
        }

        ByteArrayInputStream inStream = new ByteArrayInputStream(outStream.toByteArray());       
        XMLEventReader evtReader = null;
        try {           
            evtReader = inputFactory.createXMLEventReader(inStream);
            // read the first tag which should be a start document
            XMLEvent evt = evtReader.nextEvent();
            assertTrue(evt.isStartDocument());
        } catch (XMLStreamException ex) {
        }
View Full Code Here

Examples of javax.xml.stream.XMLInputFactory

            el.setValue(Integer.valueOf(arrayData[i]));
            obj.addElement(el);
            objElements.add(el);
        }
       
        XMLInputFactory inputFactory = XMLInputFactory.newInstance();
        XMLOutputFactory outputFactory = XMLOutputFactory.newInstance();
        outputFactory.setProperty(XMLOutputFactory.IS_REPAIRING_NAMESPACES, Boolean.TRUE);
     
        ByteArrayOutputStream outStream = new ByteArrayOutputStream();
        XMLEventWriter evtWriter = null;
        try {
            evtWriter = outputFactory.createXMLEventWriter(outStream);
        } catch (XMLStreamException ex) {
        }
        assertNotNull(evtWriter);
       
        try {
            XMLEventFactory factory = XMLEventFactory.newInstance();
            StartElement startEl = factory.createStartElement(obj.getName(), null, null);
            evtWriter.add(startEl);
            staxObject.writeObjectToStax(obj, evtWriter, factory);
            EndElement endEl = factory.createEndElement(obj.getName(), null);
            evtWriter.add(endEl);
            evtWriter.flush();
        } catch (XMLStreamException ex) {
           
        }

        ByteArrayInputStream inStream = new ByteArrayInputStream(outStream.toByteArray());       
        XMLEventReader evtReader = null;
        try {           
            evtReader = inputFactory.createXMLEventReader(inStream);
            // read the first tag which should be a start document
            XMLEvent evt = evtReader.nextEvent();
            assertTrue(evt.isStartDocument());
        } catch (XMLStreamException ex) {
        }
View Full Code Here

Examples of javax.xml.stream.XMLInputFactory

        CorbaEnumHandler obj = new CorbaEnumHandler(objName, objIdlType, objTypeCode, enumType);
        assertNotNull(obj);
       
        obj.setValue(enums[1]);
       
        XMLInputFactory inputFactory = XMLInputFactory.newInstance();
        XMLOutputFactory outputFactory = XMLOutputFactory.newInstance();
        outputFactory.setProperty(XMLOutputFactory.IS_REPAIRING_NAMESPACES, Boolean.TRUE);
     
        ByteArrayOutputStream outStream = new ByteArrayOutputStream();
        XMLEventWriter evtWriter = null;
        try {
            evtWriter = outputFactory.createXMLEventWriter(outStream);
        } catch (XMLStreamException ex) {
        }
        assertNotNull(evtWriter);
       
        try {
            XMLEventFactory factory = XMLEventFactory.newInstance();
            staxObject.writeObjectToStax(obj, evtWriter, factory);
            evtWriter.flush();
        } catch (XMLStreamException ex) {
           
        }

        ByteArrayInputStream inStream = new ByteArrayInputStream(outStream.toByteArray());       
        XMLEventReader evtReader = null;
        try {           
            evtReader = inputFactory.createXMLEventReader(inStream);
            // read the first tag which should be a start document
            XMLEvent evt = evtReader.nextEvent();
            assertTrue(evt.isStartDocument());
        } catch (XMLStreamException ex) {
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.