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

Java XdmAtomicValue类代码示例

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

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



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

示例1: processParametersReplacement

import net.sf.saxon.s9api.XdmAtomicValue; //导入依赖的package包/类
/**
 * Replaces the parameters in string
 * @param initialValue The String to change parameters in
 * @param parameters The parameters values
 * @return The initialValue with all parameters replaced
 */
public static String processParametersReplacement(String initialValue, final HashMap<QName,ParameterValue> parameters) {
    String ret = initialValue;
    if(ret.contains("$[")) {
        for(ParameterValue pv: parameters.values()) {
            if(pv.getValue() instanceof String) {
                try {
                    // issue #14
                    ret = ret.replaceAll("\\$\\["+pv.getKey()+"\\]", Matcher.quoteReplacement(pv.getValue().toString()));
                } catch(java.lang.IllegalArgumentException ex) {
                    LOGGER.error("while replacing "+pv.getKey()+" -> "+pv.getValue(),ex);
                    throw ex;
                }
            } else if(pv.getValue() instanceof XdmAtomicValue) {
                String replacer = Matcher.quoteReplacement(((XdmAtomicValue)pv.getValue()).toString());
                ret = ret.replaceAll("\\$\\["+pv.getKey()+"\\]", replacer);
            }
            if(!ret.contains("$[")) break;
        }
    }
    return ret;
}
 
开发者ID:cmarchand,项目名称:gaulois-pipe,代码行数:28,代码来源:ParametersMerger.java


示例2: isValueNull

import net.sf.saxon.s9api.XdmAtomicValue; //导入依赖的package包/类
/**
 * Tests if the given data model value is null or equivalent to null (including empty string).
 *
 * @param pXdmValue Value to test.
 * @return True if the value is null.
 */
static boolean isValueNull(XdmValue pXdmValue) {
  if (pXdmValue == null) {
    return true;
  }
  else if (pXdmValue instanceof XdmEmptySequence) {
    return true;
  }
  else if (pXdmValue instanceof XdmAtomicValue) {
    String lResultString = ((XdmAtomicValue) pXdmValue).getStringValue();
    return XFUtil.isNull(lResultString);
  }
  else {
    return false;
  }
}
 
开发者ID:Fivium,项目名称:FOXopen,代码行数:22,代码来源:SaxonEnvironment.java


示例3: setCustomParameters

import net.sf.saxon.s9api.XdmAtomicValue; //导入依赖的package包/类
private void setCustomParameters(XsltTransformer xsltTransformer) throws XPathException {
	//logger.info("setCustomParameters()");
	final URL 				scriptUrl 		= getScriptUrl();
	final XsltExecutable 	xsltExecutable 	= xsltConrefCache.getTransformerCache().getExecutable(scriptUrl, xsltConrefCache.getUriResolver());
	final List<String> attrNameList = node.getAttributeNamesOfNamespace(NAMESPACE_PARAMETER_URI);
	for (String attrName : attrNameList) {
		//logger.info("attribute: " + attrName);
		final QName 	paramName 	= new QName(attrName.replaceAll("(^[^\\{\\}]*:)|(^\\{.*\\})", ""));
		final String 	paramValue	= node.getAttribute(attrName, NAMESPACE_PARAMETER_URI);
		//logger.info("set custom parameter: " + paramName + " = '" + paramValue + "'");
		if (paramValue != null) {
			if (xsltExecutable.getGlobalParameters().containsKey(paramName)) {
				try {
					xsltTransformer.setParameter(paramName, new XdmAtomicValue(EmbeddedXPathResolver.resolve(paramValue, node), ItemType.UNTYPED_ATOMIC));
					//logger.info("parameters set. ");
				} catch (SaxonApiException e) {
					logger.error(e, e);
				}
			} else {
				//logger.error("Parameter '" + paramName + "' not defined in script.");
			}
		}
	}
}
 
开发者ID:dita-semia,项目名称:dita-semia-resolver,代码行数:25,代码来源:XsltConref.java


示例4: buildMetadata

import net.sf.saxon.s9api.XdmAtomicValue; //导入依赖的package包/类
@Override
protected FhirResourceMetadata<?> buildMetadata(String id, String path, FhirResourceMetadata<?> metadata) throws Exception {
    NodeInfo structDefNodeInfo = this.buildStructDefNodeInfo(id);

    metadata.setUri(URI.create(this.xmlCodec.decode(structDefNodeInfo, StructureDefinitionImpl.class, null).getUrl().getValue()));

    SearchParameter searchParamDef;

    for (XdmNode searchParamNode : this.searchParamDefsXpathExec
        .load(new DynamicXpathOptionsImpl().setContextItem(this.searchParamDocInfo).addVariable(BASE_XPATH_VAR_QNAME, new XdmAtomicValue(path)))
        .evaluateNodes()) {
        metadata.addParamMetadatas(this.buildParamMetadata(structDefNodeInfo, (searchParamDef = this.buildSearchParamDef(searchParamNode)),
            new ResourceParamMetadataImpl(this.specType, SdcctEnumUtils.findById(ResourceParamType.class, searchParamDef.getType().getValue().getId()),
                searchParamDef.getId().getValue(), searchParamDef.getName().getValue())));
    }

    return super.buildMetadata(id, path, metadata);
}
 
开发者ID:esacinc,项目名称:sdcct,代码行数:19,代码来源:FhirResourceMetadataServiceImpl.java


示例5: buildStructDefNodeInfo

import net.sf.saxon.s9api.XdmAtomicValue; //导入依赖的package包/类
private NodeInfo buildStructDefNodeInfo(String structDefId) throws Exception {
    XdmAtomicValue structDefIdValue = new XdmAtomicValue(structDefId);
    XdmNode structDefNode = null;

    for (XdmDocument profileDoc : this.profileDocs) {
        if ((structDefNode = this.structDefXpathExec
            .load(new DynamicXpathOptionsImpl().setContextItem(profileDoc.getUnderlyingNode()).addVariable(ID_XPATH_VAR_QNAME, structDefIdValue))
            .evaluateNode()) != null) {
            break;
        }
    }

    if (structDefNode == null) {
        throw new FatalBeanException(String.format("Unable to find %s StructureDefinition (id=%s) XML node.", this.specType.name(), structDefId));
    }

    return structDefNode.getUnderlyingNode();
}
 
开发者ID:esacinc,项目名称:sdcct,代码行数:19,代码来源:FhirResourceMetadataServiceImpl.java


示例6: convert

import net.sf.saxon.s9api.XdmAtomicValue; //导入依赖的package包/类
@Nullable
@Override
public Object convert(Object src, TypeDescriptor srcType, TypeDescriptor targetType) {
    if (!this.matches(srcType, targetType)) {
        return null;
    }

    Class<?> srcObjType = srcType.getObjectType();

    if (srcObjType.equals(Boolean.class)) {
        return new XdmAtomicValue(((Boolean) src));
    } else if (srcObjType.equals(Integer.class) || srcObjType.equals(Long.class)) {
        return new XdmAtomicValue(((Long) src));
    } else if (srcObjType.equals(Float.class)) {
        return new XdmAtomicValue(((Float) src));
    } else if (srcObjType.equals(Double.class)) {
        return new XdmAtomicValue(((Double) src));
    } else if (srcObjType.equals(QName.class)) {
        return new XdmAtomicValue(((QName) src));
    } else if (srcObjType.equals(URI.class)) {
        return new XdmAtomicValue(((URI) src));
    } else {
        return new XdmAtomicValue(((String) src));
    }
}
 
开发者ID:esacinc,项目名称:sdcct,代码行数:26,代码来源:XdmValueConverter.java


示例7: getFileName

import net.sf.saxon.s9api.XdmAtomicValue; //导入依赖的package包/类
private String getFileName(File sourceFile, HashMap<QName,ParameterValue> parameters) {
    String filename = (prefix!=null?prefix:"") + name + (suffix!=null?suffix:"");
    String sourceName = sourceFile.getName();
    int ix = sourceName.lastIndexOf(".");
    // FIXME: this shouldn't be supported, it has been replaced by input-* pseudo-variables
    String extension = sourceName.substring(ix);
    String basename = sourceName.substring(0, ix);
    String ret = filename.replaceAll("\\$\\{name\\}", sourceName).replaceAll("\\$\\{basename\\}", basename).replaceAll("\\$\\{extension\\}", extension);
    for(ParameterValue pv:parameters.values()) {
        if(pv.getValue() instanceof String || pv.getValue() instanceof XdmAtomicValue) {
            ret = ret.replaceAll("\\$\\["+pv.getKey()+"\\]", pv.getValue().toString());
        }
    }
    return ret;
}
 
开发者ID:cmarchand,项目名称:gaulois-pipe,代码行数:16,代码来源:Output.java


示例8: doTest

import net.sf.saxon.s9api.XdmAtomicValue; //导入依赖的package包/类
@Test
public void doTest() throws SaxonApiException, FileNotFoundException, IOException {
    Configuration config = Configuration.newConfiguration();
    Processor processor = new Processor(config);
    XsltTransformer transformer = processor.newXsltCompiler().compile(new StreamSource("src/test/resources/identity.xsl")).load();
    Serializer serializer = processor.newSerializer(new File("target/generated-test-files/output.xml"));
    FileAppenderStep fas = new FileAppenderStep();
    fas.setParameter(FileAppenderStep.FILE_NAME, new XdmAtomicValue("target/generated-test-files/appendee.txt"));
    fas.setParameter(FileAppenderStep.VALUE, new XdmAtomicValue("blablabla"));
    fas.setParameter(FileAppenderStep.LINE_SEPARATOR, new XdmAtomicValue("LF"));
    fas.setDestination(serializer);
    transformer.setDestination(fas);
    transformer.setSource(new StreamSource("src/test/resources/source.xml"));
    File expect = new File("target/generated-test-files/appendee.txt");
    if(expect.exists()) expect.delete();
    transformer.transform();
    assertTrue(expect.isFile());
    BufferedReader br = new BufferedReader(new FileReader(expect));
    char[] buff = new char[30];
    int ret = br.read(buff);
    br.close();
    assertEquals(10, ret);
    char[] ex = new char[] { 'b', 'l', 'a', 'b', 'l', 'a', 'b', 'l', 'a', '\n'};
    assertArrayEquals(ex, Arrays.copyOf(buff, ret));
    fas.setDestination(processor.newSerializer(new File("target/generated-test-files/output2.xml")));
    transformer.transform();
    br = new BufferedReader(new FileReader(expect));
    ret = br.read(buff);
    br.close();
    assertEquals(20, ret);
}
 
开发者ID:cmarchand,项目名称:gaulois-pipe,代码行数:32,代码来源:FileAppenderStepTest.java


示例9: noReplacementForXdmValue

import net.sf.saxon.s9api.XdmAtomicValue; //导入依赖的package包/类
@Test
public void noReplacementForXdmValue() {
    XdmValue initial = new XdmAtomicValue(BigDecimal.ZERO);
    HashMap<QName, ParameterValue> parameters = new HashMap<>();
    QName qn = new QName("source");
    parameters.put(qn, new ParameterValue(qn,"src/main/xsl", factory.XS_STRING));
    Object ret = ParametersMerger.processParametersReplacement(initial, parameters);
    assertTrue(ret instanceof XdmValue);
    assertEquals(((XdmValue)ret).toString(), "0");
}
 
开发者ID:cmarchand,项目名称:gaulois-pipe,代码行数:11,代码来源:ParametersMergerTest.java


示例10: setXdmValueValueTest

import net.sf.saxon.s9api.XdmAtomicValue; //导入依赖的package包/类
@Test
public void setXdmValueValueTest() throws ValidationException {
    XdmValue value = new XdmAtomicValue(true);
    QName qn_xsBoolean = new QName("xs", DatatypeFactory.NS_XSD, "boolean");
    ParameterValue pv = new ParameterValue(QN, value, factory.getDatatype(qn_xsBoolean));
    assertTrue(pv.getValue() instanceof XdmValue);
    assertEquals(((XdmValue)pv.getValue()).toString(), "true");
}
 
开发者ID:cmarchand,项目名称:gaulois-pipe,代码行数:9,代码来源:ParameterValueTest.java


示例11: getDatatypeXsInt

import net.sf.saxon.s9api.XdmAtomicValue; //导入依赖的package包/类
@Test
public void getDatatypeXsInt() throws ValidationException {
    QName xsInt= new QName(DatatypeFactory.NS_XSD, "xs:int");
    Datatype intDT = instance.getDatatype(xsInt);
    assertFalse("xs:int allows empty sequence", intDT.allowsEmpty());
    assertFalse("xs:int allows multiple values", intDT.allowsMultiple());
    XdmValue ret = intDT.convert("4", saxonConfiguration);
    assertTrue("value is not a XdmAtomicValue", ret instanceof XdmAtomicValue);
    XdmAtomicValue atomRet = (XdmAtomicValue)ret;
    Object javaValue = atomRet.getValue();
    assertTrue("java value is not a BigInteger", javaValue instanceof BigInteger);
}
 
开发者ID:cmarchand,项目名称:gaulois-pipe,代码行数:13,代码来源:DatatypeFactoryTest.java


示例12: getDatatypeXsIntEmpty

import net.sf.saxon.s9api.XdmAtomicValue; //导入依赖的package包/类
@Test
public void getDatatypeXsIntEmpty() throws ValidationException {
    QName xsInt= new QName(DatatypeFactory.NS_XSD, "xs:int?");
    Datatype intDT = instance.getDatatype(xsInt);
    assertTrue("xs:int? does not allow empty sequence", intDT.allowsEmpty());
    assertFalse("xs:int? allows multiple values", intDT.allowsMultiple());
    XdmValue ret = intDT.convert("4", saxonConfiguration);
    assertTrue("value is not a XdmAtomicValue", ret instanceof XdmAtomicValue);
    ret = intDT.convert(null, saxonConfiguration);
    assertEquals("value is not an empty sequence", 0, ret.size());
}
 
开发者ID:cmarchand,项目名称:gaulois-pipe,代码行数:12,代码来源:DatatypeFactoryTest.java


示例13: getDatatypeXsIntMultiple

import net.sf.saxon.s9api.XdmAtomicValue; //导入依赖的package包/类
@Test
public void getDatatypeXsIntMultiple() throws ValidationException {
    QName xsInt= new QName(DatatypeFactory.NS_XSD, "xs:int+");
    Datatype intDT = instance.getDatatype(xsInt);
    assertFalse("xs:int+ allows empty sequence", intDT.allowsEmpty());
    assertTrue("xs:int+ doest not allow multiple values", intDT.allowsMultiple());
    XdmValue ret = intDT.convert("4", saxonConfiguration);
    assertTrue("value is not a XdmAtomicValue", ret instanceof XdmAtomicValue);
    ret = intDT.convert("(4,5, 6 , 7 )", saxonConfiguration);
    assertEquals("value is not a sequence", 4, ret.size());
}
 
开发者ID:cmarchand,项目名称:gaulois-pipe,代码行数:12,代码来源:DatatypeFactoryTest.java


示例14: getStylesheetParametersJAXP

import net.sf.saxon.s9api.XdmAtomicValue; //导入依赖的package包/类
private Map<String, Object> getStylesheetParametersJAXP(ParameterizablePipelineStep step,
    Map<QName, XdmValue> base, Map<QName, XdmValue> extra) throws IOException {
  Map<QName, XdmValue> params = getStylesheetParameters(step, base, extra);
  Map<String, Object> stylesheetParameters = new HashMap<String, Object>();
  for (Map.Entry<QName, XdmValue> entry : params.entrySet()) {
    QName name = entry.getKey();
    XdmValue value = entry.getValue();
    if (!(value instanceof XdmAtomicValue))
      continue;
    stylesheetParameters.put(name.getClarkName(), ((XdmAtomicValue) value).getValue());
  }
  return stylesheetParameters;
}
 
开发者ID:Armatiek,项目名称:xslweb,代码行数:14,代码来源:XSLWebServlet.java


示例15: getStylesheetParameters

import net.sf.saxon.s9api.XdmAtomicValue; //导入依赖的package包/类
@SuppressWarnings({ "unchecked", "rawtypes" })
public static Map<QName, XdmValue> getStylesheetParameters(WebApp webApp, HttpServletRequest req, 
    HttpServletResponse resp, File homeDir) throws Exception {
  Map<QName, XdmValue> params = new HashMap<QName, XdmValue>();
  
  /* Property parameters : */
  Properties props = Context.getInstance().getProperties();
  for (String key : props.stringPropertyNames()) {
    String value = props.getProperty(key);      
    params.put(new QName(Definitions.NAMESPACEURI_XSLWEB_CONFIGURATION, key), new XdmAtomicValue(value));
  }    
  params.put(new QName(Definitions.NAMESPACEURI_XSLWEB_CONFIGURATION, "home-dir"), new XdmAtomicValue(homeDir.getAbsolutePath()));
  params.put(new QName(Definitions.NAMESPACEURI_XSLWEB_CONFIGURATION, "webapp-dir"), new XdmAtomicValue(webApp.getHomeDir().getAbsolutePath()));
  params.put(new QName(Definitions.NAMESPACEURI_XSLWEB_CONFIGURATION, "webapp-path"), new XdmAtomicValue(webApp.getPath()));
  params.put(new QName(Definitions.NAMESPACEURI_XSLWEB_CONFIGURATION, "development-mode"), new XdmAtomicValue(webApp.getDevelopmentMode()));
  params.put(new QName(Definitions.NAMESPACEURI_XSLWEB_CONFIGURATION, "version"), new XdmAtomicValue(Definitions.PROJECT_VERSION));
  
  /* Object parameters: */
  params.put(new QName(Definitions.NAMESPACEURI_XSLWEB_REQUEST, "request"),  XdmValue.wrap(new ObjectValue(req)));
  params.put(new QName(Definitions.NAMESPACEURI_XSLWEB_RESPONSE, "response"),  XdmValue.wrap(new ObjectValue(resp)));
  params.put(new QName(Definitions.NAMESPACEURI_XSLWEB_WEBAPP, "webapp"),  XdmValue.wrap(new ObjectValue(webApp)));
  
  /* Webapp parameters: */
  addStylesheetParameters(params, webApp.getParameters());
  
  return params;
}
 
开发者ID:Armatiek,项目名称:xslweb,代码行数:28,代码来源:XSLWebUtils.java


示例16: addValue

import net.sf.saxon.s9api.XdmAtomicValue; //导入依赖的package包/类
public void addValue(String value) {
  if (value == null) {
    return;
  }
  try {
    if (this.value == null) {
      this.value = new ArrayList<XdmItem>();
    }
    ItemType itemType = itemTypeFactory.getAtomicType(new QName(Definitions.NAMESPACEURI_XMLSCHEMA, this.type));
    this.value.add(new XdmAtomicValue(value, itemType));        
  } catch (SaxonApiException sae) {
    throw new XSLWebException("Error adding parameter value", sae);
  }
}
 
开发者ID:Armatiek,项目名称:xslweb,代码行数:15,代码来源:Parameter.java


示例17: afterPropertiesSet

import net.sf.saxon.s9api.XdmAtomicValue; //导入依赖的package包/类
@Override
public void afterPropertiesSet() throws Exception {
    this.searchParamDocInfo = this.searchParamDoc.getUnderlyingNode();

    NodeInfo structDefNodeInfo = this.buildStructDefNodeInfo(ResourceType.RESOURCE.getId());

    for (ResourceParamMetadata baseParamMetadata : this.baseParamMetadatas) {
        this.buildParamMetadata(
            structDefNodeInfo, this.buildSearchParamDef(this.searchParamDefXpathExec.load(new DynamicXpathOptionsImpl()
                .setContextItem(this.searchParamDocInfo).addVariable(ID_XPATH_VAR_QNAME, new XdmAtomicValue(baseParamMetadata.getId()))).evaluateNode()),
            baseParamMetadata);
    }

    super.afterPropertiesSet();
}
 
开发者ID:esacinc,项目名称:sdcct,代码行数:16,代码来源:FhirResourceMetadataServiceImpl.java


示例18: buildNumberResourceParam

import net.sf.saxon.s9api.XdmAtomicValue; //导入依赖的package包/类
protected void buildNumberResourceParam(String type, Map<MultiKey<Serializable>, ResourceParam<?>> resourceParams, String name,
    ResourceParamMetadata metadata, XdmItem item, V entity) throws Exception {
    if (item instanceof XdmAtomicValue) {
        BigDecimal value = ((XdmAtomicValue) item).getDecimalValue();

        resourceParams.put(new MultiKey<>(name, value), new NumberResourceParamImpl(entity, name, value));
    } else {
        throw new HibernateException(String.format(
            "Unable to build resource (type=%s) entity (class=%s, entityId=%s, id=%s, instanceId=%s, version=%s) number parameter (name=%s, item=%s).",
            type, entity.getClass(), entity.getEntityId(), entity.getId(), entity.getInstanceId(), entity.getVersion(), name, item));
    }
}
 
开发者ID:esacinc,项目名称:sdcct,代码行数:13,代码来源:AbstractResourceParamProcessor.java


示例19: buildStringResourceParam

import net.sf.saxon.s9api.XdmAtomicValue; //导入依赖的package包/类
protected void buildStringResourceParam(String type, Map<MultiKey<Serializable>, ResourceParam<?>> resourceParams, String name,
    ResourceParamMetadata metadata, XdmItem item, V entity) throws Exception {
    if (item instanceof XdmAtomicValue) {
        String value = item.getStringValue();

        resourceParams.put(new MultiKey<>(name, value), new StringResourceParamImpl(entity, name, value));
    } else {
        throw new HibernateException(String.format(
            "Unable to build resource (type=%s) entity (class=%s, entityId=%s, id=%s, instanceId=%s, version=%s) string parameter (name=%s, item=%s).",
            type, entity.getClass(), entity.getEntityId(), entity.getId(), entity.getInstanceId(), entity.getVersion(), name, item));
    }
}
 
开发者ID:esacinc,项目名称:sdcct,代码行数:13,代码来源:AbstractResourceParamProcessor.java


示例20: buildTokenResourceParam

import net.sf.saxon.s9api.XdmAtomicValue; //导入依赖的package包/类
protected void buildTokenResourceParam(String type, Map<MultiKey<Serializable>, ResourceParam<?>> resourceParams, String name,
    ResourceParamMetadata metadata, XdmItem item, V entity) throws Exception {
    if (item instanceof XdmAtomicValue) {
        String value = item.getStringValue();

        resourceParams.put(new MultiKey<>(name, value), new TokenResourceParamImpl(entity, false, name, null, null, null, value));
    } else {
        throw new HibernateException(String.format(
            "Unable to build resource (type=%s) entity (class=%s, entityId=%s, id=%s, instanceId=%s, version=%s) token parameter (name=%s, item=%s).", type,
            entity.getClass(), entity.getEntityId(), entity.getId(), entity.getInstanceId(), entity.getVersion(), name, item));
    }
}
 
开发者ID:esacinc,项目名称:sdcct,代码行数:13,代码来源:AbstractResourceParamProcessor.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Java CommentStyle类代码示例发布时间:2022-05-22
下一篇:
Java InteractEvent类代码示例发布时间: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