Package javax.xml.stream

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


    if (sourceClass == null || sourceClass == StreamSource.class) {
      return (T)new StreamSource(getBinaryStream(), this.getStreamFactory().getSystemId());
    } else if (sourceClass == StAXSource.class) {
      XMLInputFactory factory = XMLInputFactory.newInstance();
      try {
        return (T) new StAXSource(factory.createXMLStreamReader(getBinaryStream()));
      } catch (XMLStreamException e) {
        throw new SQLException(e);
      }
    } else if (sourceClass == SAXSource.class) {
      return (T) new SAXSource(new InputSource(getBinaryStream()));
View Full Code Here


  public static Type isXml(Reader reader) throws TransformationException {
    Type type = Type.ELEMENT;
    XMLInputFactory inputFactory = XMLInputFactory.newInstance();
        try{       
             XMLStreamReader xmlReader = inputFactory.createXMLStreamReader(reader);
             int event = xmlReader.getEventType();
           if  (event == XMLEvent.START_DOCUMENT && xmlReader.getLocation().getColumnNumber() != 1) {
             type = Type.DOCUMENT;
           }
             while (xmlReader.hasNext()) {
View Full Code Here

  public static String getEncoding(InputStream is) {
    XMLInputFactory factory = XMLInputFactory.newInstance();
    XMLStreamReader reader;
    try {
      reader = factory.createXMLStreamReader(is);
      return reader.getEncoding();
    } catch (XMLStreamException e) {
      return null;
    } finally {
      try {
View Full Code Here

   
    public void testReader() throws Exception
    {
        XMLInputFactory ifactory = STAXUtils.getXMLInputFactory(null);
        XMLStreamReader reader =
            ifactory.createXMLStreamReader(getClass().getResourceAsStream("/org/codehaus/xfire/util/amazon.xml"));
       
        DepthXMLStreamReader dr = new DepthXMLStreamReader(reader);
       
        STAXUtils.toNextElement(dr);
        assertEquals("ItemLookup", dr.getLocalName());
View Full Code Here

   
    private XMLStreamReader readerForString(String string) throws XMLStreamException
    {
        XMLInputFactory factory = STAXUtils.getXMLInputFactory(null);
        return factory.createXMLStreamReader(new StringReader(string));
    }
}
View Full Code Here

    XMLInputFactory inputFactory = getDefaultInputFactory();
    try {
      synchronized (inputFactory) {
        // Grabbing a lock is necessary for SJSXP, but not for woodstox
        // See http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6365687
        return inputFactory.createXMLStreamReader(baseURI, input);
      }
    } catch (XMLStreamException e) {
      wrapException(e);
      return null; // unreachable
    }
View Full Code Here

   {
      InputStream in = new BufferedInputStream(entityStream, 2048);
      try
      {
         XMLInputFactory factory = XMLInputFactory.newInstance();
         return factory.createXMLStreamReader(in);
      }
      catch (XMLStreamException e)
      {
         throw new ExceptionAdapter(e);
      }
View Full Code Here

            public void report(String message, String errorType, Object relatedInformation, Location location) throws XMLStreamException {
                System.out.println("Error:" + errorType + ", message : " + message);
            }
        });
        try {
            return inputFactory.createXMLStreamReader(stringReader);
        } catch (XMLStreamException ex) {
            Exceptions.printStackTrace(ex);
        }
        return null;
    }
View Full Code Here

                @Override
                public void report(String message, String errorType, Object relatedInformation, Location location) throws XMLStreamException {
                    System.out.println("Error:" + errorType + ", message : " + message);
                }
            });
            xmlReader = inputFactory.createXMLStreamReader(reader);

            while (xmlReader.hasNext()) {

                Integer eventType = xmlReader.next();
                if (eventType.equals(XMLEvent.START_ELEMENT)) {
View Full Code Here

                @Override
                public void report(String message, String errorType, Object relatedInformation, Location location) throws XMLStreamException {
                    System.out.println("Error:" + errorType + ", message : " + message);
                }
            });
            xmlReader = inputFactory.createXMLStreamReader(reader);

            while (xmlReader.hasNext()) {

                Integer eventType = xmlReader.next();
                if (eventType.equals(XMLEvent.START_ELEMENT)) {
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.