• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java DocumentInfo类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中net.sf.saxon.om.DocumentInfo的典型用法代码示例。如果您正苦于以下问题:Java DocumentInfo类的具体用法?Java DocumentInfo怎么用?Java DocumentInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



DocumentInfo类属于net.sf.saxon.om包,在下文中一共展示了DocumentInfo类的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: convertToDocument

import net.sf.saxon.om.DocumentInfo; //导入依赖的package包/类
public Document convertToDocument(String xml) throws XQException {
  	
  	String baseURI = sqc.getBaseURI(); 
      StringReader sr = new StringReader(xml);
      InputSource is = new InputSource(sr);
      is.setSystemId(baseURI);
      Source source = new SAXSource(is);
      source.setSystemId(baseURI);
      
      try {
      	DocumentInfo doc = config.buildDocument(source);
      	return (Document) DocumentOverNodeInfo.wrap(doc);
} catch (XPathException ex) {
	throw new XQException(ex.getMessage());
}
  }
 
开发者ID:dsukhoroslov,项目名称:bagri,代码行数:17,代码来源:XQProcessorImpl.java


示例2: readXMLStub

import net.sf.saxon.om.DocumentInfo; //导入依赖的package包/类
/**
 * Reads in the first part of an XML file, stopping at the first
 * close-element marker. Generally this captures enough information to
 * identify which kind of XML data is inside the file.
 * @throws IOException if the file can't be read
 * @throws XPathException if the document cannot be parsed
 */
public static DocumentInfo readXMLStub(XPathContext context, String filePath)
  throws IOException, XPathException
{
  // First, locate the file
  File file = resolveFile(context, filePath);
  if (!file.canRead())
    throw new IOException("Cannot read file '" + file.toString() + "'");
  
  // Now read it in, up to the first close-element marker.
  XMLStubReader xmlReader = new XMLStubReader();
  BufferedInputStream bufStream = new BufferedInputStream(new FileInputStream(file));
  InputSource inputSrc = new InputSource(bufStream);
  inputSrc.setSystemId(file.toURI().toString());
  Source saxSrc = new SAXSource(xmlReader, inputSrc);
  DocumentInfo doc = context.getConfiguration().buildDocument(saxSrc);
  return doc;
}
 
开发者ID:CDLUC3,项目名称:dash-xtf,代码行数:25,代码来源:FileUtils.java


示例3: readHTMLPage

import net.sf.saxon.om.DocumentInfo; //导入依赖的package包/类
/**
 * Reads in an HTML page (specified by URL), and uses JTidy to make it into
 * XML that can be subsequently processed by a stylesheet.
 * 
 * @throws IOException if the file can't be read
 * @throws XPathException if the document cannot be parsed
 */
public static DocumentInfo readHTMLPage(XPathContext context, String urlStr)
  throws IOException, XPathException
{
  // Read the HTML page, and convert it to an XML string
  URL url;
  URLConnection connection;
  InputStream inStream = null;
  String pageStr;
  try {
    url = new URL(urlStr);
    connection = url.openConnection();
    inStream = connection.getInputStream();
    pageStr = HTMLToString.convert(inStream);
  }
  finally {
    if (inStream != null)
      inStream.close();
  }
  
  // And convert that string to an in-memory XML document.
  DocumentInfo doc = context.getConfiguration().buildDocument(
      new StreamSource(new StringReader(pageStr), urlStr));
  return doc;
}
 
开发者ID:CDLUC3,项目名称:dash-xtf,代码行数:32,代码来源:FileUtils.java


示例4: constructIndex

import net.sf.saxon.om.DocumentInfo; //导入依赖的package包/类
/**
 * Optimized to use node test directly when possible, for speed.
 */
protected void constructIndex(DocumentInfo doc, Map index,
                            KeyDefinition keydef,
                            BuiltInAtomicType soughtItemType,
                            Set foundItemTypes, XPathContext context,
                            boolean isFirst)
  throws XPathException 
{
  PatternFinder match = keydef.getMatch();
  if (match instanceof NodeTestPattern) {
    match = new FastNodeTestPattern(((NodeTestPattern)match).getNodeTest());
    KeyDefinition oldDef = keydef;
    keydef = new KeyDefinition(match, 
                               oldDef.getUse(),
                               oldDef.getCollationName(), 
                               oldDef.getCollation());
  }
  super.constructIndex(doc, index, keydef, soughtItemType,
                       foundItemTypes, context, isFirst);
}
 
开发者ID:CDLUC3,项目名称:dash-xtf,代码行数:23,代码来源:LazyKeyManager.java


示例5: toDOMDocument

import net.sf.saxon.om.DocumentInfo; //导入依赖的package包/类
@Converter
public static Document toDOMDocument(NodeInfo node) throws XPathException {
    switch (node.getNodeKind()) {
    case Type.DOCUMENT:
        // DOCUMENT type nodes can be wrapped directly
        return (Document) NodeOverNodeInfo.wrap(node);
    case Type.ELEMENT:
        // ELEMENT nodes need to build a new DocumentInfo before wrapping
        Configuration config = node.getConfiguration();
        DocumentInfo documentInfo = config.buildDocument(node);
        return (Document) NodeOverNodeInfo.wrap(documentInfo);
    default:
        return null;
    }
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:16,代码来源:SaxonConverter.java


示例6: getDocumentRoot

import net.sf.saxon.om.DocumentInfo; //导入依赖的package包/类
/**
    * Get the root node, if it is a document node.
    *
    * @return the DocumentInfo representing the containing document.
    */

public DocumentInfo getDocumentRoot() {
	if (docWrapper.node instanceof Document) {
           return docWrapper;
       } else {
           return null;
       }
}
 
开发者ID:kenweezy,项目名称:teiid,代码行数:14,代码来源:NodeWrapper.java


示例7: build

import net.sf.saxon.om.DocumentInfo; //导入依赖的package包/类
@Override
public XdmDocument build(Source src) throws SaxonApiException {
    return new XdmDocument(((DocumentInfo) super.build(src).getUnderlyingNode()), src.getSystemId());
}
 
开发者ID:esacinc,项目名称:crigtt,代码行数:5,代码来源:CrigttDocumentBuilder.java


示例8: selectNodes

import net.sf.saxon.om.DocumentInfo; //导入依赖的package包/类
public SequenceIterator selectNodes(DocumentInfo doc, final XPathContext context) 
  throws XPathException 
{
  if (getNodeKind() == Type.ELEMENT)
    return doc.iterateAxis(Axis.DESCENDANT, getNodeTest());
  return super.selectNodes(doc, context);
}
 
开发者ID:CDLUC3,项目名称:dash-xtf,代码行数:8,代码来源:FastNodeTestPattern.java


示例9: createDynamicContext

import net.sf.saxon.om.DocumentInfo; //导入依赖的package包/类
/**
 * Creates a dynamic context for the given exchange
 */
protected DynamicQueryContext createDynamicContext(Exchange exchange) throws Exception {
    Configuration config = getConfiguration();
    DynamicQueryContext dynamicQueryContext = new DynamicQueryContext(config);

    Message in = exchange.getIn();
    Item item = null;
    if (ObjectHelper.isNotEmpty(getHeaderName())) {
        item = in.getHeader(getHeaderName(), Item.class);
    } else {
        item = in.getBody(Item.class);
    }
    if (item != null) {
        dynamicQueryContext.setContextItem(item);
    } else {
        Object body = null;
        if (ObjectHelper.isNotEmpty(getHeaderName())) {
            body = in.getHeader(getHeaderName());
        } else {
            body = in.getBody();
        }

        // the underlying input stream, which we need to close to avoid locking files or other resources
        InputStream is = null;
        try {
            Source source;
            // only convert to input stream if really needed
            if (isInputStreamNeeded(exchange)) {
                if (ObjectHelper.isNotEmpty(getHeaderName())) {
                    is = exchange.getIn().getHeader(getHeaderName(), InputStream.class);
                } else {
                    is = exchange.getIn().getBody(InputStream.class);
                }
                source = getSource(exchange, is);
            } else {
                source = getSource(exchange, body);
            }

            // special for bean invocation
            if (source == null) {
                if (body instanceof BeanInvocation) {
                    // if its a null bean invocation then handle that
                    BeanInvocation bi = exchange.getContext().getTypeConverter().convertTo(BeanInvocation.class, body);
                    if (bi.getArgs() != null && bi.getArgs().length == 1 && bi.getArgs()[0] == null) {
                        // its a null argument from the bean invocation so use null as answer
                        source = null;
                    }
                }
            }

            if (source == null) {
                // indicate it was not possible to convert to a Source type
                throw new NoTypeConversionAvailableException(body, Source.class);
            }

            DocumentInfo doc = config.buildDocument(source);
            dynamicQueryContext.setContextItem(doc);
        } finally {
            // can deal if is is null
            IOHelper.close(is);
        }
    }
    
    configureQuery(dynamicQueryContext, exchange);
    // call the reset if the in message body is StreamCache
    MessageHelper.resetStreamCache(exchange.getIn());
    return dynamicQueryContext;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:71,代码来源:XQueryBuilder.java


示例10: XdmDocument

import net.sf.saxon.om.DocumentInfo; //导入依赖的package包/类
public XdmDocument(DocumentInfo docInfo) {
    this(docInfo, null);
}
 
开发者ID:esacinc,项目名称:crigtt,代码行数:4,代码来源:XdmDocument.java


示例11: getUnderlyingNode

import net.sf.saxon.om.DocumentInfo; //导入依赖的package包/类
@Override
public DocumentInfo getUnderlyingNode() {
    return ((DocumentInfo) super.getUnderlyingNode());
}
 
开发者ID:esacinc,项目名称:crigtt,代码行数:5,代码来源:XdmDocument.java


示例12: getXdmNode

import net.sf.saxon.om.DocumentInfo; //导入依赖的package包/类
@Override
public XdmDocument getXdmNode() {
    return new XdmDocument(((DocumentInfo) super.getXdmNode().getUnderlyingNode()));
}
 
开发者ID:esacinc,项目名称:crigtt,代码行数:5,代码来源:XdmDocumentDestination.java


示例13: getDocumentRoot

import net.sf.saxon.om.DocumentInfo; //导入依赖的package包/类
/** Loads the real node and defers to it */
public @Override DocumentInfo getDocumentRoot() {
  return real().getDocumentRoot();
}
 
开发者ID:CDLUC3,项目名称:dash-xtf,代码行数:5,代码来源:ProxyElement.java


示例14: getDocumentRoot

import net.sf.saxon.om.DocumentInfo; //导入依赖的package包/类
/**
 * Get the root (document) node
 * @return the DocumentInfo representing the containing document
 */
public @Override DocumentInfo getDocumentRoot() {
  return element.document.getDocumentRoot();
}
 
开发者ID:CDLUC3,项目名称:dash-xtf,代码行数:8,代码来源:AttributeImpl.java


示例15: getDocumentRoot

import net.sf.saxon.om.DocumentInfo; //导入依赖的package包/类
/**
 * Get the root (document) node
 * @return the DocumentInfo representing the document node, or null if the
 * root of the tree is not a document node
 */
public DocumentInfo getDocumentRoot() {
  return ((rootNodeNum == nodeNum) ? this : null);
}
 
开发者ID:CDLUC3,项目名称:dash-xtf,代码行数:9,代码来源:LazyDocument.java


示例16: getDocumentRoot

import net.sf.saxon.om.DocumentInfo; //导入依赖的package包/类
/**
 * Get the root (document) node
 *
 * @return the DocumentInfo representing the containing document
 */
public DocumentInfo getDocumentRoot() {
  return getParent().getDocumentRoot();
}
 
开发者ID:CDLUC3,项目名称:dash-xtf,代码行数:9,代码来源:NodeImpl.java


示例17: getDocumentRoot

import net.sf.saxon.om.DocumentInfo; //导入依赖的package包/类
/**
 * Get the root (document) node
 * @return the DocumentInfo representing the containing document
 */
public DocumentInfo getDocumentRoot() {
  return element.document.getDocumentRoot();
}
 
开发者ID:CDLUC3,项目名称:dash-xtf,代码行数:8,代码来源:ProxyAttributeImpl.java


示例18: nodeFromFile

import net.sf.saxon.om.DocumentInfo; //导入依赖的package包/类
/**
 * Constructs a DocumentInfo Node from the given classpath resource
 * @param fileName
 * @return
 * @throws XPathException
 */
public static DocumentInfo nodeFromFile(String fileName) throws XPathException {
    //TODO If we ever want custom configuration, we'll need to pass the processor from the XQueryContext into here...
    return new Processor(false).getUnderlyingConfiguration().buildDocument(new StreamSource(SaxonHelpers.class.getResourceAsStream(fileName)));
}
 
开发者ID:SteveGodwin,项目名称:mock-xquery,代码行数:11,代码来源:SaxonHelpers.java



注:本文中的net.sf.saxon.om.DocumentInfo类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Topic类代码示例发布时间:2022-05-23
下一篇:
Java OAuthCredentialsResponse类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap