Examples of DocumentHandler


Examples of org.springmodules.lucene.index.document.handler.DocumentHandler

   * @see DocumentHandler#getDocument(Map, InputStream)
   * @see FileExtensionNotSupportedException
   */
  public final Document createDocumentFromInputStream(
                            InputStream inputStream) throws Exception {
    DocumentHandler documentHandler = documentHandlerManager.getDocumentHandler(getResourceName());
    if( documentHandler!=null ) {
      Document document = documentHandler.getDocument(getResourceDescription(), inputStream);
      addFields(document);
      return document;
    } else {
      throw new FileExtensionNotSupportedException("No handler for this resource name");
    }
View Full Code Here

Examples of org.springmodules.lucene.index.support.file.DocumentHandler

   * @see DocumentHandler#getDocument(Map, InputStream)
   * @see FileExtensionNotSupportedException
   */
  public final Document createDocumentFromInputStream(
                            InputStream inputStream) throws IOException {
    DocumentHandler documentHandler=documentHandlerManager.getDocumentHandler(getResourceName());
    if( documentHandler!=null ) {
      Document document=documentHandler.getDocument(getResourceDescription(),inputStream);
      addFields(document);
      return document;
    } else {
      throw new FileExtensionNotSupportedException("No handler for this resource name");
    }
View Full Code Here

Examples of org.springmodules.lucene.index.support.file.DocumentHandler

   * @see #doCallHandler(File, FileInputStream, DocumentHandler)
   * @see DocumentIndexingListener
   */
  private void indexFile(IndexWriter writer,File file) throws IOException {
    fireListenersOnBeforeFile(file);
    DocumentHandler handler = getDocumentHandler(file.getPath());
    if( handler!=null ) {
      FileInputStream inputStream=null;
      try {
        inputStream=new FileInputStream(file);
        Document document=doCallHandler(file,inputStream,handler);
View Full Code Here

Examples of org.xml.sax.DocumentHandler

      if ( ! _insideRoot )
    throw new SAXException( Messages.format( "dsml.expectingOpeningTag",
               XML.Namespace.Root, tagName ) );
      if ( tagName.equals( XML.Schema.Element ) ||
     tagName.equals( XML.Entries.Element ) ) {
    DocumentHandler entry;

    entry = getEntryConsumer();
    entry.startElement( tagName, attr );
    _redirect = entry;
      } else {
    throw new SAXException( Messages.format( "dsml.openingTagNotRecognized",
               tagName ) );
      }
View Full Code Here

Examples of org.xml.sax.DocumentHandler

        Parser parser = Configuration.getDefaultParser();
        if (parser == null) {
            throw new SAXException("Unable to create parser");
        }

        DocumentHandler handler = new AttributeInterceptor();
        parser.setDocumentHandler(handler);
        try {
            parser.parse(new InputSource(_reader));
        } catch (IOException exception) {
            throw new SAXException(exception.getMessage(), exception);
View Full Code Here

Examples of org.xml.sax.DocumentHandler

            throw new IOException("Unable to obtain serailizer");
        }

        serializer.setOutputCharStream(writer);

        DocumentHandler handler = serializer.asDocumentHandler();

        if (handler == null) {
            String err = "The following serializer is not SAX capable: ";
            err += serializer.getClass().getName();
            err += "; cannot proceed.";
View Full Code Here

Examples of org.xml.sax.DocumentHandler

            throw new IOException(message);
        }

        serializer.setOutputCharStream(writer);

        DocumentHandler handler = serializer.asDocumentHandler();

        if (handler == null) {
            String err = "The following serializer is not SAX capable: ";
            err += serializer.getClass().getName();
            err += "; cannot proceed.";
View Full Code Here

Examples of org.xml.sax.DocumentHandler

    /**
     * @see org.castor.xml.InternalContext#getSerializer(java.io.OutputStream)
     */
    public DocumentHandler getSerializer(final OutputStream output) throws IOException {
        Serializer serializer;
        DocumentHandler docHandler;

        serializer = getSerializer();
        serializer.setOutputByteStream(output);
        docHandler = serializer.asDocumentHandler();
        if (docHandler == null) {
View Full Code Here

Examples of org.xml.sax.DocumentHandler

    /**
     * @see org.castor.xml.InternalContext#getSerializer(java.io.Writer)
     */
    public DocumentHandler getSerializer(final Writer output) throws IOException {
        Serializer serializer;
        DocumentHandler docHandler;

        serializer = getSerializer();
        serializer.setOutputCharStream(output);
        docHandler = serializer.asDocumentHandler();
        if (docHandler == null) {
View Full Code Here

Examples of org.xml.sax.DocumentHandler

       
        nameClassWriter = createNameClassWriter();       
        // generates SAX events
        try {
            final DocumentHandler handler = writer.getDocumentHandler();
            handler.setDocumentLocator( new LocatorImpl() );
            handler.startDocument();

            // to work around the bug of current serializer,
            // report xmlns declarations as attributes.
           
            if( defaultNs!=null )
                writer.start("grammar",new String[]{
                    "ns",defaultNs,
                    "xmlns",RELAXNGReader.RELAXNGNamespace,
                    "datatypeLibrary", XSDVocabulary.XMLSchemaNamespace });
            else
                writer.start("grammar", new String[]{
                    "xmlns",RELAXNGReader.RELAXNGNamespace,
                    "datatypeLibrary", XSDVocabulary.XMLSchemaNamespace });
           
           
            {// write start pattern.
                writer.start("start");
                writeIsland( g.getTopLevel() );
                writer.end("start");
            }
           
            // write all named expressions
            Iterator itr = exp2name.keySet().iterator();
            while( itr.hasNext() ) {
                Expression exp = (Expression)itr.next();
                String name = (String)exp2name.get(exp);
                if( exp instanceof ReferenceExp )
                    exp = ((ReferenceExp)exp).exp;
                writer.start("define",new String[]{"name",name});
                writeIsland( exp );
                writer.end("define");
            }
           
            writer.end("grammar");
            handler.endDocument();
        } catch( SAXRuntimeException sw ) {
            throw sw.e;
        }
    }
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.