本文整理汇总了Java中net.sf.saxon.event.Receiver类的典型用法代码示例。如果您正苦于以下问题:Java Receiver类的具体用法?Java Receiver怎么用?Java Receiver使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Receiver类属于net.sf.saxon.event包,在下文中一共展示了Receiver类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: init
import net.sf.saxon.event.Receiver; //导入依赖的package包/类
public static boolean init(Transformer transformer, final LocalDebugger dbg) {
if (transformer instanceof Controller) {
System.out.println("SAXON 9");
final Controller controller = (Controller)transformer;
((Saxon9TraceListener)controller.getConfiguration().getTraceListener()).setDebugger(dbg);
controller.getConfiguration().setLineNumbering(true);
controller.getConfiguration().setCompileWithTracing(true);
controller.getConfiguration().setMultiThreading(false);
controller.getConfiguration().setSerializerFactory(new SerializerFactory(controller.getConfiguration()) {
@Override
protected Receiver createXMLSerializer(Emitter emitter,
Properties props,
PipelineConfiguration pipe,
CharacterMapExpander characterMapExpander,
ProxyReceiver normalizer) throws XPathException {
return super.createXMLSerializer(emitter, props, pipe, characterMapExpander, normalizer);
}
@Override
protected Emitter newXMLEmitter() {
return new TracingOutputter(dbg.getEventQueue(), super.newXMLEmitter());
}
});
controller.getConfiguration().setDebugger(new Debugger() {
public SlotManager makeSlotManager() {
return new SlotManager() {
@Override
public int allocateSlotNumber(StructuredQName qName) {
System.out.println("qName = " + qName);
return super.allocateSlotNumber(qName);
}
};
}
});
return true;
}
return false;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:39,代码来源:Saxon9Support.java
示例2: call
import net.sf.saxon.event.Receiver; //导入依赖的package包/类
@Override
public Sequence call(XPathContext context, Sequence[] arguments) throws XPathException {
try {
String json = ((StringValue) arguments[0].head()).getStringValue();
if (StringUtils.isBlank(json)) {
return EmptySequence.getInstance();
}
XMLInputFactory factory = new JsonXMLInputFactory();
XMLStreamReader reader = factory.createXMLStreamReader(new StringReader(json));
StAXSource source = new StAXSource(reader);
Configuration config = context.getConfiguration();
PipelineConfiguration pipe = config.makePipelineConfiguration();
pipe.getParseOptions().getParserFeatures().remove("http://apache.org/xml/features/xinclude");
TinyBuilder builder = new TinyBuilder(pipe);
SerializerFactory sf = config.getSerializerFactory();
Receiver receiver = sf.getReceiver(builder, pipe, new Properties());
NamespaceReducer reducer = new NamespaceReducer(receiver);
ParseOptions options = pipe.getParseOptions();
options.setContinueAfterValidationErrors(true);
Sender.send(source, reducer, options);
return builder.getCurrentRoot();
} catch (Exception e) {
throw new XPathException("Error parsing JSON string", e);
}
}
开发者ID:Armatiek,项目名称:xslweb,代码行数:26,代码来源:ParseJSON.java
示例3: transcode
import net.sf.saxon.event.Receiver; //导入依赖的package包/类
public <T extends Result> T transcode(SdcctXsltExecutable xsltExec, Source src, T result, @Nullable HtmlTranscodeOptions opts) throws Exception {
if (src instanceof StreamSource) {
StaxToEventBridge srcEventIterator = new StaxToEventBridge();
srcEventIterator.setPipelineConfiguration(this.config.makePipelineConfiguration());
srcEventIterator.setXMLStreamReader(this.xmlInFactory.createXMLStreamReader(src));
src = new SdcctPullEventSource(SdcctTransformUtils.getPublicId(src), src.getSystemId(), srcEventIterator);
}
// noinspection ConstantConditions
Receiver receiver =
((opts = this.defaultTranscodeOpts.clone().merge(opts)).getOption(ContentCodecOptions.PRETTY) ? this.prettySerializer : this.serializer)
.getReceiver(this.config, this.config.makePipelineConfiguration(), result, null, null);
DynamicXsltOptions xsltOpts = new DynamicXsltOptionsImpl();
xsltOpts.setSource(src);
xsltOpts.setDestination(new AugmentedDestination(new ReceiverDestination<>(receiver)).addFilters(HtmlCdataXmlFilter::new));
xsltOpts.setVariables(opts.getVariables());
xsltExec.load(xsltOpts).transform();
return result;
}
开发者ID:esacinc,项目名称:sdcct,代码行数:24,代码来源:HtmlTranscoder.java
示例4: parse
import net.sf.saxon.event.Receiver; //导入依赖的package包/类
@Override
public void parse(InputSource input) throws IOException, SAXException {
final ContentHandlerProxy chp = new ContentHandlerProxy();
chp.setLexicalHandler(lexicalHandler);
chp.setUnderlyingContentHandler(handler);
this.source.addFilter(new FilterFactory() {
@Override
public ProxyReceiver makeFilter(Receiver arg0) {
return new ContentHandlerProxyReceiver(chp, arg0);
}
});
try {
config.buildDocument(source);
} catch (XPathException e) {
throw new SAXException(e);
}
}
开发者ID:kenweezy,项目名称:teiid,代码行数:19,代码来源:StreamingUtils.java
示例5: getReceiver
import net.sf.saxon.event.Receiver; //导入依赖的package包/类
@Override
public Receiver getReceiver(Result result, PipelineConfiguration pipelineConfig, Properties outProps, @Nullable CharacterMapIndex charMapIndex)
throws XPathException {
int indentSpaces = config.getInteger(outProps, SaxonOutputKeys.INDENT_SPACES, -1);
boolean indent = (this.config.getBoolean(outProps, OutputKeys.INDENT) && (indentSpaces > 0));
outProps.setProperty(OutputKeys.INDENT, CrigttConfigurationValues.NO);
Receiver receiver = super.getReceiver(result, pipelineConfig, outProps, charMapIndex);
if (indent) {
(receiver = new ReceiverToXMLStreamWriter(new PrettyPrintXMLStreamWriter(new StreamWriterToReceiver(receiver), indentSpaces)))
.setPipelineConfiguration(pipelineConfig);
}
return receiver;
}
开发者ID:esacinc,项目名称:crigtt,代码行数:18,代码来源:CrigttSerializerFactory.java
示例6: getNodeNum
import net.sf.saxon.event.Receiver; //导入依赖的package包/类
/**
* Retrieves the current node number in the build. Indexer uses this to
* record node numbers in text chunks.
*
* @param inBuilder The builder gotten from begin()
* @return The current node number.
*/
public int getNodeNum(Receiver inBuilder) {
HackedTinyBuilder builder = (HackedTinyBuilder)inBuilder;
tree = builder.getTree();
// Don't count the stopper at the end of the tiny tree.
int nNodes = tree.getNumberOfNodes();
while (nNodes > 0 && tree.getNodeKind(nNodes-1) == Type.STOPPER)
nNodes--;
return nNodes;
}
开发者ID:CDLUC3,项目名称:dash-xtf,代码行数:18,代码来源:LazyTreeBuilder.java
示例7: call
import net.sf.saxon.event.Receiver; //导入依赖的package包/类
@Override
public ZeroOrOne<NodeInfo> call(XPathContext context, Sequence[] arguments) throws XPathException {
String xml = ((StringValue) arguments[0].head()).getStringValue();
try {
Controller controller = context.getController();
if (controller == null) {
throw new XPathException("parse() function is not available in this environment");
}
Configuration configuration = controller.getConfiguration();
StringReader sr = new StringReader(xml);
InputSource is = new InputSource(sr);
//is.setSystemId(baseURI);
Source source = new SAXSource(is);
//source.setSystemId(baseURI);
Builder b = TreeModel.TINY_TREE.makeBuilder(controller.makePipelineConfiguration());
Receiver s = b;
ParseOptions options = new ParseOptions();
options.setStripSpace(Whitespace.XSLT);
options.setErrorListener(context.getConfiguration().getErrorListener());
if (controller.getExecutable().stripsInputTypeAnnotations()) {
s = configuration.getAnnotationStripper(s);
}
s.setPipelineConfiguration(b.getPipelineConfiguration());
Sender.send(source, s, options);
TinyDocumentImpl node = (TinyDocumentImpl) b.getCurrentRoot();
// node.setBaseURI(baseURI);
node.setSystemId(null);
b.reset();
return new ZeroOrOne<NodeInfo>((NodeInfo)node);
} catch (XPathException err) {
throw new XPathException("First argument to parse is not a well-formed and namespace-well-formed XML document. XML parser reported: " + err.getMessage(), "FODC0006");
}
}
开发者ID:Armatiek,项目名称:xslweb,代码行数:39,代码来源:Parse.java
示例8: AbstractSdcctCdataXmlFilter
import net.sf.saxon.event.Receiver; //导入依赖的package包/类
protected AbstractSdcctCdataXmlFilter(Receiver nextReceiver) {
super(nextReceiver);
Receiver receiver = this.nextReceiver;
while (!(receiver instanceof ReceiverToXMLStreamWriter)) {
receiver = ((receiver instanceof ComplexContentOutputter)
? ((ComplexContentOutputter) receiver).getReceiver() : ((ProxyReceiver) receiver).getUnderlyingReceiver());
}
this.writer = Stax2WriterAdapter.wrapIfNecessary(((ReceiverToXMLStreamWriter) receiver).getXMLStreamWriter());
}
开发者ID:esacinc,项目名称:sdcct,代码行数:13,代码来源:AbstractSdcctCdataXmlFilter.java
示例9: getReceiver
import net.sf.saxon.event.Receiver; //导入依赖的package包/类
@Override
public Receiver getReceiver(Configuration config) throws SaxonApiException {
Receiver receiver = this.delegate.getReceiver(config);
if (this.hasFilters()) {
for (int a = (this.filters.size() - 1); a >= 0; a--) {
receiver = this.filters.get(a).makeFilter(receiver);
}
}
return receiver;
}
开发者ID:esacinc,项目名称:sdcct,代码行数:13,代码来源:AugmentedDestination.java
示例10: HtmlCdataXmlFilter
import net.sf.saxon.event.Receiver; //导入依赖的package包/类
public HtmlCdataXmlFilter(Receiver nextReceiver) {
super(nextReceiver);
}
开发者ID:esacinc,项目名称:sdcct,代码行数:4,代码来源:HtmlTranscoder.java
示例11: ContentHandlerProxyReceiver
import net.sf.saxon.event.Receiver; //导入依赖的package包/类
public ContentHandlerProxyReceiver(Receiver receiver, Receiver next) {
super(next);
this.reciever = receiver;
this.reciever.setPipelineConfiguration(next.getPipelineConfiguration());
}
开发者ID:kenweezy,项目名称:teiid,代码行数:6,代码来源:StreamingUtils.java
示例12: serializeToResult
import net.sf.saxon.event.Receiver; //导入依赖的package包/类
public <T extends Result> T serializeToResult(Source src, T result, Properties outProps) throws SaxonApiException {
CrigttConfiguration config = this.getProcessor().getUnderlyingConfiguration();
ParseOptions parseOpts = config.getParseOptions();
try {
Receiver receiver = config.getSerializerFactory().getReceiver(result, config.makePipelineConfiguration(), outProps);
if (src instanceof AugmentedSource) {
AugmentedSource augmentedSrc = ((AugmentedSource) src);
parseOpts = augmentedSrc.getParseOptions();
List<FilterFactory> srcFilters = augmentedSrc.getFilters();
if (!CollectionUtils.isEmpty(srcFilters)) {
for (int a = (srcFilters.size() - 1); a >= 0; a--) {
receiver = srcFilters.get(a).makeFilter(receiver);
}
srcFilters.clear();
}
}
Sender.send(src, receiver, parseOpts);
receiver.close();
} catch (XPathException e) {
throw new SaxonApiException(e);
}
return result;
}
开发者ID:esacinc,项目名称:crigtt,代码行数:33,代码来源:CrigttSerializer.java
示例13: createFilteredReceiver
import net.sf.saxon.event.Receiver; //导入依赖的package包/类
/**
* Makes a Saxon Receiver that will transparently add a session IDs
* to URLs if they match the servlet URL, or other patterns configured
* in the conf file.
*
* @param trans The transformer that will do the work
* @param req The servlet request being processed
* @param res The servlet response to output to
* @return A Receiver suitable for the target of the transform
*/
public Result createFilteredReceiver(Transformer trans,
HttpServletRequest req,
HttpServletResponse res)
throws XPathException, IOException
{
StreamResult stream = new StreamResult(res.getOutputStream());
TextConfig config = getConfig();
if (config.trackSessions && config.sessionEncodeURLPattern != null)
{
// NOTE: It's a good thing we're no longer defaulting to doing this, because it
// effectively prevents Saxon from being able to switch the xsl:output parameters
// during the transformation (such as in response to an xsl:result-document
// element.)
//
Controller controller = (Controller)trans;
SerializerFactory factory = controller.getConfiguration().getSerializerFactory();
Receiver target = factory.getReceiver(stream,
controller.makePipelineConfiguration(),
trans.getOutputProperties());
return new SessionURLRewriter(target,
config.sessionEncodeURLPattern,
req,
res);
}
else
{
// Return a StreamResult, not a Receiver. This allows Saxon to change the output
// parameters during the transformation (e.g. in response to xsl:result-document).
return stream;
}
}
开发者ID:CDLUC3,项目名称:dash-xtf,代码行数:43,代码来源:TextServlet.java
示例14: SessionURLRewriter
import net.sf.saxon.event.Receiver; //导入依赖的package包/类
/**
* Construct the URL rewriter, recording a reference to the receiver
* that will get the data, and the HTTP servlet response we'll use to
* get session info and to rewrite URLs.
*/
SessionURLRewriter(Receiver underlyingReceiver, Pattern encodeURLPattern,
HttpServletRequest httpRequest,
HttpServletResponse httpResponse)
{
setUnderlyingReceiver(underlyingReceiver);
this.encodeURLPattern = encodeURLPattern;
this.httpRequest = httpRequest;
this.httpResponse = httpResponse;
}
开发者ID:CDLUC3,项目名称:dash-xtf,代码行数:15,代码来源:SessionURLRewriter.java
示例15: sendNamespaceDeclarations
import net.sf.saxon.event.Receiver; //导入依赖的package包/类
/**
* Output all namespace nodes associated with this element.
* @param out The relevant outputter
* @param includeAncestors True if namespaces associated with ancestor
*/
public void sendNamespaceDeclarations(Receiver out, boolean includeAncestors)
throws XPathException
{
if (!document.usesNamespaces) {
return;
}
int ns = nameSpace;
if (ns > 0)
{
while (ns < document.numberOfNamespaces &&
document.namespaceParent[ns] == nodeNum)
{
int nscode = document.namespaceCode[ns];
out.namespace(nscode, 0);
ns++;
}
}
// now add the namespaces defined on the ancestor nodes. We rely on the receiver
// to eliminate multiple declarations of the same prefix
if (includeAncestors && document.isUsingNamespaces())
{
NodeInfo parent = getParent();
if (parent != null) {
parent.sendNamespaceDeclarations(out, true);
}
// terminates when the parent is a root node
}
}
开发者ID:CDLUC3,项目名称:dash-xtf,代码行数:37,代码来源:ElementImpl.java
示例16: copy
import net.sf.saxon.event.Receiver; //导入依赖的package包/类
public void copy(Receiver out, int whichNamespaces, boolean copyAnnotations,
int locationId)
throws XPathException
{
// Make sure our special attribute has been added before allowing access
// to the attributes.
//
addSpecialAttrib();
super.copy(out, whichNamespaces, copyAnnotations, locationId);
}
开发者ID:CDLUC3,项目名称:dash-xtf,代码行数:11,代码来源:SearchElementImpl.java
示例17: sendNamespaceDeclarations
import net.sf.saxon.event.Receiver; //导入依赖的package包/类
/**
* Output all namespace nodes associated with this element.
* @param out The relevant outputter
* @param includeAncestors True if namespaces associated with ancestor
*/
public void sendNamespaceDeclarations(Receiver out, boolean includeAncestors)
throws XPathException
{
super.sendNamespaceDeclarations(out, includeAncestors);
// Be sure to output the XTF namespace at the top level.
if (nodeNum <= 1)
out.namespace(((SearchTree)document).xtfNamespaceCode, 0);
}
开发者ID:CDLUC3,项目名称:dash-xtf,代码行数:15,代码来源:SearchElementImpl.java
示例18: copy
import net.sf.saxon.event.Receiver; //导入依赖的package包/类
/**
* Copy this node to a given outputter
*/
public void copy(Receiver out, int whichNamespaces, boolean copyAnnotations,
int locationId)
throws XPathException
{
int nameCode = getNameCode();
//if ((nameCode>>20 & 0xff) != 0) { // non-null prefix
// check there is no conflict of namespaces
// nameCode = out.checkAttributePrefix(nameCode);
//}
out.attribute(nameCode, -1, getStringValue(), 0, 0);
}
开发者ID:CDLUC3,项目名称:dash-xtf,代码行数:16,代码来源:AttributeImpl.java
示例19: copy
import net.sf.saxon.event.Receiver; //导入依赖的package包/类
/**
* Copy this node to a given outputter
*/
public void copy(Receiver out, int whichNamespaces, boolean copyAnnotations,
int locationId)
throws XPathException
{
// output the children
AxisIterator children = iterateAxis(Axis.CHILD);
while (true) {
NodeInfo child = (NodeInfo)children.next();
if (child == null)
break;
child.copy(out, whichNamespaces, copyAnnotations, locationId);
}
}
开发者ID:CDLUC3,项目名称:dash-xtf,代码行数:17,代码来源:LazyDocument.java
示例20: copy
import net.sf.saxon.event.Receiver; //导入依赖的package包/类
/**
* Copy this node to a given outputter
*/
public void copy(Receiver out, int whichNamespaces, boolean copyAnnotations,
int locationId)
throws XPathException
{
int nameCode = getNameCode();
//if ((nameCode>>20 & 0xff) != 0) { // non-null prefix
// check there is no conflict of namespaces
// nameCode = out.checkAttributePrefix(nameCode);
//}
out.attribute(nameCode, 0, getStringValue(), locationId, 0);
}
开发者ID:CDLUC3,项目名称:dash-xtf,代码行数:16,代码来源:ProxyAttributeImpl.java
注:本文中的net.sf.saxon.event.Receiver类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论