Package net.sf.saxon

Examples of net.sf.saxon.AugmentedSource


            Source source = XMLSystemFunctions.convertToSource(context);
            result.sources.add(source);
              if (contextRoot != null) {
                //create our own filter as this logic is not provided in the free saxon
                  ProxyReceiver filter = new PathMapFilter(contextRoot);
                  AugmentedSource sourceInput = AugmentedSource.makeAugmentedSource(source);
                  sourceInput.addFilter(filter);
                  source = sourceInput;
              }
              DocumentInfo doc;
        try {
          doc = config.buildDocument(source);
View Full Code Here


     * {@link Configuration#buildDocument}
    */

    public NodeInfo build(Source source) throws XPathException {
        if (stripSpace) {
            AugmentedSource as = AugmentedSource.makeAugmentedSource(source);
            as.setStripSpace(Whitespace.ALL);
            source = as;
        } else if (source instanceof NodeInfo) {
            return (NodeInfo)source;
        }
        return getConfiguration().buildDocument(source);
View Full Code Here

                    break;
                default:
                    throw new XQException("Required item type for document node is incorrect");
            }
        }
        AugmentedSource out = AugmentedSource.makeAugmentedSource(in);
        out.setSchemaValidationMode(Validation.STRICT);
        return out;
    }
View Full Code Here

                //System.err.println("Using PullSource(stream)");
                ps.setSystemId(input.getSystemId());
                if (validation == Validation.DEFAULT) {
                    return ps;
                } else {
                    AugmentedSource as = AugmentedSource.makeAugmentedSource(ps);
                    as.setSchemaValidationMode(validation);
                    return as;
                }
            } else {
                return input;
            }
        }
        Reader reader = input.getReader();
        if (reader != null) {
            if (reader instanceof DotNetReader && !preferJaxp) {
                XmlReader parser = new XmlTextReader(input.getSystemId(),
                        ((DotNetReader)reader).getUnderlyingTextReader());
                ((XmlTextReader)parser).set_Normalization(true);
                ((XmlTextReader)parser).set_WhitespaceHandling(WhitespaceHandling.wrap(WhitespaceHandling.All));
                if (pipe.getURIResolver() instanceof DotNetURIResolver) {
                    ((XmlTextReader)parser).set_XmlResolver(
                            ((DotNetURIResolver)pipe.getURIResolver()).getXmlResolver());
                }

                // Always need a validating parser, because that's the only way to get entity references expanded
                parser = new XmlValidatingReader(parser);
                if (dtdValidation) {
                    ((XmlValidatingReader)parser).set_ValidationType(ValidationType.wrap(ValidationType.DTD));
                } else {
                    ((XmlValidatingReader)parser).set_ValidationType(ValidationType.wrap(ValidationType.None));
                }
                PullSource ps = new PullSource(new DotNetPullProvider(parser));
                //System.err.println("Using PullSource(reader)");
                ps.setSystemId(input.getSystemId());
                if (validation == Validation.DEFAULT) {
                    return ps;
                } else {
                    AugmentedSource as = AugmentedSource.makeAugmentedSource(ps);
                    as.setSchemaValidationMode(validation);
                    return as;
                }
            } else {
                return input;
            }
        }
        String uri = input.getSystemId();
        if (uri != null) {
            try {
                Source r = pipe.getURIResolver().resolve(uri, null);
                if (r == null) {
                    return input;
                } else if (r instanceof AugmentedSource) {
                    Source r2 = ((AugmentedSource)r).getContainedSource();
                    if (r2 instanceof StreamSource) {
                        r2 = getParserSource(pipe, (StreamSource)r2, validation, dtdValidation, stripspace);
                        return r2;
                    } else {
                        return r2;
                    }
                } else if (r instanceof StreamSource && r != input) {
                    Source r2 = getParserSource(pipe, (StreamSource)r, validation, dtdValidation, stripspace);
                    AugmentedSource as = AugmentedSource.makeAugmentedSource(r2);
                    as.setPleaseCloseAfterUse(true);
                    return as;
                } else {
                    return r;
                }
            } catch (TransformerException err) {
View Full Code Here

            } else {
                return origin;
            }
        } else {
            if (stripSpace) {
                AugmentedSource as = AugmentedSource.makeAugmentedSource(source);
                as.setStripSpace(Whitespace.ALL);
                source = as;
            }
            return config.buildDocument(source);
        }
    }
View Full Code Here

                    break;
                default:
                    throw new XQException("Required item type for document node is incorrect");
            }
        }
        AugmentedSource out = AugmentedSource.makeAugmentedSource(in);
        out.setSchemaValidationMode(Validation.STRICT);
        return out;
    }
View Full Code Here

     * {@link Configuration#buildDocument}
    */

    public NodeInfo build(Source source) throws XPathException {
        if (stripSpace) {
            AugmentedSource as = AugmentedSource.makeAugmentedSource(source);
            as.setStripSpace(Whitespace.ALL);
            source = as;
        } else if (source instanceof NodeInfo) {
            return (NodeInfo)source;
        }
        return getConfiguration().buildDocument(source);
View Full Code Here

     *         the document node at the root of the tree of the resulting in-memory document.
     */

    public XdmNode build(Source source) throws SaxonApiException {

        AugmentedSource as = AugmentedSource.makeAugmentedSource(source);
        as.setDTDValidationMode(dtdValidation ? Validation.STRICT : Validation.STRIP);
        if (schemaValidator != null) {
            as.setSchemaValidationMode(schemaValidator.isLax() ? Validation.LAX : Validation.STRICT);
            if (schemaValidator.getDocumentElementName() != null) {
                as.setTopLevelElement(schemaValidator.getDocumentElementName().getStructuredQName());
            }
            if (schemaValidator.getDocumentElementType() != null) {
                as.setTopLevelType(schemaValidator.getDocumentElementType());
            }
        }
        if (whitespacePolicy != null) {
            as.setStripSpace(whitespacePolicy.ordinal());
        }
        as.setLineNumbering(lineNumbering);
        if (source.getSystemId() == null && baseURI != null) {
            source.setSystemId(baseURI.toString());
        }
        try {
            NodeInfo doc = config.buildDocument(as);
View Full Code Here

     * @return the NodeInfo of the start node in the resulting document object.
    */

    public NodeInfo setSource(Source source) throws net.sf.saxon.trans.XPathException {
        if (stripSpace) {
            AugmentedSource as = AugmentedSource.makeAugmentedSource(source);
            as.setStripSpace(Whitespace.ALL);
            source = as;
        } else if (source instanceof NodeInfo) {
            NodeInfo origin = (NodeInfo)source;
            if (!origin.getConfiguration().isCompatible(config)) {
                throw new net.sf.saxon.trans.XPathException(
View Full Code Here

TOP

Related Classes of net.sf.saxon.AugmentedSource

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.