本文整理汇总了Java中net.sf.saxon.value.EmptySequence类的典型用法代码示例。如果您正苦于以下问题:Java EmptySequence类的具体用法?Java EmptySequence怎么用?Java EmptySequence使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
EmptySequence类属于net.sf.saxon.value包,在下文中一共展示了EmptySequence类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getPath
import net.sf.saxon.value.EmptySequence; //导入依赖的package包/类
public static Sequence getPath(KeyDefInterface keyDef) {
if (keyDef != null) {
List<String> path = keyDef.getNamespaceList();
List<Item> list = new LinkedList<>();
if (path != null) {
for (String element : path) {
list.add(new StringValue(element));
}
}
list.add(new StringValue(keyDef.getKey()));
//logger.info("result: " + keyDef.getNamespace() + " " + keyDef.getKey());
return new SequenceExtent(list);
} else {
//logger.info("result: ()");
return EmptySequence.getInstance();
}
}
开发者ID:dita-semia,项目名称:dita-semia-resolver,代码行数:18,代码来源:AncestorPathCall.java
示例2: call
import net.sf.saxon.value.EmptySequence; //导入依赖的package包/类
@Override
public Sequence call(XPathContext context, Sequence[] arguments) throws XPathException {
final SaxonNodeWrapper keyRefNode = new SaxonNodeWrapper((NodeInfo)arguments[0].head(), otResolver.getXPathCache());
final KeyRef keyRef = KeyRef.fromNode(keyRefNode);
final Item keyDefItem = arguments[1].head();
if ((keyRef == null) || (keyDefItem == null)) {
return EmptySequence.getInstance();
} else {
final KeyDefInterface keyDef = DitaSemiaOtResolver.getKeyDefFromItem(arguments[1].head());
final DisplaySuffix displaySuffix = keyRef.getDisplaySuffix(keyDef, false);
final List<Item> list = new LinkedList<>();
list.add(new StringValue(displaySuffix.keySuffix));
list.add(new StringValue(displaySuffix.nameSuffix));
return new SequenceExtent(list);
}
}
开发者ID:dita-semia,项目名称:dita-semia-resolver,代码行数:21,代码来源:GetKeyRefDisplaySuffixCall.java
示例3: makeCallExpression
import net.sf.saxon.value.EmptySequence; //导入依赖的package包/类
@Override
public ExtensionFunctionCall makeCallExpression() {
return new ExtensionFunctionCall() {
public SequenceIterator call(SequenceIterator[] arguments,
XPathContext context) throws XPathException {
String text = "";
try {
text = ((StringValue) arguments[0].next()).getStringValue();
// Split street name and number + addition, return number + addition
// Find first number, and return everything including and after that
// position.
// TODO: Problem some street names have numbers in them...
int i;
for (i = 0; i < text.length(); i++) {
char c = text.charAt(i);
if (Character.isDigit(c)) {
break;
}
}
if (i == text.length()) {
return Value.asIterator(EmptySequence.getInstance());
}
text = text.substring(i, text.length()).trim();
} catch (Exception e) {
return Value.asIterator(EmptySequence.getInstance());
}
return Value.asIterator(StringValue.makeStringValue(text));
}
};
}
开发者ID:erfgoed-en-locatie,项目名称:artsholland-platform,代码行数:36,代码来源:ExtractStreetNumberFunction.java
示例4: makeCallExpression
import net.sf.saxon.value.EmptySequence; //导入依赖的package包/类
@Override
public ExtensionFunctionCall makeCallExpression() {
return new ExtensionFunctionCall() {
public SequenceIterator call(SequenceIterator[] arguments,
XPathContext context) throws XPathException {
// grijpt nummer uit string en plakt eventuele toevoeging eraan vast
String streetName = "";
try {
streetName = ((StringValue) arguments[0].next()).getStringValue();
streetName = sanitizeStreetName(streetName);
} catch (Exception e) {
return Value.asIterator(EmptySequence.getInstance());
}
if (streetName.length() == 0) {
return Value.asIterator(EmptySequence.getInstance());
}
return Value.asIterator(StringValue.makeStringValue(streetName));
}
};
}
开发者ID:erfgoed-en-locatie,项目名称:artsholland-platform,代码行数:21,代码来源:StreetNameFunction.java
示例5: makeCallExpression
import net.sf.saxon.value.EmptySequence; //导入依赖的package包/类
@Override
public ExtensionFunctionCall makeCallExpression() {
return new ExtensionFunctionCall() {
public SequenceIterator call(SequenceIterator[] arguments,
XPathContext context) throws XPathException {
String type = "";
try {
type = ((StringValue) arguments[0].next()).getStringValue();
// Rewrite TAM export types
if (TYPES.containsKey(type)) {
String newType = TYPES.get(type);
return Value.asIterator(StringValue.makeStringValue(newType));
} else {
return Value.asIterator(EmptySequence.getInstance());
}
} catch (Exception e) {
return Value.asIterator(EmptySequence.getInstance());
}
}
};
}
开发者ID:erfgoed-en-locatie,项目名称:artsholland-platform,代码行数:23,代码来源:WebContentTypeFunction.java
示例6: makeCallExpression
import net.sf.saxon.value.EmptySequence; //导入依赖的package包/类
@Override
public ExtensionFunctionCall makeCallExpression() {
return new ExtensionFunctionCall() {
public SequenceIterator call(SequenceIterator[] arguments,
XPathContext context) throws XPathException {
String postalCode = "";
String number = "";
String addition = "";
try {
postalCode = ((StringValue) arguments[0].next()).getStringValue();
number = ((StringValue) arguments[1].next()).getStringValue();
if (arguments.length == 3) {
addition = ((StringValue) arguments[2].next()).getStringValue();
}
} catch (Exception e) {
return Value.asIterator(EmptySequence.getInstance());
}
if (postalCode.length() > 0 && number.length() > 0) {
//addition may be empty sequence
String address = postalCode + number + addition;
address = address
.replaceAll("\\s+","")
.replaceAll("\\/+", "-")
.replaceAll("\\\\+", "-");
return Value.asIterator(StringValue.makeStringValue(address));
} else {
return Value.asIterator(EmptySequence.getInstance());
}
}
};
}
开发者ID:erfgoed-en-locatie,项目名称:artsholland-platform,代码行数:32,代码来源:AddressUriFunction.java
示例7: makeCallExpression
import net.sf.saxon.value.EmptySequence; //导入依赖的package包/类
@Override
public ExtensionFunctionCall makeCallExpression() {
return new ExtensionFunctionCall() {
public SequenceIterator call(SequenceIterator[] arguments,
XPathContext context) throws XPathException {
boolean result = false;
try {
String str = ((StringValue) arguments[0].next()).getStringValue();
// TODO: are values > 1 also true?
result = (str.equals("1") || str.toLowerCase().equals("true")) ? true : false;
} catch (Exception e) {
return Value.asIterator(EmptySequence.getInstance());
}
return Value.asIterator(StringValue.makeStringValue(Boolean.toString(result)));
}
};
}
开发者ID:erfgoed-en-locatie,项目名称:artsholland-platform,代码行数:20,代码来源:ParseBooleanFunction.java
示例8: makeCallExpression
import net.sf.saxon.value.EmptySequence; //导入依赖的package包/类
@Override
public ExtensionFunctionCall makeCallExpression() {
return new ExtensionFunctionCall() {
public SequenceIterator call(SequenceIterator[] arguments,
XPathContext context) throws XPathException {
String text = "";
try {
text = ((StringValue) arguments[0].next()).getStringValue();
if (text.length() == 1) {
text = text.toUpperCase();
} else {
text = text.substring(0, 1).toUpperCase() + text.substring(1).toLowerCase();
}
} catch (Exception e) {
return Value.asIterator(EmptySequence.getInstance());
}
return Value.asIterator(StringValue.makeStringValue(text));
}
};
}
开发者ID:erfgoed-en-locatie,项目名称:artsholland-platform,代码行数:21,代码来源:UpperCaseFirstFunction.java
示例9: makeCallExpression
import net.sf.saxon.value.EmptySequence; //导入依赖的package包/类
@Override
public ExtensionFunctionCall makeCallExpression() {
return new ExtensionFunctionCall() {
public SequenceIterator call(SequenceIterator[] arguments,
XPathContext context) throws XPathException {
String point = "";
try {
String lat = ((StringValue) arguments[0].next()).getStringValue();
String lon = ((StringValue) arguments[1].next()).getStringValue();
// WKT POINT specification: first lon, then lat.
//if ( fn:empty($lat) or fn:empty($long) ) then () else concat( 'POINT(', $long, ' ', $lat, ')' )
point = "POINT(" + lon + " " + lat + ")";
} catch (NullPointerException e) {
}
if (point.length() > 0) {
return Value.asIterator(StringValue.makeStringValue(point));
} else {
return Value.asIterator(EmptySequence.getInstance());
}
}
};
}
开发者ID:erfgoed-en-locatie,项目名称:artsholland-platform,代码行数:26,代码来源:WKTGeometryFunction.java
示例10: makeCallExpression
import net.sf.saxon.value.EmptySequence; //导入依赖的package包/类
@Override
public ExtensionFunctionCall makeCallExpression() {
return new ExtensionFunctionCall() {
public SequenceIterator call(SequenceIterator[] arguments,
XPathContext context) throws XPathException {
float number = 0;
try {
number = ((FloatValue) arguments[0].next()).getFloatValue();
} catch (NullPointerException e) {}
if (number == 0) {
return Value.asIterator(EmptySequence.getInstance());
} else {
return Value.asIterator(StringValue.makeStringValue(Float.toString(number)));
}
}
};
}
开发者ID:erfgoed-en-locatie,项目名称:artsholland-platform,代码行数:18,代码来源:ParseNonZeroNumber.java
示例11: makeCallExpression
import net.sf.saxon.value.EmptySequence; //导入依赖的package包/类
@Override
public ExtensionFunctionCall makeCallExpression() {
return new ExtensionFunctionCall() {
public SequenceIterator call(SequenceIterator[] arguments,
XPathContext context) throws XPathException {
// concat twee strings (naam en nummer). Alleen naam mag, alleen nummer niet.
String streetName = "";
String streetNumber = "";
try {
streetName = ((StringValue) arguments[0].next()).getStringValue();
if (arguments.length > 1) {
streetNumber = arguments[1].next().getStringValue();
}
} catch (Exception e) {
return Value.asIterator(EmptySequence.getInstance());
}
String streetAddress = streetName;
if (streetNumber.length() > 0) {
streetAddress += " " + streetNumber;
}
return Value.asIterator(StringValue.makeStringValue(streetAddress));
}
};
}
开发者ID:erfgoed-en-locatie,项目名称:artsholland-platform,代码行数:25,代码来源:StreetAddressFunction.java
示例12: makeCallExpression
import net.sf.saxon.value.EmptySequence; //导入依赖的package包/类
@Override
public ExtensionFunctionCall makeCallExpression() {
return new ExtensionFunctionCall() {
public SequenceIterator call(SequenceIterator[] arguments,
XPathContext context) throws XPathException {
String locality = "";
try {
// First argument: postal code
// Second (optional) argument: locality (ignored for now)
String postalCode = ((StringValue) arguments[0].next()).getStringValue();
locality = PostalCodeLookup.lookupPostalCode(postalCode);
} catch (Exception e) {
return Value.asIterator(EmptySequence.getInstance());
}
return Value.asIterator(StringValue.makeStringValue(locality));
}
};
}
开发者ID:erfgoed-en-locatie,项目名称:artsholland-platform,代码行数:20,代码来源:LocalityFunction.java
示例13: makeCallExpression
import net.sf.saxon.value.EmptySequence; //导入依赖的package包/类
@Override
public ExtensionFunctionCall makeCallExpression() {
return new ExtensionFunctionCall() {
public SequenceIterator call(SequenceIterator[] arguments,
XPathContext context) throws XPathException {
String lang = "";
try {
lang = ((StringValue) arguments[0].next()).getStringValue()
.replaceFirst("([a-z]+)_.*", "$1");
} catch (NullPointerException e) {
}
if (lang.length() == 0) {
return Value.asIterator(EmptySequence.getInstance());
} else {
return Value.asIterator(StringValue.makeStringValue(lang));
}
}
};
}
开发者ID:erfgoed-en-locatie,项目名称:artsholland-platform,代码行数:21,代码来源:ParseLocaleFunction.java
示例14: makeCallExpression
import net.sf.saxon.value.EmptySequence; //导入依赖的package包/类
@Override
public ExtensionFunctionCall makeCallExpression() {
return new ExtensionFunctionCall() {
public SequenceIterator call(SequenceIterator[] arguments,
XPathContext context) throws XPathException {
try {
String str = ((StringValue) arguments[0].next()).getStringValue();
String number = String.valueOf(Float.parseFloat(str));
return Value.asIterator(StringValue.makeStringValue(number));
} catch (Exception e) {
return Value.asIterator(EmptySequence.getInstance());
}
}
};
}
开发者ID:erfgoed-en-locatie,项目名称:artsholland-platform,代码行数:17,代码来源:ParseDecimalFunction.java
示例15: call
import net.sf.saxon.value.EmptySequence; //导入依赖的package包/类
@Override
public Sequence call(XPathContext context, Sequence[] arguments) throws XPathException {
String source = ((StringValue) arguments[0].head()).getStringValue();
String target = ((StringValue) arguments[1].head()).getStringValue();
try {
File sourceDir = new File(source);
if (!sourceDir.isDirectory()) {
throw new IOException("Source directory \"" + sourceDir.getAbsolutePath() + "\" not found");
}
File targetFile = new File(target);
if (targetFile.isDirectory()) {
throw new IOException("Output file \"" + targetFile.getAbsolutePath() + "\" already exists as directory");
} else if (targetFile.isFile() && FileUtils.deleteQuietly(targetFile)) {
throw new IOException("Could not delete existing output file \"" + targetFile.getAbsolutePath() + "\"");
} else if (!targetFile.getParentFile().isDirectory() && !targetFile.getParentFile().mkdirs()) {
throw new IOException("Could not create output directory \"" + targetFile.getParentFile().getAbsolutePath() + "\"");
}
ZipUtils.zipDirectory(sourceDir, targetFile);
return EmptySequence.getInstance();
} catch (IOException ioe) {
throw new XPathException("Error zipping \"" + source + "\" to \"" + target + "\"", ioe);
}
}
开发者ID:Armatiek,项目名称:xslweb,代码行数:25,代码来源:Zip.java
示例16: call
import net.sf.saxon.value.EmptySequence; //导入依赖的package包/类
@Override
public Sequence call(XPathContext context, Sequence[] arguments) throws XPathException {
NodeInfo cookieElem = unwrapNodeInfo((NodeInfo) arguments[0].head());
String comment = NodeInfoUtils.getValueOfChildElementByLocalName(cookieElem, "comment", context);
String domain = NodeInfoUtils.getValueOfChildElementByLocalName(cookieElem, "domain", context);
String maxAge = NodeInfoUtils.getValueOfChildElementByLocalName(cookieElem, "max-age", context);
String name = NodeInfoUtils.getValueOfChildElementByLocalName(cookieElem, "name", context);
String path = NodeInfoUtils.getValueOfChildElementByLocalName(cookieElem, "path", context);
String isSecure = NodeInfoUtils.getValueOfChildElementByLocalName(cookieElem, "is-secure", context);
String value = NodeInfoUtils.getValueOfChildElementByLocalName(cookieElem, "value", context);
String version = NodeInfoUtils.getValueOfChildElementByLocalName(cookieElem, "version", context);
Cookie cookie = new Cookie(name, value);
if (comment != null) cookie.setComment(comment);
if (domain != null) cookie.setDomain(domain);
if (maxAge != null) cookie.setMaxAge(Integer.parseInt(maxAge));
if (path != null) cookie.setPath(path);
if (isSecure != null) cookie.setSecure(Boolean.parseBoolean(isSecure));
if (version != null) cookie.setVersion(Integer.parseInt(version));
getResponse(context).addCookie(cookie);
return EmptySequence.getInstance();
}
开发者ID:Armatiek,项目名称:xslweb,代码行数:22,代码来源:AddCookie.java
示例17: call
import net.sf.saxon.value.EmptySequence; //导入依赖的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
示例18: call
import net.sf.saxon.value.EmptySequence; //导入依赖的package包/类
@Override
public Sequence call(XPathContext context, Sequence[] arguments) throws XPathException {
try {
File file = getFile(((StringValue) arguments[0].head()).getStringValue());
File parentFile = file.getParentFile();
if (!parentFile.exists()) {
throw new FileException(String.format("Parent directory \"%s\" does not exist",
parentFile.getAbsolutePath()), FileException.ERROR_PATH_NOT_DIRECTORY);
}
if (file.isDirectory()) {
throw new FileException(String.format("Path \"%s\" points to a directory",
file.getAbsolutePath()), FileException.ERROR_PATH_IS_DIRECTORY);
}
FileUtils.writeByteArrayToFile(file, ((Base64BinaryValue) arguments[1].head()).getBinaryValue(), append);
return EmptySequence.getInstance();
} catch (FileException fe) {
throw fe;
} catch (Exception e) {
throw new FileException("Other file error", e, FileException.ERROR_IO);
}
}
开发者ID:Armatiek,项目名称:xslweb,代码行数:22,代码来源:WriteBinaryCall.java
示例19: call
import net.sf.saxon.value.EmptySequence; //导入依赖的package包/类
@Override
public Sequence call(XPathContext context, Sequence[] arguments) throws XPathException {
try {
File file = getFile(((StringValue) arguments[0].head()).getStringValue());
boolean recursive = false;
if (arguments.length > 1) {
recursive = ((BooleanValue) arguments[1].head()).getBooleanValue();
}
if (!file.exists()) {
throw new FileException(String.format("Path \"%s\" does not exist",
file.getAbsolutePath()), FileException.ERROR_PATH_NOT_EXIST);
}
if (file.isDirectory() && !recursive && file.list().length > 0) {
throw new FileException(String.format("Path \"%s\" points to a non-empty directory",
file.getAbsolutePath()), FileException.ERROR_PATH_IS_DIRECTORY);
}
FileUtils.forceDelete(file);
return EmptySequence.getInstance();
} catch (FileException fe) {
throw fe;
} catch (Exception e) {
throw new FileException("Other file error", e, FileException.ERROR_IO);
}
}
开发者ID:Armatiek,项目名称:xslweb,代码行数:25,代码来源:Delete.java
示例20: call
import net.sf.saxon.value.EmptySequence; //导入依赖的package包/类
@Override
public Sequence call(XPathContext context, Sequence[] arguments) throws XPathException {
try {
File dir = getFile(((StringValue) arguments[0].head()).getStringValue());
if (dir.isFile()) {
throw new FileException(String.format("Specified path \"%s\" points to an existing file",
dir.getAbsolutePath()), FileException.ERROR_PATH_EXISTS);
}
FileUtils.forceMkdir(dir);
return EmptySequence.getInstance();
} catch (FileException fe) {
throw fe;
} catch (Exception e) {
throw new FileException("Other file error", e, FileException.ERROR_IO);
}
}
开发者ID:Armatiek,项目名称:xslweb,代码行数:17,代码来源:CreateDir.java
注:本文中的net.sf.saxon.value.EmptySequence类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论