Examples of SAXParser


Examples of javax.xml.parsers.SAXParser

        spf.setValidating(true);
        XMLReader reader = null;

    // set the features on the parser
    try{
          SAXParser parser = spf.newSAXParser();
          parser.setProperty("http://java.sun.com/xml/jaxp/properties/schemaLanguage", "http://www.w3.org/2001/XMLSchema"); //$NON-NLS-1$ //$NON-NLS-2$
          parser.setProperty("http://java.sun.com/xml/jaxp/properties/schemaSource", nameSpaceMap.keySet().toArray())//$NON-NLS-1$
          reader = parser.getXMLReader();
    } catch (SAXException err) {
            throw new TeiidComponentException(err);
        } catch (ParserConfigurationException err) {
            throw new TeiidComponentException(err);
        }

Examples of javax.xml.parsers.SAXParser

     */
     private HashMap getTargetNameSpaces(Collection<SQLXML> schemas) throws TeiidException {
       HashMap nameSpaceMap = new HashMap();
       SAXParserFactory spf = SAXParserFactory.newInstance();
        spf.setNamespaceAware(true);
        SAXParser parser;
        try {
            parser = spf.newSAXParser();
        } catch (ParserConfigurationException err) {
            throw new TeiidException(err);
        } catch (SAXException err) {
            throw new TeiidException(err);
        }
       PeekContentHandler pch = new PeekContentHandler();
       
       for (SQLXML schema : schemas) {
         InputStream is;
      try {
        is = schema.getBinaryStream();
      } catch (SQLException e) {
        throw new TeiidComponentException(e);
      }
      InputSource source = new InputSource(is);
             pch.targetNameSpace = null;
         try {
                parser.parse(source, pch);
            } catch (SAXException err) {
                throw new TeiidException(err);
            } catch (IOException err) {
                throw new TeiidComponentException(err);
            } finally {

Examples of javax.xml.parsers.SAXParser

    public void parse(ServletContext servletContext)
        throws Exception {
      SAXParserFactory factory = SAXParserFactory.newInstance();
      factory.setNamespaceAware(false);
      factory.setValidating(false);
      SAXParser parser = factory.newSAXParser();
      servletContext.getContextPath();
      InputStream resourceAsStream = null;
      try {
        resourceAsStream = new FileInputStream(servletContext
            .getRealPath("WEB-INF/web.xml"));
        parser.parse(resourceAsStream, this);
      }finally{
        if(resourceAsStream != null)
          resourceAsStream.close();
      }
     

Examples of javax.xml.parsers.SAXParser

    public Set<String> doParse() throws Exception {
      XmlHandler handler = new XmlHandler();
      SAXParserFactory factory = SAXParserFactory.newInstance();
      factory.setNamespaceAware(false);
      factory.setValidating(false);
      SAXParser parser = factory.newSAXParser();
      URL confURL = EntityManagerFactoryHolder.class.getClassLoader()
          .getResource("META-INF/persistence.xml");
      parser.parse(confURL.toString(), handler);
     
      return handler.getUnits();
    }

Examples of javax.xml.parsers.SAXParser

                    factory = ObjectUtils.instantiate("com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl", null);
                } else {
                    factory = SAXParserFactory.newInstance();
                }
                factory.setNamespaceAware(true);
                SAXParser parser = factory.newSAXParser();
                myReader = parser.getXMLReader();
            }
        } catch (Exception e) {
            throw new XQRTException("Creating SAX XMLReader failed", e);
        }
        // setup handlers (requires saxHandler)

Examples of javax.xml.parsers.SAXParser

    public static Configuration buildFromXML( final InputSource input )
        throws Exception
    {
        final SAXParserFactory saxParserFactory = SAXParserFactory.newInstance();
        saxParserFactory.setNamespaceAware( false );
        final SAXParser saxParser = saxParserFactory.newSAXParser();
        final SAXConfigurationHandler handler = new SAXConfigurationHandler();
        saxParser.parse( input, handler );
        return handler.getConfiguration();
    }

Examples of javax.xml.parsers.SAXParser

     * @throws Exception if there's other problem
     */
    public static JxpProcessor getProcessor(InputStream config) throws SAXException, IOException, Exception
    {
        SaxDigesterHandler handler = new SaxDigesterHandler();
        SAXParser parser = SAXParserFactory.newInstance().newSAXParser();
        JxpConfigDigester dig = new JxpConfigDigester();
        handler.addDigester(dig);
        parser.parse(config, handler);
        return dig.getProcessor();
    }

Examples of javax.xml.parsers.SAXParser

                                          boolean namespaceAware) throws Exception {
    SAXParserFactory factory = SAXParserFactory.newInstance();
    factory.setValidating(validating);
    factory.setNamespaceAware(namespaceAware);

    SAXParser parser = factory.newSAXParser();

    return parser.getXMLReader();
  }

Examples of javax.xml.parsers.SAXParser

         SAXParserFactory spf = glob.getSAXParserFactory();
         boolean validate = glob.getProperty().get("javax.xml.parsers.validation", false);
         spf.setValidating(validate);
         //if (log.isLoggable(Level.FINE)) log.trace(ME, "XML-Validation 'javax.xml.parsers.validation' set to " + validate);

         SAXParser sp = spf.newSAXParser();
         XMLReader parser = sp.getXMLReader();

         //parser.setEntityResolver(EntityResolver resolver);
         //parser.setFeature("http://xml.org/sax/features/validation", true);
         //parser.setFeature("http://apache.org/xml/features/validation/schema", true);
         //parser.setFeature("http://apache.org/xml/features/validation/schema-full-checking", true);

Examples of javax.xml.parsers.SAXParser

    if (null != primIS) {

      // get a SAX parser from JAXP layer
      SAXParserFactory factory = SAXParserFactory.newInstance();
      try {
        SAXParser saxParser = factory.newSAXParser();
        MySaxHandler handler = new MySaxHandler( objIS);

        // the work is done here
        saxParser.parse(primIS, handler);

      } catch (ParserConfigurationException e) {
        e.printStackTrace();

      } catch (SAXException se) {
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.