Package org.xml.sax.helpers

Examples of org.xml.sax.helpers.DefaultHandler


    final Metadata metadata = new Metadata();
    AutoDetectParser parser = TikaResource.createParser();
    TikaResource.fillMetadata(parser, metadata, httpHeaders);
    TikaResource.logRequest(logger, info, metadata);

    parser.parse(is, new DefaultHandler(), metadata);

    return new StreamingOutput() {
      public void write(OutputStream outputStream) throws IOException, WebApplicationException {
        metadataToCsv(metadata, outputStream);
      }
View Full Code Here


            Schema theSchema = getSchema(cls);
            if (theSchema != null) {
                marshaller.setEventHandler(eventHandler);
                marshaller.setSchema(theSchema);
                if (validateBeforeWrite) {
                    marshaller.marshal(obj, new DefaultHandler());
                    marshaller.setSchema(null);
                }
            }
        }
    }
View Full Code Here

        OutputStreamWriter writer =
            new OutputStreamWriter(out);

        try {
            Marshaller marshaller =
                new Marshaller(new DefaultHandler()); //serializer.asDocumentHandler());
            marshaller.setMapping(getCastorMapping());
            marshaller.marshal(object);
        } catch(IOException io) {
            throw io;
        } catch (Exception e) {
View Full Code Here

            result.setEntityResolver(this);

            if (isValidating())
            {
                // register an error handler which detects validation errors
                result.setErrorHandler(new DefaultHandler()
                {
                    public void error(SAXParseException ex) throws SAXException
                    {
                        throw ex;
                    }
View Full Code Here

        InputStream in = getResponseBodyAsStream();
        if (in != null) {
            // read response and try to build a xml document
            try {
                DocumentBuilder docBuilder = BUILDER_FACTORY.newDocumentBuilder();
                docBuilder.setErrorHandler(new DefaultHandler());
                responseDocument = docBuilder.parse(in);
                return responseDocument;
            } catch (ParserConfigurationException e) {
                IOException exception =
                    new IOException("XML parser configuration error");
View Full Code Here

        // with a SchemaUrl, a URL object
        //factory.setAttribute("http://java.sun.com/xml/jaxp/properties/schemaLanguage", "http://www.w3.org/2001/XMLSchema");
        //factory.setAttribute("http://java.sun.com/xml/jaxp/properties/schemaSource", SchemaUrl);
        DocumentBuilder builder = factory.newDocumentBuilder();
        if (validate) {
            LocalResolver lr = new LocalResolver(new DefaultHandler());
            ErrorHandler eh = new LocalErrorHandler(docDescription, lr);

            builder.setEntityResolver(lr);
            builder.setErrorHandler(eh);
        }
View Full Code Here

        // with a SchemaUrl, a URL object
        //factory.setAttribute("http://java.sun.com/xml/jaxp/properties/schemaLanguage", "http://www.w3.org/2001/XMLSchema");
        //factory.setAttribute("http://java.sun.com/xml/jaxp/properties/schemaSource", SchemaUrl);
        if (validate) {
            LocalResolver lr = new LocalResolver(new DefaultHandler());
            ErrorHandler eh = new LocalErrorHandler(docDescription, lr);

            parser.setEntityResolver(lr);
            parser.setErrorHandler(eh);
        }
View Full Code Here

        public void convertTo(Target t) throws IOException {
            try {
                System.setProperty("entityExpansionLimit", "1000000");
                boolean laden = source.canRead();
                if (laden) {
                    DefaultHandler contentHandler=null;
                    if("dbxliff".equalsIgnoreCase(sourceType)){
                        contentHandler = new XLIFFReader(handler, t
                                .getWriter(),false);
                    }else{
                        contentHandler = new XLIFFReader(handler, t
View Full Code Here

    private XMLReader createXMLReader(ContentHandler handler) throws SAXException {
        XMLReader reader = XMLReaderFactory.createXMLReader();
        reader.setFeature("http://xml.org/sax/features/namespaces", true);
        reader.setFeature("http://xml.org/sax/features/namespace-prefixes", false);
        reader.setContentHandler(handler);
        reader.setErrorHandler(new DefaultHandler());
        return reader;
    }
View Full Code Here

        // Now create a validating doc builder and set it.
        DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
        factory.setValidating(true);
        DocumentBuilder builder = factory.newDocumentBuilder();
        builder.setErrorHandler(new DefaultHandler() {
            public void error(SAXParseException ex) throws SAXException
            {
                throw ex;
            }
        });
View Full Code Here

TOP

Related Classes of org.xml.sax.helpers.DefaultHandler

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.