Examples of XMLInputFactory


Examples of javax.xml.stream.XMLInputFactory

            Class<T> sourceClass) throws SQLException {

        StAXSource      source      = null;
        Constructor     sourceCtor  = null;
        Reader          reader      = null;
        XMLInputFactory factory     = null;
        XMLEventReader  eventReader = null;

        try {
            factory = XMLInputFactory.newInstance();
        } catch (FactoryConfigurationError ex) {
            throw Exceptions.sourceInstantiation(ex);
        }

        try {
            sourceCtor =
                (sourceClass == null)
                ? StAXSource.class.getConstructor(XMLEventReader.class)
                : sourceClass.getConstructor(XMLEventReader.class);
        } catch (SecurityException ex) {
            throw Exceptions.sourceInstantiation(ex);
        } catch (NoSuchMethodException ex) {
            throw Exceptions.sourceInstantiation(ex);
        }
        reader = getCharacterStreamImpl();

        try {
            eventReader = factory.createXMLEventReader(reader);
        } catch (XMLStreamException ex) {
            throw Exceptions.sourceInstantiation(ex);
        }

        try {
View Full Code Here

Examples of javax.xml.stream.XMLInputFactory

        System.exit(0);
    }
   
   
    public static XMLInputFactory configureStaxFactory() throws IllegalArgumentException, FactoryConfigurationError {
        XMLInputFactory factory_d = TestXml.configureStaxFactory();
        final String REPORT_CDATA = "http://java.sun.com/xml/stream/properties/report-cdata-event";
        //Boolean enableCdataReport = Boolean.FALSE;
        Boolean enableCdataReport = Boolean.TRUE;
        try {
            factory_d.setProperty(REPORT_CDATA, enableCdataReport);
        } catch(IllegalArgumentException e) {
            System.out.println("WARNING: property "+REPORT_CDATA+" not supported");
            e.printStackTrace();
        }
        return factory_d;
View Full Code Here

Examples of javax.xml.stream.XMLInputFactory

    System.setProperty("javax.xml.stream.XMLInputFactory",
                       "com.bea.xml.stream.MXParserFactory");
    System.setProperty("javax.xml.stream.XMLEventFactory",
                       "com.bea.xml.stream.EventFactory");

    XMLInputFactory factory = XMLInputFactory.newInstance();
    XMLEventReader xmlr = factory.createXMLEventReader(new java.io.FileReader(args[0]));
   
    while(xmlr.hasNext()) {
      XMLEvent e = xmlr.nextEvent();
      System.out.println("["+
                         ElementTypeNames.getEventTypeString(e.getEventType())
View Full Code Here

Examples of javax.xml.stream.XMLInputFactory

        }
        System.exit(0);
    }
   
    public static void parseWithSTAX(String sampleXML) throws FactoryConfigurationError {
        XMLInputFactory factory_d = configureStaxFactory();
        parseWithSTAX(sampleXML, configureStaxFactory());
    }
View Full Code Here

Examples of javax.xml.stream.XMLInputFactory

            e.printStackTrace();
        }
    }
   
    public static XMLInputFactory configureStaxFactory() throws IllegalArgumentException, FactoryConfigurationError {
        XMLInputFactory factory_d = XMLInputFactory.newInstance();
        factory_d.setProperty("javax.xml.stream.isValidating", Boolean.FALSE);
        factory_d.setProperty("javax.xml.stream.isCoalescing", Boolean.TRUE);
        factory_d.setProperty("javax.xml.stream.isNamespaceAware", Boolean.FALSE);
        return factory_d;
    }
View Full Code Here

Examples of javax.xml.stream.XMLInputFactory

abstract class BaseTestForDTD extends BaseStreamTest
{
    protected XMLStreamReader getDTDAwareReader(String contents, boolean validate)
        throws XMLStreamException
    {
        XMLInputFactory f = getInputFactory();
        setCoalescing(f, false);
        setNamespaceAware(f, true);
        setSupportDTD(f, true);
        // Let's make sure DTD is really parsed?
        setValidating(f, validate);
View Full Code Here

Examples of javax.xml.stream.XMLInputFactory

    }

    protected XMLStreamReader getValidatingReader(String contents, boolean nsAware)
        throws XMLStreamException
    {
        XMLInputFactory f = getValidatingFactory(nsAware);
        return constructStreamReader(f, contents);
    }
View Full Code Here

Examples of javax.xml.stream.XMLInputFactory

    }

    protected XMLInputFactory getValidatingFactory(boolean nsAware)
        throws XMLStreamException
    {
        XMLInputFactory f = getInputFactory();
        setCoalescing(f, false); // shouldn't really matter
        setNamespaceAware(f, nsAware);
        setSupportDTD(f, true);
        // Let's make sure DTD is really parsed?
        setValidating(f, true);
View Full Code Here

Examples of javax.xml.stream.XMLInputFactory

   
    private BasicStreamReader getReader(String contents, boolean replEntities,
                                        boolean treatCharRefsAsEnts, int minTextSegment)
        throws XMLStreamException
    {
        XMLInputFactory f = getConfiguredFactory(replEntities, treatCharRefsAsEnts, minTextSegment);
        return (BasicStreamReader) constructStreamReader(f, contents);
    }
View Full Code Here

Examples of javax.xml.stream.XMLInputFactory

   
    private XMLInputFactory getConfiguredFactory(boolean replEntities, boolean treatCharRefsAsEnts,
                                                 int minTextSegment)
        throws XMLStreamException
    {
        XMLInputFactory f = getInputFactory();
        setValidating(f, false);
        setReplaceEntities(f, replEntities);
        setTreatCharRefsAsEnts(f, treatCharRefsAsEnts);
        setMinTextSegment(f, minTextSegment);
        return f;
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.