Examples of XMLReader


Examples of org.xml.sax.XMLReader

    boolean validating = JRProperties.getBooleanProperty(JRProperties.EXPORT_XML_VALIDATION);   
    saxParserFactory.setValidating(validating);

    SAXParser saxParser = saxParserFactory.newSAXParser();
    //XMLReader xmlReader = XMLReaderFactory.createXMLReader();
    XMLReader xmlReader = saxParser.getXMLReader();

    xmlReader.setFeature("http://xml.org/sax/features/validation", validating);

    JRXmlDigester digester = new JRXmlDigester(xmlReader);
    digester.push(this);
    //digester.setDebug(3);
    digester.setErrorHandler(this);
View Full Code Here

Examples of org.xml.sax.XMLReader

      try
      {
         InputSource input = new InputSource(is);
         input.setSystemId(file.toURI().toString());
         XMLReader reader = XMLReaderFactory.createXMLReader();
         reader.setEntityResolver(new JBossEntityResolver());
         SAXSource source = new SAXSource(reader, input);
         JAXBElement<ManagedConnectionFactoryDeploymentGroup> elem = um.unmarshal(source, ManagedConnectionFactoryDeploymentGroup.class);
         ManagedConnectionFactoryDeploymentGroup deployment = elem.getValue();
         repository.addManagedConnectionFactoryDeploymentGroup(deployment);
         return deployment;
View Full Code Here

Examples of org.xml.sax.XMLReader

        is.setByteStream(in);
        is.setSystemId(url);
        SAXParserFactory factory = SAXParserFactory.newInstance();
        factory.setNamespaceAware(false);
        factory.setValidating(false);
        XMLReader reader = factory.newSAXParser().getXMLReader();
        reader.setEntityResolver(new LocalTaglibDtds());
        reader.setContentHandler(handler);
        reader.setErrorHandler(handler);
        reader.parse(is);
    }
View Full Code Here

Examples of org.xml.sax.XMLReader

      // Get resource
      URL url = Thread.currentThread().getContextClassLoader().getResource(resource);
      // The input source
      InputSource input = new InputSource(url.openStream());
      input.setSystemId(url.toURI().toString());
      XMLReader reader = XMLReaderFactory.createXMLReader();
      reader.setEntityResolver(new JBossEntityResolver());
      SAXSource source = new SAXSource(reader, input);
      // New JAXB context
      JAXBContext context = JAXBContext.newInstance(ManagedConnectionFactoryDeploymentGroup.class);
      Unmarshaller um = context.createUnmarshaller();
      // Unmarshal
View Full Code Here

Examples of org.xml.sax.XMLReader

      SAXParserFactory factory = getParserFactory();

      factory.setNamespaceAware(true);

      XMLReader parser = factory.newSAXParser().getXMLReader();
      parser.setEntityResolver(xmlCatalog);

      Mapping mapping = new Mapping();
      mapping.loadMapping(new InputSource(ExtendedGrammar.class.getResource("mapping.xml")
                                                               .openStream()));
View Full Code Here

Examples of org.xml.sax.XMLReader

  {
    SAXParserFactory parserfactory = getParserFactory();

    parserfactory.setNamespaceAware(true);

    XMLReader parser = parserfactory.newSAXParser().getXMLReader();

    parser.setEntityResolver(xmlCatalog);

    parser.setContentHandler(this.parser);
    try
    {
      parser.parse(inFile.toString());
    }
    catch (SAXParseException se)
    {
      throw new BuildException("Exception occurs during parsing file "+inFile+" at line "+
                               se.getLineNumber()+" column "+se.getColumnNumber(), se);
View Full Code Here

Examples of org.xml.sax.XMLReader

    try
    {
      final CdaResponseParser contentHandler = new CdaResponseParser();
      final SAXParserFactory factory = SAXParserFactory.newInstance();
      final SAXParser parser = factory.newSAXParser();
      final XMLReader reader = parser.getXMLReader();

      try
      {
        reader.setFeature("http://xml.org/sax/features/xmlns-uris", false);
      }
      catch (SAXException e)
      {
        // ignored
      }
      try
      {
        reader.setFeature("http://xml.org/sax/features/namespaces", false);
        reader.setFeature("http://xml.org/sax/features/namespace-prefixes", false);
      }
      catch (final SAXException e)
      {
        logger.warn("No Namespace features will be available. (Yes, this is serious)", e);
      }

      reader.setContentHandler(contentHandler);
      reader.parse(new InputSource(postResult));

      return (contentHandler.getResult());
    }
    catch (final ParserConfigurationException e)
    {
View Full Code Here

Examples of org.xml.sax.XMLReader

    // Create factory for SAX parser
    SAXParserFactory parserFactoryImpl = SAXParserFactory.newInstance();
    parserFactoryImpl.setNamespaceAware(true);

    // Get a SAX parser
    XMLReader xmlparser = parserFactoryImpl.newSAXParser().getXMLReader();

    // Create a lexicon model for a given lexicon file
    LexiconFactory lexiconfactory = new LexiconFactory();
    xmlparser.setContentHandler(lexiconfactory);
    xmlparser.parse(lexiconFile.toString());

    Lexicon lexicon = lexiconfactory.getLexicon();

    // Build a automaton from the lexicon model
    LexicalAutomaton lexicalautomaton =
      (new LexicalAutomatonBuilder(lexicon, log)).getLexicalAutomaton();

    // Create a processor for the lexicon
    LexicalProcessor lexer = new LexicalProcessor();
    lexer.setLog(log);
    lexer.setLexicalAutomaton(lexicalautomaton);

    // Get a SAX parser
    xmlparser = parserFactoryImpl.newSAXParser().getXMLReader();

    // Create a grammar model for a given grammar file
    GrammarFactory grammarfactory = new GrammarFactory();
    xmlparser.setContentHandler(grammarfactory);
    xmlparser.parse(grammarFile.toString());

    Grammar grammar = grammarfactory.getGrammar();

    // Build a automaton from the grammar model
    ParserAutomaton parserautomaton =
View Full Code Here

Examples of org.xml.sax.XMLReader

        } else if (validate.equals("relaxng")) {
          if (schema == null) throw new UsageException(
              "Missing required argument --schema");
          return builderPool.getMSVBuilder(schema.toURI());
        } else if (validate.equals("html")) {
          XMLReader parser;
          try {
            parser = (XMLReader) Class.forName("org.ccil.cowan.tagsoup.Parser").newInstance();
          } catch (Exception e) {
            throw new UsageException(e);
          }
View Full Code Here

Examples of org.xml.sax.XMLReader

  {
    SAXParserFactory factory = SAXParserFactory.newInstance();

    factory.setNamespaceAware(true);

    XMLReader parser = factory.newSAXParser().getXMLReader();

    GrammarFactory handler = new GrammarFactory();
    parser.setContentHandler(handler);
    parser.parse(new InputSource(getClass().getResourceAsStream("java.xgrm")));

    Grammar grammar = handler.getGrammar();

    Automaton collection = new Automaton(grammar,  /*firstsets,*/
                                         null);
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.