/** * Create a ComplexContentOutputter * @param next the next receiver in the pipeline */ public ComplexContentOutputter(Receiver next) { super(next.getPipelineConfiguration()); setReceiver(next); setHostLanguage(next.getPipelineConfiguration().getHostLanguage()); }
public void beforeBulkCopy() throws XPathException { level++; if (state == StartTag) { startContent(); } }
/** * It is possible for a single output element to use the same prefix to refer to different * namespaces. In this case we have to generate an alternative prefix for uniqueness. The * one we generate is based on the sequential position of the element/attribute: this is * designed to ensure both uniqueness (with a high probability) and repeatability * @param nscode the proposed namespace code * @param seq sequence number for use in the substitute prefix * @return a prefix to use in place of the one originally proposed */ private String getSubstitutePrefix(int nscode, int seq) { String prefix = getNamePool().getPrefixFromNamespaceCode(nscode); return prefix + '_' + seq; }
/** * Create a TinyTree to hold a document or element node. * @throws net.sf.saxon.trans.XPathException */ private void createTree() throws XPathException { builder = new TinyBuilder(); builder.setPipelineConfiguration(getPipelineConfiguration()); builder.setSystemId(getSystemId()); NamespaceReducer reducer = new NamespaceReducer(); reducer.setUnderlyingReceiver(builder); reducer.setPipelineConfiguration(getPipelineConfiguration()); ComplexContentOutputter cco = new ComplexContentOutputter(); cco.setHostLanguage(getPipelineConfiguration().getHostLanguage()); cco.setPipelineConfiguration(getPipelineConfiguration()); cco.setReceiver(reducer); outputter = cco; outputter.setSystemId(systemId); outputter.setPipelineConfiguration(getPipelineConfiguration()); outputter.open(); }
/** * Take the results of a query (or any other SequenceIterator) and create * an XML document containing copies of all items in the sequence, each item wrapped in a containing * element that identifies its type * @param iterator The values to be wrapped * @param config The Saxon configuration used to evaluate the query * @return the document containing the wrapped results * @throws XPathException * @since 8.8 */ public static DocumentInfo wrap(SequenceIterator iterator, Configuration config) throws XPathException { PipelineConfiguration pipe = config.makePipelineConfiguration(); TinyBuilder builder = new TinyBuilder(); builder.setPipelineConfiguration(pipe); NamespaceReducer reducer = new NamespaceReducer(); reducer.setUnderlyingReceiver(builder); reducer.setPipelineConfiguration(pipe); ComplexContentOutputter outputter = new ComplexContentOutputter(); outputter.setPipelineConfiguration(pipe); outputter.setReceiver(reducer); sendWrappedSequence(iterator, outputter); return (DocumentInfo)builder.getCurrentRoot(); }
pipe.setHostLanguage(hostLanguage); ComplexContentOutputter out = new ComplexContentOutputter(); out.setHostLanguage(hostLanguage); out.setPipelineConfiguration(pipe); Whitespace.NONE, schemaType, -1); out.setReceiver(receiver); out.open(); out.startDocument(0);
NamePool namePool = getNamePool(); int nscode = namePool.getNamespaceCode(nameCode); if (nscode == -1) { String prefix = getSubstitutePrefix(nscode, seq); namePool.getURI(nameCode), namePool.getLocalName(nameCode)); namespace(namePool.allocateNamespaceCode(newCode), 0); return newCode; namespace(nscode, 0); return nameCode;
/** * Take the results of a query (or any other SequenceIterator) and create * an XML document containing copies of all items in the sequence, each item wrapped in a containing * element that identifies its type * * @param iterator The values to be wrapped * @param config The Saxon configuration used to evaluate the query * @return the document containing the wrapped results * @throws XPathException if any failure occurs * @since 8.8 */ /*@Nullable*/ public static DocumentInfo wrap(SequenceIterator iterator, /*@NotNull*/ Configuration config) throws XPathException { PipelineConfiguration pipe = config.makePipelineConfiguration(); TinyBuilder builder = new TinyBuilder(pipe); builder.setStatistics(Statistics.SOURCE_DOCUMENT_STATISTICS); NamespaceReducer reducer = new NamespaceReducer(builder); ComplexContentOutputter outputter = new ComplexContentOutputter(reducer); sendWrappedSequence(iterator, outputter); return new DocumentInfo(builder.getCurrentRoot()); }
getNamePool().getDisplayName(nameCode), hostLanguage, pendingStartTag == -2, getPipelineConfiguration().isSerializing()); LocationProvider lp = getPipelineConfiguration().getLocationProvider(); if (lp != null) { err.setLocator(new ExpressionLocation(lp, locationId)); } else { XPathException err = new XPathException("Cannot create an element having two attributes with the same name: " + Err.wrap(getNamePool().getDisplayName(nameCode), Err.ATTRIBUTE)); err.setErrorCode("XQDY0025"); throw err;
String prefix = getSubstitutePrefix(binding, seq); NodeName newName = new FingerprintedQName(prefix, nodeName.getURI(), nodeName.getLocalPart()); namespace(newName.getNamespaceBinding(), 0); return newName; String prefix = getSubstitutePrefix(binding, seq); NodeName newName = new FingerprintedQName(prefix, nodeName.getURI(), nodeName.getLocalPart()); namespace(newName.getNamespaceBinding(), 0); return newName; namespace(binding, 0); return nodeName;
characters(" ", locationId, 0); characters(item.getStringValueCS(), locationId, 0); previousAtomic = true; } else if (((NodeInfo)item).getNodeKind() == Type.DOCUMENT) { startDocument(0); SequenceIterator iter = ((NodeInfo)item).iterateAxis(Axis.CHILD); while (true) { Item it = iter.next(); if (it == null) break; append(it, locationId, copyNamespaces); endDocument(); previousAtomic = false; } else {
NodeName elcode = checkProposedPrefix(pendingStartTag, 0); int props = startElementProperties | ReceiverOptions.NAMESPACE_OK; nextReceiver.startElement(elcode, currentSimpleType, startElementLocationId, props); NodeName attcode = pendingAttCode[a]; if (!attcode.hasURI("")) { // non-null prefix attcode = checkProposedPrefix(attcode, a + 1); pendingAttCode[a] = attcode;
/** * Takes a Receiver that expects raw output (such as might be obtained from {@link Destination#getReceiver}) * and prepends a pipeline of receivers needed to support transformation tasks, especially a * {@link ComplexContentOutputter}. * @param out a receiver expecting raw output * @return a receiver to which instructions in the stylesheet can write events. This receiver will have * been opened. * @throws XPathException if any failure occurs */ private Receiver prepareOutputReceiver(Receiver out) throws XPathException { principalResult = out; if (principalResultURI == null) { principalResultURI = out.getSystemId(); } //out = new RegularSequenceChecker(out); // uncomment for debugging //out = new TracingFilter(out); // uncomment for debugging NamespaceReducer nr = new NamespaceReducer(out); ComplexContentOutputter cco = new ComplexContentOutputter(nr); cco.setSystemId(out.getSystemId()); out = cco; if (getExecutable().createsSecondaryResult()) { // This is for the case where the stylesheet writes no output to the primary destination, // and then calls xsl:result-document with a null or empty href, in which case the xsl:result-document // output is sent to the primary output destination, but with different serialization properties. out = this.gatekeeper = new PrincipalOutputGatekeeper(this, out); } out.open(); return out; }
characters(" ", locationId, 0); characters(item.getStringValueCS(), locationId, 0); previousAtomic = true; } else if (((NodeInfo)item).getNodeKind() == Type.DOCUMENT) { Item it = iter.next(); if (it == null) break; append(it, locationId, copyNamespaces);
/** * Create a TinyTree to hold a document or element node. * @throws net.sf.saxon.trans.XPathException */ private void createTree() throws XPathException { PipelineConfiguration pipe = getPipelineConfiguration(); builder = pipe.getController().makeBuilder(); builder.setPipelineConfiguration(pipe); builder.setSystemId(getSystemId()); builder.setTiming(false); NamespaceReducer reducer = new NamespaceReducer(); reducer.setUnderlyingReceiver(builder); reducer.setPipelineConfiguration(getPipelineConfiguration()); ComplexContentOutputter cco = new ComplexContentOutputter(); cco.setHostLanguage(getPipelineConfiguration().getHostLanguage()); cco.setPipelineConfiguration(getPipelineConfiguration()); cco.setReceiver(reducer); outputter = cco; outputter.setSystemId(systemId); outputter.setPipelineConfiguration(getPipelineConfiguration()); outputter.open(); }
/** * Take the results of a query (or any other SequenceIterator) and create * an XML document containing copies of all items in the sequence, each item wrapped in a containing * element that identifies its type * @param iterator The values to be wrapped * @param config The Saxon configuration used to evaluate the query * @return the document containing the wrapped results * @throws XPathException * @since 8.8 */ public static DocumentInfo wrap(SequenceIterator iterator, Configuration config) throws XPathException { PipelineConfiguration pipe = config.makePipelineConfiguration(); TinyBuilder builder = new TinyBuilder(); builder.setPipelineConfiguration(pipe); NamespaceReducer reducer = new NamespaceReducer(); reducer.setUnderlyingReceiver(builder); reducer.setPipelineConfiguration(pipe); ComplexContentOutputter outputter = new ComplexContentOutputter(); outputter.setPipelineConfiguration(pipe); outputter.setReceiver(reducer); sendWrappedSequence(iterator, outputter); return (DocumentInfo)builder.getCurrentRoot(); }
NamePool namePool = getNamePool(); int nscode = namePool.getNamespaceCode(nameCode); if (nscode == -1) { String prefix = getSubstitutePrefix(nscode, seq); namePool.getURI(nameCode), namePool.getLocalName(nameCode)); namespace(namePool.allocateNamespaceCode(newCode), 0); return newCode; namespace(nscode, 0); return nameCode;
/** * Take the results of a query (or any other SequenceIterator) and create * an XML document containing copies of all items in the sequence, each item wrapped in a containing * element that identifies its type * * @param iterator The values to be wrapped * @param config The Saxon configuration used to evaluate the query * @return the document containing the wrapped results * @throws XPathException if any failure occurs * @since 8.8 */ /*@Nullable*/ public static DocumentInfo wrap(SequenceIterator iterator, /*@NotNull*/ Configuration config) throws XPathException { PipelineConfiguration pipe = config.makePipelineConfiguration(); TinyBuilder builder = new TinyBuilder(pipe); builder.setStatistics(config.getTreeStatistics().SOURCE_DOCUMENT_STATISTICS); NamespaceReducer reducer = new NamespaceReducer(builder); ComplexContentOutputter outputter = new ComplexContentOutputter(reducer); sendWrappedSequence(iterator, outputter); return new DocumentInfo(builder.getCurrentRoot()); }
getNamePool().getDisplayName(nameCode), hostLanguage, pendingStartTag == -2, getPipelineConfiguration().isSerializing()); LocationProvider lp = getPipelineConfiguration().getLocationProvider(); if (lp != null) { err.setLocator(new ExpressionLocation(lp, locationId)); } else { XPathException err = new XPathException("Cannot create an element having two attributes with the same name: " + Err.wrap(getNamePool().getDisplayName(nameCode), Err.ATTRIBUTE)); err.setErrorCode("XQDY0025"); throw err;
String prefix = getSubstitutePrefix(binding, seq); NodeName newName = new FingerprintedQName(prefix, nodeName.getURI(), nodeName.getLocalPart()); namespace(newName.getNamespaceBinding(), 0); return newName; String prefix = getSubstitutePrefix(binding, seq); NodeName newName = new FingerprintedQName(prefix, nodeName.getURI(), nodeName.getLocalPart()); namespace(newName.getNamespaceBinding(), 0); return newName; namespace(binding, 0); return nodeName;