Examples of ToXMLContentHandler


Examples of org.apache.jackrabbit.commons.xml.ToXmlContentHandler

    @Override
    public void exportSystemView(String absPath, OutputStream out, boolean skipBinary, boolean noRecurse)
            throws IOException, RepositoryException {
        try {
            ContentHandler handler = new ToXmlContentHandler(out);
            export(absPath, new SystemViewExporter(this, handler, !noRecurse, !skipBinary));
        } catch (SAXException e) {
            Exception exception = e.getException();
            if (exception instanceof RepositoryException) {
                throw (RepositoryException) exception;
View Full Code Here

Examples of org.apache.jackrabbit.commons.xml.ToXmlContentHandler

    @Override
    public void exportDocumentView(String absPath, OutputStream out, boolean skipBinary, boolean noRecurse)
            throws IOException, RepositoryException {
        try {
            ContentHandler handler = new ToXmlContentHandler(out);
            export(absPath, new DocumentViewExporter(this, handler, !noRecurse, !skipBinary));
        } catch (SAXException e) {
            Exception exception = e.getException();
            if (exception instanceof RepositoryException) {
                throw (RepositoryException) exception;
View Full Code Here

Examples of org.apache.jackrabbit.commons.xml.ToXmlContentHandler

    @Override
    public void exportSystemView(String absPath, OutputStream out, boolean skipBinary, boolean noRecurse)
            throws IOException, RepositoryException {
        try {
            ContentHandler handler = new ToXmlContentHandler(out);
            export(absPath, new SystemViewExporter(this, handler, !noRecurse, !skipBinary));
        } catch (SAXException e) {
            Exception exception = e.getException();
            if (exception instanceof RepositoryException) {
                throw (RepositoryException) exception;
View Full Code Here

Examples of org.apache.jackrabbit.commons.xml.ToXmlContentHandler

    @Override
    public void exportDocumentView(String absPath, OutputStream out, boolean skipBinary, boolean noRecurse)
            throws IOException, RepositoryException {
        try {
            ContentHandler handler = new ToXmlContentHandler(out);
            export(absPath, new DocumentViewExporter(this, handler, !noRecurse, !skipBinary));
        } catch (SAXException e) {
            Exception exception = e.getException();
            if (exception instanceof RepositoryException) {
                throw (RepositoryException) exception;
View Full Code Here

Examples of org.apache.jackrabbit.commons.xml.ToXmlContentHandler

    @Override
    public void exportSystemView(String absPath, OutputStream out, boolean skipBinary, boolean noRecurse)
            throws IOException, RepositoryException {
        try {
            ContentHandler handler = new ToXmlContentHandler(out);
            export(absPath, new SystemViewExporter(this, handler, !noRecurse, !skipBinary));
        } catch (SAXException e) {
            Exception exception = e.getException();
            if (exception instanceof RepositoryException) {
                throw (RepositoryException) exception;
View Full Code Here

Examples of org.apache.jackrabbit.commons.xml.ToXmlContentHandler

    @Override
    public void exportDocumentView(String absPath, OutputStream out, boolean skipBinary, boolean noRecurse)
            throws IOException, RepositoryException {
        try {
            ContentHandler handler = new ToXmlContentHandler(out);
            export(absPath, new DocumentViewExporter(this, handler, !noRecurse, !skipBinary));
        } catch (SAXException e) {
            Exception exception = e.getException();
            if (exception instanceof RepositoryException) {
                throw (RepositoryException) exception;
View Full Code Here

Examples of org.apache.tika.sax.ToXMLContentHandler

    protected XMLResult getXML(InputStream input, Parser parser, Metadata metadata) throws Exception {
      ParseContext context = new ParseContext();
      context.set(Parser.class, parser);

      try {
          ContentHandler handler = new ToXMLContentHandler();
          parser.parse(input, handler, metadata, context);
          return new XMLResult(handler.toString(), metadata);
      } finally {
          input.close();
      }
  }
View Full Code Here

Examples of org.apache.tika.sax.ToXMLContentHandler

                    "writing the text/plain version of the parsed content",e);
            }
            final Writer plainTextWriter = new OutputStreamWriter(plainTextSink.getOutputStream(), UTF8);
            final ContentHandler textHandler = new BodyContentHandler( //only the Body
                new PlainTextHandler(plainTextWriter, false,skipLinebreaks)); //skip ignoreable
            final ToXMLContentHandler xhtmlHandler;
            final ContentHandler mainHandler;
            ContentSink xhtmlSink = null;
            try {
                if(!plainMediaType.equals(XHTML)){ //do not parse XHTML from XHTML
                    try {
                        xhtmlSink = ciFactory.createContentSink(XHTML +"; charset="+UTF8.name());
                    } catch (IOException e) {
                        throw new EngineException("Error while initialising Blob for" +
                                "writing the application/xhtml+xml version of the parsed content",e);
                    }
                    try {
                        xhtmlHandler = new ToXMLContentHandler(xhtmlSink.getOutputStream(),UTF8.name());
                    } catch (UnsupportedEncodingException e) {
                        throw new EngineException("This system does not support the encoding "+UTF8,e);
                    }
                    mainHandler = new MultiHandler(textHandler,xhtmlHandler);
                } else {
View Full Code Here

Examples of org.apache.tika.sax.ToXMLContentHandler

    protected XMLResult getXML(InputStream input, Parser parser, Metadata metadata) throws Exception {
      ParseContext context = new ParseContext();
      context.set(Parser.class, parser);

      try {
          ContentHandler handler = new ToXMLContentHandler();
          parser.parse(input, handler, metadata, context);
          return new XMLResult(handler.toString(), metadata);
      } finally {
          input.close();
      }
  }
View Full Code Here

Examples of org.apache.tika.sax.ToXMLContentHandler

            //set the already parsed contentType
            metadata.set(Metadata.CONTENT_TYPE, mtas.mediaType.toString());
            final StringWriter writer = new StringWriter();
            final ContentHandler textHandler = new BodyContentHandler( //only the Body
                new PlainTextHandler(writer, false,skipLinebreaks)); //skip ignoreable
            final ToXMLContentHandler xhtmlHandler;
            final ContentHandler mainHandler;
            if(!plainMediaType.equals(XHTML)){ //do not parse XHTML from XHTML
                xhtmlHandler = new ToXMLContentHandler();
                mainHandler = new MultiHandler(textHandler,xhtmlHandler);
            } else {
                mainHandler = textHandler;
                xhtmlHandler = null;
            }
            try {
                parser.parse(in, mainHandler, metadata, context);
            } catch (Exception e) {
                throw new EngineException("Unable to convert ContentItem "+
                        ci.getUri()+" with mimeType '"+ci.getMimeType()+"' to "+
                        "plain text!",e);
            }
            IOUtils.closeQuietly(in);
            if(log.isDebugEnabled()){
                log.debug("Plain Content: \n{}",writer.toString());
            }
            String random = randomUUID().toString();
            UriRef textBlobUri = new UriRef("urn:tika:text:"+random);
            ci.addPart(textBlobUri,
                new InMemoryBlob(writer.toString(),
                    TEXT_PLAIN.toString())); //string -> no encoding
            if(xhtmlHandler != null){
                if(log.isDebugEnabled()){
                    log.debug("XML Content: \n{}",xhtmlHandler.toString());
                }
                UriRef xhtmlBlobUri = new UriRef("urn:tika:xhtml:"+random);
                ci.addPart(xhtmlBlobUri,
                    new InMemoryBlob(xhtmlHandler.toString(),
                        "application/xhtml+xml")); //string -> no encoding
            }
            //add the extracted metadata
            if(log.isDebugEnabled()){
                for(String name : metadata.names()){
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.