Package org.xml.sax

Examples of org.xml.sax.InputSource


       }
      public InputSource resolveEntity (String publicId, String systemId) {
          String xsd = (String)schemaMap.get(systemId);
          if (xsd != null) {
                    StringReader reader = new StringReader(xsd);
                    InputSource source = new InputSource(reader);
                    return source;                    
          }
          return null;
      }
View Full Code Here


      log.debug("Trying to locate [{}] in classpath", fileName);
      try {
        DozerClassLoader classLoader = BeanContainer.getInstance().getClassLoader();
        URL url = classLoader.loadResource(fileName);
        InputStream stream = url.openStream();
        InputSource source = new InputSource(stream);
        source.setPublicId(publicId);
        source.setSystemId(systemId);
        log.debug("Found beanmapping XML Schema [{}] in classpath", systemId);
        return source;
      } catch (Exception ex) {
        log.error("Could not resolve beanmapping XML Schema [" + systemId + "]: not found in classpath", ex);
      }
View Full Code Here

      ParseErrorHandler errHandler = new ParseErrorHandler();
      errHandler.setExitOnError(false);
      XMLReader parser = (XMLReader)Class.forName(parserName).newInstance();
      parser.setFeature("http://xml.org/sax/features/validation",true);
      parser.setErrorHandler(errHandler);
      parser.parse(new InputSource(new ByteArrayInputStream(b)));
      if (errHandler.hasErrors()) {
        return false;
      }
      logger.debug("XML Document is valid!");
      return true;
View Full Code Here

  * @param systemId String system id (not used)
  */
  public InputSource resolveEntity (String publicId, String systemId) {
    logger.debug("Using the IgnoreDTDResolver...");
    StringReader reader = new StringReader("");
    return new InputSource(reader);
  }
View Full Code Here

  {
    final ResourceManager resourceManager = new ResourceManager();
    resourceManager.registerDefaults();

    final ImageMapXmlResourceFactory resourceFactory = new ImageMapXmlResourceFactory();
    final InputSource source = new InputSource();
    source.setCharacterStream(new StringReader(imageMapXml));
    return (ImageMap) resourceFactory.parseDirectly
        (resourceManager, source, null, Collections.EMPTY_MAP);
  }
View Full Code Here

  public void testSimpleReportDefinition () throws IOException, ResourceException
  {
    String report = "<report></report>";
    StringReader reader = new StringReader(report);
    final InputSource source = new InputSource();
    source.setCharacterStream(reader);
    assertNotNull(ReportGenerator.getInstance().parseReport(source, new File("/tmp").toURL()));
  }
View Full Code Here

  public void testExtendedReportDefinition () throws IOException, ResourceException
  {
    String report = "<report-definition></report-definition>";
    StringReader reader = new StringReader(report);
    final InputSource source = new InputSource();
    source.setCharacterStream(reader);
    assertNotNull(ReportGenerator.getInstance().parseReport(source, new File("/tmp").toURL()));
  }
View Full Code Here

        rc.convertReport(url, url,
            new OutputStreamWriter (bo, "UTF-16"), "UTF-16");
        final byte[] buf = bo.toByteArray();
        final String s = new String(buf, "UTF-16");
        final ByteArrayInputStream bin = new ByteArrayInputStream(buf);
        ReportGenerator.getInstance().parseReport(new InputSource(bin), url);
      }
      catch (Exception e)
      {
        logger.debug("Failed to write or parse " + url, e);
        logger.debug (bo.toString("UTF-16"));
View Full Code Here

      }

      try
      {
        final ByteArrayInputStream bin = new ByteArrayInputStream(bo.toByteArray());
        ReportGenerator.getInstance().parseReport(new InputSource(bin), url);
      }
      catch (Exception e)
      {
        logger.debug("Failed to (re)parse " + url, e);
        logger.debug (bo.toString("UTF-16"));
View Full Code Here

public class SourceTypeTest extends AbstractXFireAegisTest
{
    public void testSAX() throws Exception
    {
        InputSource is = new InputSource(getResourceAsStream("test.xml"));
        SAXSource s = new SAXSource(is);
       
        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        XMLStreamWriter writer = XMLOutputFactory.newInstance().createXMLStreamWriter(bos);
        writer.writeStartDocument();
View Full Code Here

TOP

Related Classes of org.xml.sax.InputSource

Copyright © 2018 www.massapicom. 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.