本文整理汇总了Java中org.intellij.lang.xpath.psi.XPathType.fromString方法的典型用法代码示例。如果您正苦于以下问题:Java XPathType.fromString方法的具体用法?Java XPathType.fromString怎么用?Java XPathType.fromString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.intellij.lang.xpath.psi.XPathType
的用法示例。
在下文中一共展示了XPathType.fromString方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getType
import org.intellij.lang.xpath.psi.XPathType; //导入方法依赖的package包/类
@NotNull
public XPathType getType() {
final XPathType declaredType = XsltCodeInsightUtil.getDeclaredType(getTag());
if (declaredType != null) {
return declaredType;
}
final XmlAttribute attr = getTag().getAttribute("type", XsltSupport.PLUGIN_EXTENSIONS_NS);
if (attr != null) {
return XPathType.fromString(attr.getValue());
}
final XPathExpression value = getValue();
if (value instanceof XPathVariableReference) {
// recursive reference <xsl:variable name="foo" select="$foo" />
final XPathVariableReference reference = (XPathVariableReference)value;
if (reference.resolve() == this) {
return XPathType.UNKNOWN;
}
}
return value != null ? value.getType() : XPathType.UNKNOWN;
}
示例2: mapType
import org.intellij.lang.xpath.psi.XPathType; //导入方法依赖的package包/类
public static XPathType mapType(String type, XPath2SequenceType.Cardinality c) {
if ("none".equals(type)) {
return XPathType.UNKNOWN;
}
XPathType r = null;
if ("numeric".equals(type)) {
r = XPath2Type.NUMERIC;
} else if (type.startsWith("xs:")) {
final String base = type.substring(3);
r = XPath2Type.fromName(new QName(XPath2Type.XMLSCHEMA_NS, base));
if (r == null) {
r = XPathType.fromString(base);
}
} else {
if (type.endsWith("()")) {
r = XPath2Type.fromName(new QName("", type));
}
}
if (r != null) {
if (c != null) {
r = XPath2SequenceType.create(r, c);
}
return r;
}
return XPathType.fromString(type);
}