Examples of SAXParser


Examples of mf.org.apache.xerces.parsers.SAXParser

                        "StreamResultNotInitialized", null));
                }

                // we're using the parser only as an XNI-to-SAX converter,
                // so that we can use the SAX-based serializer
                SAXParser parser = (SAXParser) fParser.get();
                if (newConfig || parser == null) {
                    parser = new SAXParser(config);
                    fParser = new SoftReference(parser);
                }
                else {
                    parser.reset();
                }
                config.setDocumentHandler(fSchemaValidator);
                fSchemaValidator.setDocumentHandler(parser);
                parser.setContentHandler(ser.asContentHandler());
            }
            else {
                fSchemaValidator.setDocumentHandler(null);
            }
           

Examples of net.rim.device.api.xml.parsers.SAXParser

            _tiles.removeAllElements();
            _enemies.removeAllElements();

            // Set up the SAXParser that will parse the XML file
            final SAXParser parser =
                    SAXParserFactory.newInstance().newSAXParser();
            InputStream stream;
            stream =
                    Application.getApplication().getClass()
                            .getResourceAsStream(levelPath);
            final DefaultHandler dh = new LevelSaxHandler(animator);
            parser.parse(stream, dh);
        } catch (final ParserConfigurationException e) {
            SpriteGame.errorDialog(e.toString());
        } catch (final SAXException e) {
            SpriteGame.errorDialog(e.toString());
        } catch (final IOException e) {

Examples of org.apache.cocoon.core.xml.SAXParser

            // TODO: LG, I do not see a good way to do this.
            if (BooleanUtils.isTrue(this.xmlize)) {
                if (val instanceof Node || val instanceof Node[] || val instanceof XMLizable)
                    Invoker.executeNode(consumer, val, stripRoot);
                else {
                    SAXParser parser = executionContext.getSaxParser();
                    InputSource source = new InputSource(new ByteArrayInputStream(val.toString().getBytes()));
                    IncludeXMLConsumer includeConsumer = new IncludeXMLConsumer(consumer);
                    includeConsumer.setIgnoreRootElement(stripRoot);
                    parser.parse(source, includeConsumer);
                }
            } else
                Invoker.executeNode(consumer, val, stripRoot);
        } catch (Exception e) {
            throw new SAXParseException(e.getMessage(), getLocation(), e);

Examples of org.apache.excalibur.xml.sax.SAXParser

        // Guard against calling generate before setup.
        if (!activeFlag) {
            throw new IllegalStateException("generate called on sitemap component before setup.");
        }

        SAXParser parser = null;
        StringWriter w = new StringWriter();
        try {
            parser = (SAXParser) this.manager.lookup(SAXParser.ROLE);
            if (getLogger().isDebugEnabled()) {
                getLogger().debug("Processing File: " + super.source);
            }
            if (!tmplEngineInitialized) {
                tmplEngine.init();
                tmplEngineInitialized = true;
            }
            /* lets render a template */
            this.tmplEngine.mergeTemplate(super.source, velocityContext, w);

            InputSource xmlInput =
                    new InputSource(new StringReader(w.toString()));
            xmlInput.setSystemId(super.source);
            parser.parse(xmlInput, this.xmlConsumer);
        } catch (IOException e) {
            getLogger().warn("VelocityGenerator.generate()", e);
            throw new ResourceNotFoundException("Could not get Resource for VelocityGenerator", e);
        } catch (SAXParseException e) {
            int line = e.getLineNumber();

Examples of org.apache.xerces.parsers.SAXParser

   * @param handler The handler to use for parsing.
   * @throws Exception When parsing failed.
   */
  private void parse(InputStream stream, ContentHandler handler)
      throws Exception {
    SAXParser parser = new SAXParser();
    parser.setContentHandler(handler);

    // Complete list of features of the xerces parser:
    // http://xml.apache.org/xerces2-j/features.html
    parser.setFeature("http://xml.org/sax/features/validation", false);
    parser.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false);

    parser.parse(new InputSource(stream));
  }

Examples of org.apache.xerces.parsers.SAXParser

      InputSource inputSource = createInputSource(context, source);
      if (source == null) {
        throw context.BadParameter("File, InputStream, URL or string expected");
      }

      SAXParser parser = new SAXParser();
      setupParser(context, parser, features);
      handler = new SAXHandler(context, callbacks, userdata);
      parser.setErrorHandler(handler);
      parser.setDTDHandler(handler);
      parser.setEntityResolver(handler);
      parser.setContentHandler(handler);
      parser.parse(inputSource);
      listener = handler.getListener();
      if (listener != null) {
        throw context.XMLError("Parsing failed", listener);
      }
      return Any.create(userdata);

Examples of org.apache.xerces.parsers.SAXParser

    InputStream inputStream = input.openInputStream();
    try {
      InputSource inputSource = new InputSource(inputStream);
      SaxEventAdapter saxEventAdapter = new SaxEventAdapter(input, eventHandler);
      try {
        XMLReader xmlReader = new SAXParser();
        xmlReader.setContentHandler(saxEventAdapter);
        xmlReader.setDTDHandler(saxEventAdapter);
        xmlReader.setEntityResolver(saxEventAdapter);
        xmlReader.setErrorHandler(saxEventAdapter);

        // Enable full namespace handling.
        xmlReader.setFeature("http://xml.org/sax/features/namespaces", true);
        xmlReader.setFeature("http://xml.org/sax/features/namespace-prefixes", true);

        xmlReader.parse(inputSource);
      } catch (SAXException saxException) {
        if (!saxEventAdapter.getExceptionMessages().contains(saxException.getMessage())) {
          eventHandler.add(new SaxAlert(new SourcePosition(input),
                                        Severity.ERROR, saxException));
        }

Examples of org.cyberneko.html.parsers.SAXParser

public class NekoHTMLFilter extends LogDelegator implements Filter {

  @Override
  public String filter(String original) {
    try {
      SAXParser parser = new SAXParser();
      HTMLHandler contentHandler = new HTMLHandler((int)((float)original.length() * 0.66f));
      parser.setContentHandler(contentHandler);
      parser.parse(new InputSource(new StringReader(original)));
      return contentHandler.toString();
    } catch (SAXException e) {
      logError("", e);
      return null;
    } catch (IOException e) {

Examples of org.cyberneko.html.parsers.SAXParser

    }
  }

  public String filter(InputStream in) {
    try {
      SAXParser parser = new SAXParser();
      HTMLHandler contentHandler = new HTMLHandler((int)(1000 * 0.66f));
      parser.setContentHandler(contentHandler);
      parser.parse(new InputSource(in));
      return contentHandler.toString();
    } catch (SAXException e) {
      logError("", e);
      return null;
    } catch (IOException e) {
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.