Examples of DefaultHandler


Examples of org.xml.sax.helpers.DefaultHandler

                }
                parser = factory.newSAXParser();
            }

            // Generate the default handler to process the metadata
            DefaultHandler handler = null;
            EntityResolver entityResolver = null;
            try
            {
                entityResolver = EntityResolverFactory.getInstance(mgr.getNucleusContext().getPluginManager(),
                    handlerName);
View Full Code Here

Examples of org.xml.sax.helpers.DefaultHandler

            ;

        SAXParserFactory spf = new WstxSAXParserFactory();
        spf.setNamespaceAware(true);
        SAXParser sp = spf.newSAXParser();
        DefaultHandler h = new DefaultHandler();

        /* First: let's verify that we get an exception for
         * unresolved reference...
         */
        try {
            sp.parse(new InputSource(new StringReader(XML)), h);
        } catch (SAXException e) {
            verifyException(e, "No such file or directory");
        }

        // And then with dummy resolver; should work ok now
        sp = spf.newSAXParser();
        sp.getXMLReader().setEntityResolver(new MyResolver("   "));
        h = new DefaultHandler();
        try {
            sp.parse(new InputSource(new StringReader(XML)), h);
        } catch (SAXException e) {
            fail("Should not have failed with entity resolver, got ("+e.getClass()+"): "+e.getMessage());
        }
View Full Code Here

Examples of org.xml.sax.helpers.DefaultHandler

  // Save the reference to the transformer
  _transformer = transformer;

  if (transformer.isIdentity()) {
      // Set initial handler to the empty handler
      _handler = new DefaultHandler();
      _isIdentity = true;
  }
  else {
      // Get a reference to the translet wrapped inside the transformer
      _translet = _transformer.getTranslet();
View Full Code Here

Examples of org.xml.sax.helpers.DefaultHandler

            throws ParserConfigurationException, SAXException, IOException {
        DocumentBuilder docBuilder = BUILDER_FACTORY.newDocumentBuilder();

        // Set an error handler to prevent parsers like Xerces
        // from printing error messages to standard output!
        docBuilder.setErrorHandler(new DefaultHandler());

        return docBuilder.parse(stream);
    }
View Full Code Here

Examples of org.xml.sax.helpers.DefaultHandler

   
    /** Creates a new instance of XmlRecordInput */
    public XmlRecordInput(InputStream in) {
      try{
        valList = new ArrayList();
        DefaultHandler handler = new XMLParser(valList);
        SAXParserFactory factory = SAXParserFactory.newInstance();
        SAXParser parser = factory.newSAXParser();
        parser.parse(in, handler);
        vLen = valList.size();
        vIdx = 0;
View Full Code Here

Examples of org.xml.sax.helpers.DefaultHandler

            }
            project.log("parsing buildfile " + buildFileName + " with URI = "
                        + uri + (zf != null ? " from a zip file" : ""),
                        Project.MSG_VERBOSE);

            DefaultHandler hb = handler;

            parser.setContentHandler(hb);
            parser.setEntityResolver(hb);
            parser.setErrorHandler(hb);
            parser.setDTDHandler(hb);
View Full Code Here

Examples of org.xml.sax.helpers.DefaultHandler

                return null;
            }

            @Override
            protected ContentHandler createContentHandler() {
                return new DefaultHandler();
            }
        };
    }
View Full Code Here

Examples of org.xml.sax.helpers.DefaultHandler

    public GCModel read() throws IOException {
        if (LOG.isLoggable(Level.INFO)) LOG.info("Reading IBM J9 5.0 format...");
        try {
            final GCModel model = new GCModel();
            model.setFormat(GCModel.Format.IBM_VERBOSE_GC);          
            DefaultHandler handler = new IBMJ9SAXHandler(model);

            // Use the default (non-validating) parser
            SAXParserFactory factory = SAXParserFactory.newInstance();
            factory.setValidating(false);
           
View Full Code Here

Examples of org.xml.sax.helpers.DefaultHandler

    public void test_adapted_methods() throws Exception {
        final Attributes attrs = new AttributesImpl();
        final char[] characters = new char[0];
        final char[] whitespace = new char[0];
       
        DefaultHandler adapter = new ContentHandlerAdapter(handler);
        adapter.setDocumentLocator(locator);
        adapter.startDocument();
        adapter.startPrefixMapping("prefix", "uri");
        adapter.endPrefixMapping("prefix");
        adapter.startElement("uri", "localName", "qName", attrs);
        adapter.endElement("uri", "localName", "qName");
        adapter.characters(characters, 1, 2);
        adapter.ignorableWhitespace(whitespace, 3, 4);
        adapter.processingInstruction("target", "data");
        adapter.skippedEntity("name");
        adapter.endDocument();

        verify(handler).setDocumentLocator(locator);
        verify(handler).startDocument();
        verify(handler).startPrefixMapping("prefix", "uri");
        verify(handler).endPrefixMapping("prefix");
View Full Code Here

Examples of org.xml.sax.helpers.DefaultHandler

  /*
   * Returns a DefaultHandler that really doesn't anything.
   */
  private DefaultHandler getValidDefaultHandler() {
    return new DefaultHandler();
  }
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.