Package net.sf.saxon.event

Examples of net.sf.saxon.event.ParseOptions


                    reader = config.getSourceParser();
                }
                reader.setErrorHandler(errorHandler);
            }
            source.setSystemId(in.getSystemId());
            ParseOptions options = new ParseOptions();
            if (xIncludeAware) {
                options.setXIncludeAware(true);
            }
            if (validating) {
                options.setDTDValidationMode(Validation.STRICT);
            }
            if (stripSpace != Whitespace.UNSPECIFIED) {
                options.setStripSpace(stripSpace);
            }
            new Sender(pipe).send(source, builder, options);
            TinyDocumentImpl doc = (TinyDocumentImpl)builder.getCurrentRoot();
            builder.reset();
            return (Document)DocumentOverNodeInfo.wrap(doc);
View Full Code Here


        boolean stable = true;
        NamePool pool = context.getController().getNamePool();

        Source source = Document.resolveURI(href, baseURI, null, context.getController());
        ParseOptions options = new ParseOptions();
        options.setSchemaValidationMode(Validation.SKIP);
        DocumentInfo catalog = context.getConfiguration().buildDocument(source, options);
        if (catalog==null) {
            // we failed to read the catalogue
            XPathException err = new XPathException("Failed to load collection catalog " + absURI);
            err.setErrorCode("FODC0004");
View Full Code Here

                    }
                }
            } else {
                try {
                    Source source = new StreamSource(file.toURI().toString());
                    ParseOptions options = new ParseOptions();
                    if (validation != Validation.STRIP && validation != Validation.PRESERVE) {
                        options.setSchemaValidationMode(validation);
                    }
                    if (xinclude != null) {
                        options.setXIncludeAware(xinclude.booleanValue());
                    }
                    if (parser != null) {
                        options.setXMLReader(parser);
                    }

                    Stripper stripper;
                    if (params != null) {
                        int stripSpace = params.getStripSpace();
                        switch (strip) {
                            case Whitespace.ALL: {
                                stripper = AllElementStripper.getInstance();
                                stripper.setStripAll();
                                options.addFilter(stripper);
                                break;
                            }
                            case Whitespace.IGNORABLE:
                            case Whitespace.NONE:
                                options.setStripSpace(stripSpace);
                        }
                    }
                    DocumentInfo doc = pipe.getConfiguration().buildDocument(source, options);
                    return SingletonIterator.makeIterator(doc);
                } catch (XPathException err) {
View Full Code Here

    public static class FromSource extends JPConverter {

        public static FromSource INSTANCE = new FromSource();

        public ValueRepresentation convert(Object object, XPathContext context) throws XPathException {
            ParseOptions options = new ParseOptions();
            Controller controller = context.getController();
            if (controller != null) {
                options.setSchemaValidationMode(controller.getSchemaValidationMode());
            }
            return context.getConfiguration().buildDocument((Source)object, options);
        }
View Full Code Here

    public XdmNode build(Source source) throws SaxonApiException {
        if (source instanceof AugmentedSource) {
            throw new IllegalArgumentException("AugmentedSource not accepted");
        }
        ParseOptions options = new ParseOptions();
        options.setDTDValidationMode(dtdValidation ? Validation.STRICT : Validation.STRIP);
        if (schemaValidator != null) {
            options.setSchemaValidationMode(schemaValidator.isLax() ? Validation.LAX : Validation.STRICT);
            if (schemaValidator.getDocumentElementName() != null) {
                options.setTopLevelElement(schemaValidator.getDocumentElementName().getStructuredQName());
            }
            if (schemaValidator.getDocumentElementType() != null) {
                options.setTopLevelType(schemaValidator.getDocumentElementType());
            }
        }
        if (treeModel != null) {
            options.setModel(treeModel);
        }
        if (whitespacePolicy != null) {
            options.setStripSpace(whitespacePolicy.ordinal());
        }
        options.setLineNumbering(lineNumbering);
        if (source.getSystemId() == null && baseURI != null) {
            source.setSystemId(baseURI.toString());
        }
        try {
            NodeInfo doc = config.buildDocument(source, options);
View Full Code Here

TOP

Related Classes of net.sf.saxon.event.ParseOptions

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.