本文整理汇总了Java中net.sf.saxon.s9api.XdmNode.getAttributeValue方法的典型用法代码示例。如果您正苦于以下问题:Java XdmNode.getAttributeValue方法的具体用法?Java XdmNode.getAttributeValue怎么用?Java XdmNode.getAttributeValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.sf.saxon.s9api.XdmNode
的用法示例。
在下文中一共展示了XdmNode.getAttributeValue方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: buildFile
import net.sf.saxon.s9api.XdmNode; //导入方法依赖的package包/类
private CfgFile buildFile(XdmNode node, HashMap<QName,ParameterValue> parameters) throws URISyntaxException, InvalidSyntaxException {
String href = node.getAttributeValue(CfgFile.ATTR_HREF);
LOGGER.trace("buildFile from {} with href={}", node.getNodeName(), href);
File f;
href = resolveEscapes(href, parameters);
if(href.startsWith("file:")) {
f = new File(new URI(href));
} else {
f = new File(href);
if(!f.exists()) {
f = new File(currentDir, href);
}
}
LOGGER.trace("buildFile on {}", f.getName());
CfgFile ret = new CfgFile(f);
XdmSequenceIterator it = node.axisIterator(Axis.CHILD, QN_PARAM);
while(it.hasNext()) {
ret.addParameter(buildParameter((XdmNode)it.next(),parameters));
}
ParameterValue relativeFile = new ParameterValue(ParametersMerger.INPUT_RELATIVE_FILE, f.toURI().toString(), factory.XS_STRING);
ret.addParameter(relativeFile);
ParameterValue relativeDir = new ParameterValue(ParametersMerger.INPUT_RELATIVE_DIR, f.getParentFile().toURI().toString(), factory.XS_STRING);
ret.addParameter(relativeDir);
return ret;
}
示例2: getAssertionValue
import net.sf.saxon.s9api.XdmNode; //导入方法依赖的package包/类
String getAssertionValue(String text, XdmNode paramsVar) {
if (text.indexOf("$") < 0) {
return text;
}
String newText = text;
XdmNode params = (XdmNode) paramsVar.axisIterator(Axis.CHILD).next();
XdmSequenceIterator it = params.axisIterator(Axis.CHILD);
while (it.hasNext()) {
XdmNode n = (XdmNode) it.next();
QName qname = n.getNodeName();
if (qname != null) {
String tagname = qname.getLocalName();
if (tagname.equals("param")) {
String name = n.getAttributeValue(LOCALNAME_QNAME);
String label = getLabel(n);
newText = StringUtils.replaceAll(newText,
"{$" + name + "}", label);
}
}
}
newText = StringUtils.replaceAll(newText, "{$context}", contextLabel);
return newText;
}
示例3: buildSources
import net.sf.saxon.s9api.XdmNode; //导入方法依赖的package包/类
private Sources buildSources(XdmNode sourcesNode, HashMap<QName,ParameterValue> parameters) throws InvalidSyntaxException {
String orderBy = sourcesNode.getAttributeValue(Sources.ATTR_ORDERBY);
String sort = sourcesNode.getAttributeValue(Sources.ATTR_SORT);
LOGGER.trace("buildSources from {} with orderBy={} and sort={}", new Object[]{sourcesNode.getNodeName(), orderBy, sort});
Sources sources = new Sources(orderBy, sort);
XdmSequenceIterator it = sourcesNode.axisIterator(Axis.CHILD);
while(it.hasNext()) {
XdmNode node = (XdmNode)it.next();
LOGGER.trace("buildSource from {}", node.getNodeName());
if(CfgFile.QNAME.equals(node.getNodeName())) {
try {
CfgFile localFile = buildFile(node, parameters);
LOGGER.trace("add source {}", localFile);
sources.addFile(localFile);
} catch (URISyntaxException ex) {
LOGGER.error(ex.getMessage(),ex);
throw new InvalidSyntaxException(ex);
}
} else if(CfgFile.QN_FOLDER.equals(node.getNodeName())) {
Collection<CfgFile> files = buildFolderContent(node, parameters);
LOGGER.trace("buildSources from folder contains {} files", files.size());
sources.addFiles(files);
} else if(Listener.QName.equals(node.getNodeName())) {
sources.setListener(buildListener(node, parameters));
}
}
return sources;
}
示例4: buildWhen
import net.sf.saxon.s9api.XdmNode; //导入方法依赖的package包/类
private WhenEntry buildWhen(XdmNode whenNode, HashMap<QName,ParameterValue> parameters) throws InvalidSyntaxException {
String test = whenNode.getAttributeValue(WhenEntry.ATTR_TEST);
// particular case of the otherwise, which is implemented as a when[@test='true()']
if((test==null || test.length()==0) && WhenEntry.QN_OTHERWISE.equals(whenNode.getNodeName()) ) {
test="true()";
}
WhenEntry when = new WhenEntry(test);
XdmSequenceIterator it = whenNode.axisIterator(Axis.CHILD);
while(it.hasNext()) {
XdmItem item = it.next();
if(item instanceof XdmNode) {
XdmNode node = (XdmNode)item;
if(Xslt.QNAME.equals(node.getNodeName())) {
when.addStep(buildXslt(node,parameters));
} else if(JavaStep.QNAME.equals(node.getNodeName())) {
when.addStep(buildJavaStep(node, parameters));
} else if(ChooseStep.QNAME.equals(node.getNodeName())) {
when.addStep(buildChooseStep(node, parameters));
} else if(node.getNodeKind()==XdmNodeKind.TEXT) {
// on ignore
} else if(node.getNodeKind()==XdmNodeKind.COMMENT) {
// on ignore
} else {
throw new InvalidSyntaxException(node.getNodeKind().toString()+" - "+ node.getNodeName()+": unexpected element in "+Pipe.QNAME);
}
}
}
return when;
}
示例5: buildOutput
import net.sf.saxon.s9api.XdmNode; //导入方法依赖的package包/类
private Output buildOutput(XdmNode node, HashMap<QName,ParameterValue> parameters) throws InvalidSyntaxException {
LOGGER.trace("buildOutput from {}", node.getNodeName());
Output ret = new Output();
// searching for output parameters
XdmSequenceIterator attributes = node.axisIterator(Axis.ATTRIBUTE);
while(attributes.hasNext()) {
XdmNode attr = (XdmNode)attributes.next();
ret.setOutputProperty(attr.getNodeName().getLocalName(), (String)resolveEscapes(attr.getStringValue(),parameters));
}
boolean nullOutput = node.axisIterator(Axis.CHILD, QN_NULL).hasNext();
if(nullOutput) {
ret.setNull(true);
} else {
XdmSequenceIterator consoleIterator = node.axisIterator(Axis.CHILD, Output.QN_CONSOLE);
if(consoleIterator.hasNext()) {
XdmNode console = (XdmNode)consoleIterator.next();
String sConsole = console.getAttributeValue(Output.ATTR_CONSOLE_WHICH);
if(sConsole==null) sConsole = "out";
ret.setConsole(sConsole);
} else {
XdmNode folder = (XdmNode)node.axisIterator(Axis.CHILD, CfgFile.QN_FOLDER).next();
String relative = resolveEscapes(folder.getAttributeValue(new QName("relative")),parameters);
String temp = folder.getAttributeValue(new QName("to"));
String to = resolveEscapes(temp, parameters);
String absolute = resolveEscapes(folder.getAttributeValue(new QName("absolute")), parameters);
if(relative!=null) ret.setRelativePath(relative);
if(to!=null) ret.setRelativeTo(to);
if(absolute!=null) ret.setAbsolute(absolute);
XdmNode filename = (XdmNode)node.axisIterator(Axis.CHILD, new QName(Config.NS,"fileName")).next();
String prefix = resolveEscapes(filename.getAttributeValue(new QName("prefix")),parameters);
String name = resolveEscapes(filename.getAttributeValue(new QName("name")),parameters);
String suffix = resolveEscapes(filename.getAttributeValue(new QName("suffix")), parameters);
if(prefix!=null) ret.setPrefix(prefix);
if(name!=null) ret.setName(name);
if(suffix!=null) ret.setSuffix(suffix);
}
}
return ret;
}
示例6: Config
import net.sf.saxon.s9api.XdmNode; //导入方法依赖的package包/类
public Config(XdmNode node) {
super();
params = new HashMap<>();
String val = node.getAttributeValue(ATTR_DOCUMENT_CACHE_SIZE);
if(val!=null) {
try {
maxDocumentCacheSize = Integer.parseInt(val);
} catch(Exception ex) {
LOGGER.warn(val+" n'est pas une valeur acceptable pour la taille maximale du cache de documents. "+MAX_DOCUMENT_CACHE_SIZE+" sera utilisé");
}
}
}
示例7: getLabel
import net.sf.saxon.s9api.XdmNode; //导入方法依赖的package包/类
static String getLabel(XdmNode n) {
String label = n.getAttributeValue(LABEL_QNAME);
if (label == null) {
XdmNode value = (XdmNode) n.axisIterator(Axis.CHILD).next();
XdmItem childItem = null;
try {
childItem = value.axisIterator(Axis.CHILD).next();
} catch (Exception e) {
// Not an error
}
if (childItem == null) {
XdmSequenceIterator it = value.axisIterator(Axis.ATTRIBUTE);
if (it.hasNext()) {
label = it.next().getStringValue();
} else {
label = "";
}
} else if (childItem.isAtomicValue()) {
label = childItem.getStringValue();
} else if (childItem instanceof XdmNode) {
XdmNode n2 = (XdmNode) childItem;
if (n2.getNodeKind() == XdmNodeKind.ELEMENT) {
label = "<" + n2.getNodeName().toString() + ">";
} else {
label = n2.toString();
}
}
}
return label;
}