Package nz.govt.natlib.fx

Examples of nz.govt.natlib.fx.ParserContext


   
    //holder for the transformed adapter output
    //ByteArrayOutputStream tAdapterOutput = new ByteArrayOutputStream(2048);
   
    // Set up the parser context and listener to hold the adapter output
    ParserContext pContext = new ParserContext();
   
    ParserListener listener= new DTDXmlParserListener(adapterOutput, outDTD == null ? null
        : Config.getInstance().getXMLBaseURL() + "/" + outDTD);
    pContext.addListener(listener);
   
    // Attempt to harvest the metadata.
    try {       
      // Extract the metadata.
      adapter.adapt(file, pContext);
View Full Code Here


    DataAdapter adapter = AdapterFactory.getInstance().getAdapter(file);

    // adapt each file...
    String outDTD = adapter.getOutputType();
    ByteArrayOutputStream bout = new ByteArrayOutputStream(2048);
    ParserContext handler = new ParserContext();

    // fill in some details - to be included in the output...
    handler.setAttribute(ParserContext.FILE_INDEX, fileCount++);
    handler.setAttribute(ParserContext.OBJECT, props
        .getProperty("ID", null));
    handler.setAttribute(ParserContext.PROCESS, props.getProperty("Type",
        null));

    // Set up the handler.
    ParserListener listener = new DTDXmlParserListener(bout, outDTD == null ? null
        : Config.getInstance().getXMLBaseURL() + "/" + outDTD);
    handler.addListener(listener);

    // Adapt the file.
    LogManager.getInstance().logMessage(LogMessage.WORTHLESS_CHATTER, "Starting Adapter");
    adapter.adapt(file, handler);
    LogManager.getInstance().logMessage(LogMessage.WORTHLESS_CHATTER, "Finished adapting");
View Full Code Here

        //TransformProcessor.getInstance(
        //  inDTD, outDTD);
     

      ByteArrayOutputStream bout = new ByteArrayOutputStream(2048);
      ParserContext handler = new ParserContext();
      ParserListener listener = new DTDXmlParserListener(bout,
          outDTD == null ? null : Config.getInstance()
              .getXMLBaseURL()
              + "/" + outDTD);
      handler.addListener(listener);
      adapter.adapt(file, handler);

      transformer.transform(new ByteArrayInputStream(bout.toByteArray()),
          out);
    } finally {
View Full Code Here

    File f = new File(args[0]);

    // Create a ParserContext to listen for Metadata
    // events. We are using a custom listener to extend the
    // behaviour of the standard ones.
    ParserContext ctx = new ParserContext();
    StringBufferXMLParserListener listener = new StringBufferXMLParserListener("bmp.dtd");
    ctx.addListener(listener);
   
    // Attempt to harvest the metadata.
    try {
      // Make sure the Harvester System is initialised.
      Config.getInstance();
View Full Code Here

TOP

Related Classes of nz.govt.natlib.fx.ParserContext

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.