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

Java QName类代码示例

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

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



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

示例1: visitComplexQuery

import org.exist.dom.QName; //导入依赖的package包/类
@Override
public IntermediateExpr visitComplexQuery(final ComplexQueryContext ctx) {
    if(ctx.queryOperator() != null) {
        final QName qnQueryOperator = toQName(ctx.queryOperator());
        builder.startElement(qnQueryOperator, null);
    }

    visit(ctx.simpleQuery());

    if(ctx.queryOperator() != null) {
        visit(ctx.complexQuery());
        builder.endElement();
    }

    return null;
}
 
开发者ID:BCDH,项目名称:cql-module,代码行数:17,代码来源:CorpusQLXMLVisitor.java


示例2: visitSimpleQuery

import org.exist.dom.QName; //导入依赖的package包/类
@Override
public IntermediateExpr visitSimpleQuery(final SimpleQueryContext ctx) {
    if(ctx.booleanOperator() != null) {
        final QName qnBooleanOperator = toQName(ctx.booleanOperator());
        builder.startElement(qnBooleanOperator, null);
    }

    visit(ctx.sequence());

    if(ctx.booleanOperator() != null) {
        visit(ctx.simpleQuery());
        builder.endElement();
    }

    return null;
}
 
开发者ID:BCDH,项目名称:cql-module,代码行数:17,代码来源:CorpusQLXMLVisitor.java


示例3: visitPositionLong

import org.exist.dom.QName; //导入依赖的package包/类
@Override
public IntermediateExpr visitPositionLong(final PositionLongContext ctx) {
    if(ctx.booleanOperator() != null) {
        final QName qnBooleanOperator = toQName(ctx.booleanOperator());
        builder.startElement(qnBooleanOperator, null);
    }

    visit(ctx.positionLongPart());

    if(ctx.booleanOperator() != null) {
        visit(ctx.positionLong());
        builder.endElement();
    }

    return null;
}
 
开发者ID:BCDH,项目名称:cql-module,代码行数:17,代码来源:CorpusQLXMLVisitor.java


示例4: createFailureDoc

import org.exist.dom.QName; //导入依赖的package包/类
/**
 * Creates a failure document based on the failure result from the weather web-service
 *
 * @param response The response from the weather web-service call
 *
 * @return An in-memory document representing the failure
 */
private final org.exist.memtree.DocumentImpl createFailureDoc(final ClientResponse response) throws JobException {
    try {
        final MemTreeBuilder builder = new MemTreeBuilder();
        builder.startDocument();

        final DatatypeFactory datatypeFactory = DatatypeFactory.newInstance();
        final XMLGregorianCalendar xmlCal = datatypeFactory.newXMLGregorianCalendar(new GregorianCalendar());

        final AttributesImpl attribs = new AttributesImpl();
        final ClientResponse.Status status = response.getClientResponseStatus();
        attribs.addAttribute(null, "at", "at", "string", xmlCal.toXMLFormat());
        attribs.addAttribute(null, "http-status", "http-status", "string", String.valueOf(status.getStatusCode()));
        attribs.addAttribute(null, "http-reason", "http-status", "string", String.valueOf(status.getReasonPhrase()));

        builder.startElement(new QName("failed"), attribs);
        builder.characters(response.getEntity(String.class));
        builder.endElement();
        builder.endDocument();

        return builder.getDocument();
    } catch(final DatatypeConfigurationException dce) {
        final String msg = "Unable to configure XML DatatypeFactory: " + dce.getMessage();
        throw new JobException(JobException.JobExceptionAction.JOB_ABORT_THIS, msg);
    }
}
 
开发者ID:eXist-book,项目名称:book-code,代码行数:33,代码来源:WeatherJob.java


示例5: visitValueWith

import org.exist.dom.QName; //导入依赖的package包/类
@Override
public IntermediateExpr visitValueWith(final ValueWithContext ctx) {
    final QName qnBooleanOperator = toQName(ctx.booleanOperator());
    builder.startElement(qnBooleanOperator, null);

    visit(ctx.valuePart());
    visit(ctx.value());

    builder.endElement();

    return null;
}
 
开发者ID:BCDH,项目名称:cql-module,代码行数:13,代码来源:CorpusQLXMLVisitor.java


示例6: toQName

import org.exist.dom.QName; //导入依赖的package包/类
private QName toQName(final QueryOperatorContext queryOperatorContext) {
    final IntermediateExpr queryOperator = visit(queryOperatorContext);
    final QName qnQueryOperator;
    if (queryOperator == WITHIN) {
        qnQueryOperator = QN_WITHIN;
    } else if (queryOperator == CONTAINING) {
        qnQueryOperator = QN_CONTAINING;
    } else {
        throw new IllegalStateException("Unknown queryOperator: " + queryOperator);
    }

    return qnQueryOperator;
}
 
开发者ID:BCDH,项目名称:cql-module,代码行数:14,代码来源:CorpusQLXMLVisitor.java


示例7: execute

import org.exist.dom.QName; //导入依赖的package包/类
@Override
public void execute(final DBBroker broker) throws EXistException {

    try {

        //setup an output document
        final MemTreeBuilder builder = new MemTreeBuilder();
        builder.startDocument();

        final DatatypeFactory datatypeFactory = DatatypeFactory.newInstance();
        final XMLGregorianCalendar xmlCal = datatypeFactory.newXMLGregorianCalendar(new GregorianCalendar());

        final AttributesImpl attribs = new AttributesImpl();
        attribs.addAttribute(null, "timestamp", "timestamp", "string", xmlCal.toXMLFormat());
        builder.startElement(new QName("stats"), attribs);

        //collect stats
        collectStats(broker, XmldbURI.DB, builder);

        //finalise output document
        builder.endElement();
        builder.endDocument();

        //store stats document
        storeDocument(broker, statsCollection, builder.getDocument(), false);

    } catch(final DatatypeConfigurationException dce) {
        final String msg = "Unable to configure XML DatatypeFactory: " + dce.getMessage();
        LOG.error(msg, dce);
        throw new EXistException(msg, dce);
    } catch(final PermissionDeniedException pde) {
        LOG.error(pde);
        throw new EXistException(pde);
    } catch(final StoreException se) {
        LOG.error(se);
        throw new EXistException(se);
    }
}
 
开发者ID:eXist-book,项目名称:book-code,代码行数:39,代码来源:StatsSystemTask.java


示例8: collectStats

import org.exist.dom.QName; //导入依赖的package包/类
/**
 * Collects statistics about a Collection and its documents and sub-collections recursively
 * writes the results to the builder
 *
 * @param broker The database broker to use to access the database
 * @param collUri The absolute database URI of the collection to generate statistics for
 * @param builder The builder to write the statistics output to
 */
private void collectStats(final DBBroker broker, final XmldbURI collUri, final MemTreeBuilder builder) throws PermissionDeniedException {

    final Collection collection = broker.getCollection(collUri);

    final AttributesImpl attribs = new AttributesImpl();
    attribs.addAttribute(null, "name", "name", "string", collection.getURI().lastSegment().toString());
    attribs.addAttribute(null, "uri", "uri", "string", collection.getURI().toString());
    attribs.addAttribute(null, "sub-collections", "sub-collections", "string", Integer.toString(collection.getChildCollectionCount(broker)));
    attribs.addAttribute(null, "documents", "documents", "string", Integer.toString(collection.getDocumentCountNoLock(broker)));

    builder.startElement(new QName("collection"), attribs);

    final Iterator<DocumentImpl> itDocs = collection.iteratorNoLock(broker);
    while(itDocs.hasNext()) {
        final DocumentImpl doc = itDocs.next();

        final AttributesImpl docAttribs = new AttributesImpl();
        docAttribs.addAttribute(null, "name", "name", "string", doc.getURI().lastSegment().toString());
        docAttribs.addAttribute(null, "uri", "uri", "string", doc.getURI().toString());
        docAttribs.addAttribute(null, "nodes", "nodes", "string", Long.toString(countNodes(doc)));

        builder.startElement(new QName("document"), docAttribs);
        builder.endElement();
    }

    final Iterator<XmldbURI> itColls = collection.collectionIteratorNoLock(broker);
    while(itColls.hasNext()) {
        final XmldbURI childCollUri = collUri.append(itColls.next());
        collectStats(broker, childCollUri, builder);
    }

    builder.endElement();
}
 
开发者ID:eXist-book,项目名称:book-code,代码行数:42,代码来源:StatsSystemTask.java


示例9: sayHelloWorld

import org.exist.dom.QName; //导入依赖的package包/类
/**
 * Constructs the in-memory XML document:
 * <hello>world</hello>
 *
 * @return The in-memory XML document
 */
private Sequence sayHelloWorld() {
    final MemTreeBuilder builder = new MemTreeBuilder();
    builder.startDocument();
    builder.startElement(new QName("hello", HelloModule.NS, HelloModule.NS_PREFIX), null);
    builder.characters("world");
    builder.endElement();
    builder.endDocument();

    return builder.getDocument();
}
 
开发者ID:eXist-book,项目名称:book-code,代码行数:17,代码来源:HelloFunctions.java


示例10: execute

import org.exist.dom.QName; //导入依赖的package包/类
@Override
public void execute(final DBBroker sysBroker, final Map<String, List<? extends Object>> params) {

    //get the target parameter for where to store the modules summary
    final List<? extends Object> maybeTarget = params.get("target");
    if(maybeTarget == null || maybeTarget.size() != 1) {
        LOG.error("Missing 'target' parameter which provides the database uri for storing the modules summary!");
        return;

    } else {
        final String target = (String)maybeTarget.get(0);

        //start a document
        final MemTreeBuilder builder = new MemTreeBuilder();
        builder.startDocument();
        builder.startElement(new QName("modules-summary"), null);

        //get java modules info into document
        final Configuration existConf = sysBroker.getConfiguration();
        buildModulesSummary(existConf, builder);

        //finish document
        builder.endElement();
        builder.endDocument();

        //store document
        storeDocument(sysBroker, XmldbURI.create(target), builder.getDocument());
    }
}
 
开发者ID:eXist-book,项目名称:book-code,代码行数:30,代码来源:ConfiguredModulesStartupTrigger.java


示例11: buildModuleSummary

import org.exist.dom.QName; //导入依赖的package包/类
/**
 * Writes a summary of a module to the builder
 *
 * @param configuredModule The configured module. key is the URI, value is the implementing class.
 * @param builder The builder for writing out the summary
 */
private void buildModuleSummary(final  Map.Entry<String, Class<?>> configuredModule, final MemTreeBuilder builder) {

    //instantiate an instance of the module
    final Class<InternalModule> moduleClass = (Class<InternalModule>)configuredModule.getValue();
    final Constructor ctr = moduleClass.getConstructors()[0];
    final Object[] ctrParams = new Object[ctr.getParameterTypes().length];

    AttributesImpl attribs;
    String description = null;
    try {
        final InternalModule module = (InternalModule)ctr.newInstance(ctrParams);
        attribs = new AttributesImpl();
        attribs.addAttribute(null, "prefix", "prefix", "string", module.getDefaultPrefix());
        attribs.addAttribute(null, "uri", "uri", "string", module.getNamespaceURI());
        attribs.addAttribute(null, "class", "class", "string", moduleClass.getName());
        attribs.addAttribute(null, "released-in", "released-in", "string", module.getReleaseVersion());

        description = module.getDescription();

    } catch(final Exception e) {
        LOG.error("Unable to build module summary for: " + moduleClass.getName(), e);

        attribs = new AttributesImpl();
        attribs.addAttribute(null, "uri", "uri", "string", configuredModule.getKey());
        attribs.addAttribute(null, "class", "class", "string", moduleClass.getName());
    }

    builder.startElement(new QName("module"), attribs);
    if(description != null) {
        builder.characters(description);
    }
    builder.endElement();
}
 
开发者ID:eXist-book,项目名称:book-code,代码行数:40,代码来源:ConfiguredModulesStartupTrigger.java


示例12: QName

import org.exist.dom.QName; //导入依赖的package包/类
private static QName QName(final String localPart) {
    return new QName(localPart, CQLModule.CQL_MODULE_NS, CQLModule.CQL_MODULE_PREFIX);
}
 
开发者ID:BCDH,项目名称:cql-module,代码行数:4,代码来源:CorpusQLXMLVisitor.java


示例13: add

import org.exist.dom.QName; //导入依赖的package包/类
public AttributesBuilder add(final QName name, final String value) {
    attrs.addAttribute("", name.getLocalPart(), name.getLocalPart(), "CDATA", value);
    return this;
}
 
开发者ID:BCDH,项目名称:cql-module,代码行数:5,代码来源:CorpusQLXMLVisitor.java


示例14: CouchbaseErrorCode

import org.exist.dom.QName; //导入依赖的package包/类
public CouchbaseErrorCode(final String code, final String description) {
    super(new QName(code, NAMESPACE_URI, PREFIX), description);
}
 
开发者ID:weXsol,项目名称:Couchbase,代码行数:4,代码来源:CouchbaseModule.java


示例15: MARCErrorCode

import org.exist.dom.QName; //导入依赖的package包/类
private MARCErrorCode(final String aCode, final String aMessage) {
    super(new QName(aCode, MARCModule.NAMESPACE_URI, MARCModule.PREFIX), aMessage);
}
 
开发者ID:ksclarke,项目名称:freelib-marc4j-exist,代码行数:4,代码来源:ErrorCodes.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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