本文整理汇总了Java中net.sf.saxon.type.ItemType类的典型用法代码示例。如果您正苦于以下问题:Java ItemType类的具体用法?Java ItemType怎么用?Java ItemType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ItemType类属于net.sf.saxon.type包,在下文中一共展示了ItemType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: sequenceToAttributeCollection
import net.sf.saxon.type.ItemType; //导入依赖的package包/类
protected Collection<Attribute> sequenceToAttributeCollection(Sequence seq) throws XPathException {
ArrayList<Attribute> attrs = new ArrayList<Attribute>();
Item item;
SequenceIterator iter = seq.iterate();
while ((item = iter.next()) != null) {
Object value;
String type;
boolean isSerialized;
if (item instanceof NodeInfo) {
value = serialize((NodeInfo) item);
type = "node()";
isSerialized = true;
} else {
value = SequenceTool.convertToJava(item);
ItemType itemType = Type.getItemType(item, null);
type = itemType.toString();
isSerialized = false;
}
attrs.add(new Attribute(value, type, isSerialized));
}
return attrs;
}
示例2: createValue
import net.sf.saxon.type.ItemType; //导入依赖的package包/类
private Value createValue(ValueFacade expression) throws XPathException {
final TypeHierarchy typeHierarchy = myXPathContext.getConfiguration().getTypeHierarchy();
final ItemType itemType = expression.getItemType(typeHierarchy);
final SequenceIterator it = expression.iterate(myXPathContext);
Item value = null;
if (it.next() != null) {
value = it.current();
}
if (it.next() == null) {
return new SingleValue(value, itemType);
}
return new SequenceValue(value, it, itemType);
}
示例3: SequenceValue
import net.sf.saxon.type.ItemType; //导入依赖的package包/类
public SequenceValue(Item value, SequenceIterator it, ItemType type) throws XPathException {
String s = "(" + value.getStringValue() + ", " + it.current().getStringValue();
while (it.next() != null) {
s += ", " + it.current().getStringValue();
}
s += ")";
myValue = s;
myItemType = type;
}
示例4: getItemType
import net.sf.saxon.type.ItemType; //导入依赖的package包/类
public ItemType getItemType(TypeHierarchy hierarchy) {
if (myValue instanceof net.sf.saxon.value.Value) {
return ((net.sf.saxon.value.Value)myValue).getItemType(hierarchy);
}
if (myValue instanceof Item) {
return Type.getItemType((Item)myValue, hierarchy);
}
return AnyItemType.getInstance();
}
示例5: getArgumentTypes
import net.sf.saxon.type.ItemType; //导入依赖的package包/类
@Override
public SequenceType[] getArgumentTypes() {
// 1/ element(http:request)
final int one = StaticProperty.EXACTLY_ONE;
final int kind = Type.ELEMENT;
final String uri = HttpConstants.HTTP_CLIENT_NS_URI;
final NamePool pool = myConfig.getNamePool();
final ItemType itype = new NameTest(kind, uri, "request", pool);
SequenceType stype1 = SequenceType.makeSequenceType(itype, one); // 2/ xs:string?
SequenceType stype2 = SequenceType.OPTIONAL_STRING; // 3/ item()*
SequenceType stype3 = SequenceType.ANY_SEQUENCE; // 1/, 2/ and 3/
return new SequenceType[] { stype1, stype2, stype3 };
}
示例6: type2Sequence
import net.sf.saxon.type.ItemType; //导入依赖的package包/类
public static SequenceType type2Sequence(DataType type) {
ItemType it = type2Item(type.getType());
int cardinality;
switch (type.getCardinality()) {
case one_or_more: cardinality = StaticProperty.ALLOWS_ONE_OR_MORE; break;
case zero_or_one: cardinality = StaticProperty.ALLOWS_ZERO_OR_ONE; break;
case zero_or_more: cardinality = StaticProperty.ALLOWS_ZERO_OR_MORE; break;
default: cardinality = StaticProperty.ALLOWS_ONE;
}
return SequenceType.makeSequenceType(it, cardinality);
}
示例7: getTypeName
import net.sf.saxon.type.ItemType; //导入依赖的package包/类
public static String getTypeName(ItemType type) {
if (type.isAtomicType()) {
return type.getAtomizedItemType().getTypeName().getLocalPart();
}
String result = type.toString();
// delete () at the end
return result.substring(0, result.length() - 2);
}
示例8: typeCheck
import net.sf.saxon.type.ItemType; //导入依赖的package包/类
public Expression typeCheck(StaticContext env, ItemType contextItemType) throws XPathException
{
for (Entry<String, Expression> attrib : attribs.entrySet()) {
attrib.setValue(attrib.getValue().typeCheck(env, contextItemType));
adoptChildExpression(attrib.getValue());
}
if (content != null) {
content = content.typeCheck(env, contextItemType);
adoptChildExpression(content);
}
return this;
}
示例9: optimize
import net.sf.saxon.type.ItemType; //导入依赖的package包/类
public Expression optimize(Optimizer opt, StaticContext env, ItemType contextItemType) throws XPathException
{
for (Entry<String, Expression> attrib : attribs.entrySet()) {
Expression exp = attrib.getValue();
exp = exp.optimize(opt, env, contextItemType);
attrib.setValue(exp);
adoptChildExpression(exp);
}
if (content != null) {
content = content.optimize(opt, env, contextItemType);
adoptChildExpression(content);
}
return this;
}
示例10: iterate
import net.sf.saxon.type.ItemType; //导入依赖的package包/类
public SequenceIterator iterate(XPathContext context) throws XPathException {
Expression[] argExpressions = getArguments();
ValueRepresentation vr = ExpressionTool.lazyEvaluate(argExpressions[0],
context, 1);
ItemType it = Value.asValue(vr).getItemType(
context.getConfiguration().getTypeHierarchy());
String type = getTypeName(it);
Value v = Value.convertJavaObjectToXPath(type,
SequenceType.SINGLE_STRING, context);
return v.iterate();
}
示例11: getType
import net.sf.saxon.type.ItemType; //导入依赖的package包/类
public static String getType(Expression expr, XPathContext context)
throws XPathException {
ValueRepresentation vr = ExpressionTool.lazyEvaluate(expr, context, 1);
ItemType it = Value.asValue(vr).getItemType(
context.getConfiguration().getTypeHierarchy());
if (it instanceof SchemaType) {
return "xs:" + ((SchemaType) it).getName();
}
return "xs:any";
}
示例12: SingleValue
import net.sf.saxon.type.ItemType; //导入依赖的package包/类
public SingleValue(Item value, ItemType itemType) {
myValue = value;
myItemType = itemType;
}
示例13: getResultType
import net.sf.saxon.type.ItemType; //导入依赖的package包/类
@Override
public SequenceType getResultType(SequenceType[] params) {
final int more = StaticProperty.ALLOWS_ONE_OR_MORE;
final ItemType itype = AnyItemType.getInstance();
return SequenceType.makeSequenceType(itype, more);
}
示例14: getItemType
import net.sf.saxon.type.ItemType; //导入依赖的package包/类
@Override
public ItemType getItemType(TypeHierarchy th) {
return null;
}
示例15: getItemType
import net.sf.saxon.type.ItemType; //导入依赖的package包/类
@Override
public ItemType getItemType() {
return AnyItemType.getInstance();
}