Package javax.xml.stream

Examples of javax.xml.stream.XMLInputFactory.createXMLStreamReader()


                //FIXME - if not woodstox, this will likely not work well
                //likely should copy CXF's W3CDOM stuff
                LOG.info("DOMSource is known to have issues with {0}. We suggest using Woodstox",
                         factory.getClass());
            }
            return factory.createXMLStreamReader(in);
        } finally {
            returnXMLInputFactory(factory);
        }
    }
View Full Code Here


    @Converter
    public XMLStreamReader createXMLStreamReader(String string) throws XMLStreamException {
        XMLInputFactory factory = getInputFactory();
        try {
            return factory.createXMLStreamReader(new StringReader(string));
        } finally {
            returnXMLInputFactory(factory);
        }
    }
   
View Full Code Here

        try {
            // Set up a StreamSource for the composite file, since this has an associated URL that
            // can be used by the parser to find references to other files such as DTDs
            XMLInputFactory inputFactory = XMLInputFactory.newInstance();
            StreamSource wsdlSource = new StreamSource(is, doc.toString());
            XMLStreamReader reader = inputFactory.createXMLStreamReader(wsdlSource);
           
            int eventType = reader.getEventType();
            while (true) {
                if (eventType == XMLStreamConstants.START_ELEMENT) {
                    if (WSDL11_IMPORT.equals(reader.getName())) {
View Full Code Here

        XMLStreamReader reader = mc != null ? mc.getContent(XMLStreamReader.class) : null;
        if (reader == null && mc != null) {
            XMLInputFactory factory = (XMLInputFactory)mc.get(XMLInputFactory.class.getName());
            if (factory != null) {
                try {
                    reader = factory.createXMLStreamReader(is);
                } catch (XMLStreamException e) {
                    throw new WebApplicationException(
                        new RuntimeException("Can not create XMLStreamReader", e));
                }
            }
View Full Code Here

            }
            String stockdata = stockQuoteService.GetQuote(sb.toString());

            InputStream in = new ByteArrayInputStream(stockdata.getBytes());
            XMLInputFactory factory = XMLInputFactory.newInstance();
            XMLStreamReader parser = factory.createXMLStreamReader(in);
            ArrayList<StockQuote> listQuotes = new ArrayList<StockQuote>();
            Hashtable<String, StockQuote> listQuoteHT = new Hashtable<String, StockQuote>();
            MapStock currentStock = null;
            StringBuilder currentText = new StringBuilder(100);
            for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next()) {
View Full Code Here

        inputFactory = dialect.enableCDataReporting(inputFactory);
        inputFactory.setProperty(XMLInputFactory.IS_REPLACING_ENTITY_REFERENCES, Boolean.FALSE);
        XMLOutputFactory outputFactory = dialect.normalize(XMLOutputFactory.newInstance());
        StreamingOMSerializer serializer = new StreamingOMSerializer();
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        XMLStreamReader reader = inputFactory.createXMLStreamReader(new StreamSource(file.getUrl().toString()));
        String encoding = reader.getEncoding();
        XMLStreamWriter writer = outputFactory.createXMLStreamWriter(out, encoding);
        writer.writeStartDocument(encoding, reader.getVersion());
        serializer.serialize(reader, writer, false);
        writer.writeEndDocument();
View Full Code Here

    protected final void runTest() throws Throwable {
        XMLInputFactory factory = staxImpl.getDialect().enableCDataReporting(staxImpl.newNormalizedXMLInputFactory());
        factory.setProperty(XMLInputFactory.IS_REPLACING_ENTITY_REFERENCES, Boolean.FALSE);
        InputStream in = IllegalStateExceptionTestCase.class.getResourceAsStream("alleventtypes.xml");
        try {
            XMLStreamReader reader = factory.createXMLStreamReader(in);
            while (true) {
                if (reader.getEventType() == event) {
                    break;
                } else if (reader.hasNext()) {
                    reader.next();
View Full Code Here

        super(staxImpl);
    }

    protected void runTest() throws Throwable {
        XMLInputFactory factory = staxImpl.newNormalizedXMLInputFactory();
        XMLStreamReader reader = factory.createXMLStreamReader(new StringReader("<root/>"));
        XMLStreamReader originalReader = XMLStreamReaderUtils.getOriginalXMLStreamReader(reader);
        assertSame(staxImpl.getClassLoader(), originalReader.getClass().getClassLoader());
    }
}
View Full Code Here

        super(staxImpl);
    }

    protected void runTest() throws Throwable {
        XMLInputFactory factory = staxImpl.newNormalizedXMLInputFactory();
        XMLStreamReader reader = factory.createXMLStreamReader(new StringReader(
                "<root attr=\"test\"><child xmlns=\"urn:ns\" attr=\"test\"/></root>"));
        int eventType;
        while ((eventType = reader.next()) != XMLStreamReader.END_DOCUMENT) {
            if (eventType == XMLStreamReader.START_ELEMENT) {
                for (int i=0; i<reader.getAttributeCount(); i++) {
View Full Code Here

        super(staxImpl);
    }

    protected void runTest() throws Throwable {
        XMLInputFactory factory = staxImpl.newNormalizedXMLInputFactory();
        XMLStreamReader reader = factory.createXMLStreamReader(
                new StringReader("<?xml version='1.0'?><root/>"));
        assertEquals(false, reader.standaloneSet());
        reader.next();
        try {
            reader.standaloneSet();
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.