Package com.sun.xml.fastinfoset.stax

Examples of com.sun.xml.fastinfoset.stax.StAXDocumentParser


  public OMElement processDocument(InputStream inputStream, String contentType,
      MessageContext messageContext) throws AxisFault {
    if (logger.isDebugEnabled()) {
      logger.debug("Processing a Document with the content type: " + contentType);
    }
    XMLStreamReader streamReader = new StAXDocumentParser(inputStream);
    //OMXMLParserWrapper builder = new StAXOMBuilder(streamReader);
    StAXBuilder builder = new StAXSOAPModelBuilder(streamReader);
    //TODO Check whether we need to perform any validations here...
    return builder.getDocumentElement();
  }
View Full Code Here


        if (_statefulParser != null) {
            _statefulParser.setInputStream(in);
            return _statefulParser;
        } else {
            WSTCPCodecConfigurator configurator = WSTCPCodecConfigurator.INSTANCE;
            StAXDocumentParser parser = configurator.getDocumentParserFactory().newInstance();
            parser.setInputStream(in);
            if (parser instanceof WSTCPFastInfosetStreamReaderRecyclable) {
                ((WSTCPFastInfosetStreamReaderRecyclable) parser).
                        setListener(_readerRecycleListener);
            }
           
            parser.setStringInterning(true);
            if (_retainState) {
                ParserVocabulary vocabulary = configurator.
                        getParserVocabularyFactory().newInstance();
                parser.setVocabulary(vocabulary);
            }
            _statefulParser = parser;
            return _statefulParser;
        }
    }
View Full Code Here

    public static FastInfosetStreamReaderFactory getInstance() {
        return factory;
    }
   
    public XMLStreamReader doCreate(String systemId, InputStream in, boolean rejectDTDs) {
        StAXDocumentParser parser = fetch();
        if (parser == null) {
            return FastInfosetCodec.createNewStreamReaderRecyclable(in, false);
        }
       
        parser.setInputStream(in);
        return parser;
    }
View Full Code Here

    public XMLStreamReader doCreate(String systemId, Reader reader, boolean rejectDTDs) {
        throw new UnsupportedOperationException();
    }
   
    private StAXDocumentParser fetch() {
        StAXDocumentParser parser = pool.get();
        pool.set(null);
        return parser;
    }
View Full Code Here

     * @param retainState if true the parser should retain the state of
     *        vocabulary tables for multiple parses.
     * @return a new {@link StAXDocumentParser} instance.
     */
    /* package */ static StAXDocumentParser createNewStreamReader(InputStream in, boolean retainState) {
        StAXDocumentParser parser = new StAXDocumentParser(in);
        parser.setStringInterning(true);
        if (retainState) {
            /**
             * Create a parser vocabulary external to the parser.
             * This will ensure that the vocabulary will never be cleared
             * for each parse and will be retained (and will grow)
             * for each parse.
             */
            ParserVocabulary vocabulary = new ParserVocabulary();
            parser.setVocabulary(vocabulary);
        }
        return parser;
    }
View Full Code Here

     * @param retainState if true the parser should retain the state of
     *        vocabulary tables for multiple parses.
     * @return a new recyclable {@link StAXDocumentParser} instance.
     */
    /* package */ static StAXDocumentParser createNewStreamReaderRecyclable(InputStream in, boolean retainState) {
        StAXDocumentParser parser = new FastInfosetStreamReaderRecyclable(in);
        parser.setStringInterning(true);
        parser.setForceStreamClose(true);
        if (retainState) {
            /**
             * Create a parser vocabulary external to the parser.
             * This will ensure that the vocabulary will never be cleared
             * for each parse and will be retained (and will grow)
             * for each parse.
             */
            ParserVocabulary vocabulary = new ParserVocabulary();
            parser.setVocabulary(vocabulary);
        }
        return parser;
    }
View Full Code Here

        document.mark(4);
        boolean isFastInfosetDocument = Decoder.isFastInfosetDocument(document);
        document.reset();
       
        if (isFastInfosetDocument) {
            StAXDocumentParser parser = new StAXDocumentParser();
            parser.setInputStream(document);
            SAXEventSerializer ses = new SAXEventSerializer(events);
            StAX2SAXReader reader = new StAX2SAXReader(parser, ses);
            reader.setLexicalHandler(ses);
            reader.adapt();
        } else {
            SAXParserFactory parserFactory = SAXParserFactory.newInstance();
            parserFactory.setNamespaceAware(true);
            SAXParser parser = parserFactory.newSAXParser();
            SAXEventSerializer ses = new SAXEventSerializer(events);
            parser.setProperty(Properties.LEXICAL_HANDLER_PROPERTY, ses);
            parser.parse(document, ses);
        }
    }
View Full Code Here

TOP

Related Classes of com.sun.xml.fastinfoset.stax.StAXDocumentParser

Copyright © 2018 www.massapicom. 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.