/** * Allocate a SequenceOutputter for a new output destination. * * @param size the estimated size of the output sequence * @return SequenceOutputter the allocated SequenceOutputter */ /*@NotNull*/ public synchronized SequenceOutputter allocateSequenceOutputter(int size) { PipelineConfiguration pipe = makePipelineConfiguration(); return new SequenceOutputter(pipe, size); }
/** * Create a IdentityTransformerHandler and initialise variables. The constructor is protected, because * the Filter should be created using newTransformerHandler() in the SAXTransformerFactory * class * @param controller the Controller for this transformation */ protected IdentityTransformerHandler(Controller controller) { this.controller = controller; setPipelineConfiguration(controller.makePipelineConfiguration()); }
/** * Allocate a SequenceOutputter for a new output destination. * * @param size the estimated size of the output sequence * @return SequenceOutputter the allocated SequenceOutputter */ /*@NotNull*/ public synchronized SequenceOutputter allocateSequenceOutputter(int size) { PipelineConfiguration pipe = makePipelineConfiguration(); return new SequenceOutputter(pipe, size); }
/** * Create a IdentityTransformerHandler and initialise variables. The constructor is protected, because * the Filter should be created using newTransformerHandler() in the SAXTransformerFactory * class * @param controller the Controller for this transformation */ protected IdentityTransformerHandler(Controller controller) { this.controller = controller; setPipelineConfiguration(controller.makePipelineConfiguration()); }
@Override public Receiver resolve( XPathContext context, String href, String baseUri, SerializationProperties properties) throws XPathException { StreamResult result = resolve(href, baseUri); SerializerFactory factory = context.getConfiguration().getSerializerFactory(); PipelineConfiguration pipe = context.getController().makePipelineConfiguration(); return factory.getReceiver(result, properties, pipe); }
/** * Make a builder for the selected tree model. * * @return an instance of the Builder for the chosen tree model * @since 8.4 */ public Builder makeBuilder() { Builder b = treeModel.makeBuilder(makePipelineConfiguration()); b.setTiming(config.isTiming()); b.setLineNumbering(config.isLineNumbering()); return b; }
/** * Override the behaviour of startDocument() in ReceivingContentHandler */ public void startDocument() throws SAXException { if (result==null) { result = new StreamResult(System.out); } try { Properties props = controller.getOutputProperties(); PipelineConfiguration pipe = controller.makePipelineConfiguration(); SerializerFactory sf = getConfiguration().getSerializerFactory(); setReceiver(sf.getReceiver(result, pipe, props)); setPipelineConfiguration(pipe); } catch (XPathException err) { throw new SAXException(err); } super.startDocument(); }
@Override public Receiver resolve( XPathContext context, String href, String baseUri, SerializationProperties properties) throws XPathException { StreamResult result = resolve(href, baseUri); SerializerFactory factory = context.getConfiguration().getSerializerFactory(); PipelineConfiguration pipe = context.getController().makePipelineConfiguration(); return factory.getReceiver(result, properties, pipe); }
/** * Make a builder for the selected tree model. * * @return an instance of the Builder for the chosen tree model * @since 8.4 */ public Builder makeBuilder() { Builder b = treeModel.makeBuilder(makePipelineConfiguration()); b.setTiming(config.isTiming()); b.setLineNumbering(config.isLineNumbering()); return b; }
/** * Get the Base URI for the node, that is, the URI used for resolving a relative URI contained * in the node. This will be the same as the System ID unless xml:base has been used. * * @return the base URI of the node */ public String getBaseURI() { if (node == null) { // the base URI of a constructed parentless document or element node is the static base URI of the // instruction/expression that created it PipelineConfiguration pipe = savedXPathContext.getController().makePipelineConfiguration(); return pipe.getLocationProvider().getSystemId(instruction.getLocationId()); } else { return node.getBaseURI(); } }
/** * Get the Base URI for the node, that is, the URI used for resolving a relative URI contained * in the node. This will be the same as the System ID unless xml:base has been used. * * @return the base URI of the node */ public String getBaseURI() { if (node == null) { // the base URI of a constructed parentless document or element node is the static base URI of the // instruction/expression that created it PipelineConfiguration pipe = savedXPathContext.getController().makePipelineConfiguration(); return pipe.getLocationProvider().getSystemId(instruction.getLocationId()); } else { return node.getBaseURI(); } }
/** * Get a PullProvider that delivers the stream of events corresponding to the tree rooted at this virtual node * @return the PullProvider for the events in the virtual tree */ public PullProvider getPuller() { if (node == null) { VirtualTreeWalker walker = new VirtualTreeWalker(instruction, savedXPathContext); walker.setPipelineConfiguration(savedXPathContext.getController().makePipelineConfiguration()); walker.setNameCode(getNameCode()); return walker; } else { return TreeWalker.makeTreeWalker(node); } }
/** * Get a PullProvider that delivers the stream of events corresponding to the tree rooted at this virtual node * @return the PullProvider for the events in the virtual tree */ public PullProvider getPuller() { if (node == null) { VirtualTreeWalker walker = new VirtualTreeWalker(instruction, savedXPathContext); walker.setPipelineConfiguration(savedXPathContext.getController().makePipelineConfiguration()); walker.setNameCode(getNameCode()); return walker; } else { return TreeWalker.makeTreeWalker(node); } }
/** * Make a builder for the selected tree model. * * @return an instance of the Builder for the chosen tree model * @since 8.4 */ public Builder makeBuilder() { Builder b; if (treeModel==Builder.TINY_TREE) { b = new TinyBuilder(); } else { b = new TreeBuilder(); } b.setTiming(config.isTiming()); b.setLineNumbering(config.isLineNumbering()); b.setPipelineConfiguration(makePipelineConfiguration()); return b; }
/** * Make a builder for the selected tree model. * * @return an instance of the Builder for the chosen tree model * @since 8.4 */ public Builder makeBuilder() { Builder b; if (treeModel==Builder.TINY_TREE) { b = new TinyBuilder(); } else { b = new TreeBuilder(); } b.setTiming(config.isTiming()); b.setLineNumbering(config.isLineNumbering()); b.setPipelineConfiguration(makePipelineConfiguration()); return b; }
public void startDocument(URI baseURI) { inDocument = true; seenRoot = false; try { exec = new Executable(controller.getConfiguration()); destination = new XdmDestination(); receiver = destination.getReceiver(controller.getConfiguration()); PipelineConfiguration pipe = controller.makePipelineConfiguration(); receiver.setPipelineConfiguration(pipe); if (baseURI != null) { receiver.setSystemId(baseURI.toASCIIString()); } else { receiver.setSystemId("http://example.com/"); } receiver.open(); receiver.startDocument(0); } catch (Exception e) { throw new XProcException(e); } }
public void startDocument(URI baseURI) { inDocument = true; seenRoot = false; try { exec = new Executable(controller.getConfiguration()); destination = new XdmDestination(); receiver = destination.getReceiver(controller.getConfiguration()); PipelineConfiguration pipe = controller.makePipelineConfiguration(); receiver.setPipelineConfiguration(pipe); if (baseURI != null) { receiver.setSystemId(baseURI.toASCIIString()); } else { receiver.setSystemId("http://example.com/"); } receiver.open(); receiver.startDocument(0); } catch (Exception e) { throw new XProcException(e); } }
/** * Evaluate as an expression. We rely on the fact that when these instructions * are generated by XQuery, there will always be a valueExpression to evaluate * the content */ public Item evaluateItem(XPathContext context) throws XPathException { Controller controller = context.getController(); XPathContext c2 = context.newMinorContext(); c2.setOrigin(this); SequenceOutputter seq = controller.allocateSequenceOutputter(1); PipelineConfiguration pipe = controller.makePipelineConfiguration(); pipe.setHostLanguage(getHostLanguage()); seq.setPipelineConfiguration(pipe); c2.setTemporaryReceiver(seq); process(c2); seq.close(); Item item = seq.getFirstItem(); seq.reset(); return item; }
/** * Evaluate as an expression. We rely on the fact that when these instructions * are generated by XQuery, there will always be a valueExpression to evaluate * the content */ public Item evaluateItem(XPathContext context) throws XPathException { Controller controller = context.getController(); XPathContext c2 = context.newMinorContext(); c2.setOrigin(this); SequenceOutputter seq = controller.allocateSequenceOutputter(1); PipelineConfiguration pipe = controller.makePipelineConfiguration(); pipe.setHostLanguage(getHostLanguage()); seq.setPipelineConfiguration(pipe); c2.setTemporaryReceiver(seq); process(c2); seq.close(); Item item = seq.getFirstItem(); seq.reset(); return item; }
public EventIterator iterateEvents(XPathContext context) throws XPathException { if (!preservingTypes && validation != Validation.STRIP) { // Schema validation can't be done in pull mode return new SingletonEventIterator(evaluateItem(context)); } StartElementEvent start = new StartElementEvent(context.getController().makePipelineConfiguration()); start.setNameCode(getNameCode(context)); start.setTypeCode(validation == Validation.PRESERVE ? StandardNames.XS_ANY_TYPE : StandardNames.XS_UNTYPED); start.setLocalNamespaces(getActiveNamespaces()); start.setLocationId(locationId); EventIterator result = new BracketedElementIterator( start, content.iterateEvents(context), EndElementEvent.getInstance()); if (validation == Validation.STRIP && !context.getConfiguration().areAllNodesUntyped()) { return new EventAnnotationStripper(result); } else { return result; } }