本文整理汇总了Java中net.sf.saxon.type.Type.ATTRIBUTE属性的典型用法代码示例。如果您正苦于以下问题:Java Type.ATTRIBUTE属性的具体用法?Java Type.ATTRIBUTE怎么用?Java Type.ATTRIBUTE使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类net.sf.saxon.type.Type
的用法示例。
在下文中一共展示了Type.ATTRIBUTE属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initializeNodeInfo
private void initializeNodeInfo(@Nullable NodeInfo nodeInfo) {
if (nodeInfo == null) {
return;
}
int nodeKind = nodeInfo.getNodeKind();
NodeInfo elemInfo = null;
if (nodeKind == Type.ATTRIBUTE) {
this.attrQname = new QName(nodeInfo.getPrefix(), nodeInfo.getURI(), nodeInfo.getLocalPart());
elemInfo = nodeInfo.getParent();
} else if (nodeKind == Type.ELEMENT) {
elemInfo = nodeInfo;
}
if (elemInfo == null) {
return;
}
this.elemQname = new QName(elemInfo.getPrefix(), elemInfo.getURI(), elemInfo.getLocalPart());
}
示例2: processArc
void processArc(PathMapArc arc) {
NodeTest test = arc.getNodeTest();
if (test == null) {
addAnyNodeArc(arc);
} else {
switch (test.getPrimitiveType()) {
case Type.TEXT:
matchesText = true;
case Type.NODE:
addAnyNodeArc(arc);
break;
case Type.COMMENT:
matchesComment = true;
break;
case Type.ELEMENT:
addElementArc(arc);
break;
case Type.ATTRIBUTE:
addAttributeArc(arc);
break;
}
}
}
示例3: NodeWrapper
/**
* This constructor is protected: nodes should be created using the wrap
* factory method on the DocumentWrapper class
*
* @param node
* The XOM node to be wrapped
* @param parent
* The NodeWrapper that wraps the parent of this node
* @param index
* Position of this node among its siblings
*/
protected NodeWrapper(Node node, NodeWrapper parent, int index) {
short kind;
if (node instanceof Element) {
kind = Type.ELEMENT;
} else if (node instanceof Text) {
kind = Type.TEXT;
} else if (node instanceof Attribute) {
kind = Type.ATTRIBUTE;
} else if (node instanceof Comment) {
kind = Type.COMMENT;
} else if (node instanceof ProcessingInstruction) {
kind = Type.PROCESSING_INSTRUCTION;
} else if (node instanceof Document) {
kind = Type.DOCUMENT;
} else {
throwIllegalNode(node); // moved out of fast path to enable better inlining
return; // keep compiler happy
}
this.nodeKind = kind;
this.node = node;
this.parent = parent;
this.index = index;
}
示例4: FollowingEnumeration
public FollowingEnumeration(NodeImpl node, NodeTest nodeTest)
{
super(node, nodeTest);
root = (LazyDocument)node.getDocumentRoot();
// skip the descendant nodes if any
int type = node.getNodeKind();
if (type == Type.ATTRIBUTE || type == Type.NAMESPACE)
{
next = ((NodeImpl)node.getParent()).getNextInDocument(root);
}
else {
do {
next = (NodeImpl)node.getNextSibling();
if (next == null)
node = (NodeImpl)node.getParent();
} while (next == null && node != null);
}
while (!conforms(next)) {
step();
}
}
示例5: getAttributeNamesOfNamespace
@Override
public List<String> getAttributeNamesOfNamespace(String namespaceUri) {
final List<String> list = new LinkedList<String>();
if (isElement()) {
final NodeTest nodeTest = new NamespaceTest(saxonNode.getNamePool(), Type.ATTRIBUTE, namespaceUri);
final AxisIterator iterator = saxonNode.iterateAxis(AxisInfo.ATTRIBUTE, nodeTest);
NodeInfo attribute = iterator.next();
while (attribute != null) {
list.add(attribute.getLocalPart());
attribute = iterator.next();
}
}
return list;
}
示例6: getAttribute
@Override
public String getAttribute(String local_name) throws HttpClientException {
// get the attribute
NamePool pool = myNode.getConfiguration().getNamePool();
NodeTest pred = new NameTest(Type.ATTRIBUTE, "", local_name, pool);
AxisIterator attrs = myNode.iterateAxis(AxisInfo.ATTRIBUTE, pred);
NodeInfo a = (NodeInfo) attrs.next();
// return its string value, or null if there is no such attribute
if (a == null) {
return null;
} else {
return a.getStringValue();
}
}
示例7: getNameCode
/**
* Get name code. The name code is a coded form of the node name: two nodes
* with the same name code have the same namespace URI, the same local name,
* and the same prefix. By masking the name code with &0xfffff, you get a
* fingerprint: two nodes with the same fingerprint have the same local name
* and namespace URI.
*
* @see net.sf.saxon.om.NamePool#allocate allocate
*/
public int getNameCode() {
switch (nodeKind) {
case Type.ELEMENT:
case Type.ATTRIBUTE:
case Type.PROCESSING_INSTRUCTION:
return docWrapper.getNamePool().allocate(getPrefix(), getURI(),
getLocalPart());
default:
return -1;
}
}
示例8: getLocalPart
/**
* Get the local part of the name of this node. This is the name after the
* ":" if any.
*
* @return the local part of the name. For an unnamed node, returns "".
*/
public String getLocalPart() {
switch (nodeKind) {
case Type.ELEMENT:
return ((Element) node).getLocalName();
case Type.ATTRIBUTE:
return ((Attribute) node).getLocalName();
case Type.PROCESSING_INSTRUCTION:
return ((ProcessingInstruction) node).getTarget();
default:
return "";
}
}
示例9: getPrefix
/**
* Get the prefix of the name of the node. This is defined only for elements and attributes.
* If the node has no prefix, or for other kinds of node, return a zero-length string.
* @return The prefix of the name of the node.
*/
public String getPrefix() {
switch (nodeKind) {
case Type.ELEMENT:
return ((Element) node).getNamespacePrefix();
case Type.ATTRIBUTE:
return ((Attribute) node).getNamespacePrefix();
default:
return "";
}
}
示例10: getURI
/**
* Get the URI part of the name of this node. This is the URI corresponding
* to the prefix, or the URI of the default namespace if appropriate.
*
* @return The URI of the namespace of this node. For an unnamed node, or
* for a node with an empty prefix, return an empty string.
*/
public String getURI() {
switch (nodeKind) {
case Type.ELEMENT:
return ((Element) node).getNamespaceURI();
case Type.ATTRIBUTE:
return ((Attribute) node).getNamespaceURI();
default:
return "";
}
}
示例11: getDisplayName
/**
* Get the display name of this node. For elements and attributes this is
* [prefix:]localname. For unnamed nodes, it is an empty string.
*
* @return The display name of this node. For a node with no name, return an
* empty string.
*/
public String getDisplayName() {
switch (nodeKind) {
case Type.ELEMENT:
return ((Element) node).getQualifiedName();
case Type.ATTRIBUTE:
return ((Attribute) node).getQualifiedName();
case Type.PROCESSING_INSTRUCTION:
return ((ProcessingInstruction) node).getTarget();
default:
return "";
}
}
示例12: getSchemaType
@Override
public SchemaType getSchemaType() {
if (nodeKind == Type.ATTRIBUTE) {
return AnySimpleType.getInstance();
}
return Untyped.getInstance();
}
示例13: getNodeKind
/**
* Returns type of the node.
* @return node kind
*/
@Override
public int getNodeKind() {
return Type.ATTRIBUTE;
}
示例14: buildSegments
private static LinkedList<ContentPathSegment<?, ?>> buildSegments(LinkedList<ContentPathSegment<?, ?>> segments, NodeInfo nodeInfo,
@Nullable String nsPrefix, @Nullable String nsUri, String localName) {
boolean attrNode = (nodeInfo.getNodeKind() == Type.ATTRIBUTE);
if (attrNode) {
segments.add(0, new AttributePathSegmentImpl(nsPrefix, nsUri, localName));
}
ElementPathSegment elemSegment = new ElementPathSegmentImpl(nsPrefix, nsUri, localName);
segments.add(0, elemSegment);
NodeInfo parentNodeInfo = nodeInfo.getParent();
if ((parentNodeInfo != null) && (parentNodeInfo.getNodeKind() != Type.DOCUMENT)) {
if (!attrNode) {
int nodeIndex = -1;
SameNameTest siblingNodeTest = new SameNameTest(nodeInfo);
AxisIterator precedingSiblingNodeIterator = nodeInfo.iterateAxis(AxisInfo.PRECEDING_SIBLING, siblingNodeTest);
while (precedingSiblingNodeIterator.next() != null) {
nodeIndex++;
}
if (nodeIndex == -1) {
if (nodeInfo.iterateAxis(AxisInfo.FOLLOWING_SIBLING, siblingNodeTest).next() != null) {
nodeIndex = 0;
}
} else {
nodeIndex++;
}
if (nodeIndex >= 0) {
elemSegment.setIndex(nodeIndex);
}
}
buildSegments(segments, parentNodeInfo, parentNodeInfo.getPrefix(), parentNodeInfo.getURI(), parentNodeInfo.getLocalPart());
}
return segments;
}
示例15: getTypeAnnotation
/**
* Get the type annotation of this node, if any. Returns -1 for kinds of
* nodes that have no annotation, and for elements annotated as untyped, and
* attributes annotated as untypedAtomic.
*
* @return the type annotation of the node.
* @see net.sf.saxon.type.Type
*/
public int getTypeAnnotation() {
if (getNodeKind() == Type.ATTRIBUTE) {
return StandardNames.XS_UNTYPED_ATOMIC;
}
return StandardNames.XS_UNTYPED;
}