本文整理汇总了Java中net.sf.saxon.type.Type.TEXT属性的典型用法代码示例。如果您正苦于以下问题:Java Type.TEXT属性的具体用法?Java Type.TEXT怎么用?Java Type.TEXT使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类net.sf.saxon.type.Type
的用法示例。
在下文中一共展示了Type.TEXT属性的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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;
}
}
}
示例2: 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;
}
示例3: getChildren
/**
* Iterate the children and fill the 'children' vector. This is a memo
* function and only has to do actual work once.
*/
private void getChildren()
{
if (children != null)
return;
children = new ArrayList();
NodeInfo child;
AxisIterator iter = wrapped.iterateAxis(Axis.CHILD);
while ((child = (NodeInfo)iter.next()) != null)
{
if (child.getNodeKind() == Type.ELEMENT ||
child.getNodeKind() == Type.TEXT)
{
children.add(new EasyNode(child));
}
}
}
示例4: isText
@Override
public boolean isText() {
return (saxonNode != null) && (saxonNode.getNodeKind() == Type.TEXT);
}
示例5: createNodeFromNodeInfo
public static Node createNodeFromNodeInfo(NodeInfo nodeInfo,
Document doc, DiffXML.WhitespaceStrippingPolicy whitespaceHandling) {
Node node = null;
switch (nodeInfo.getNodeKind()) {
case Type.TEXT:
String content = nodeInfo.getStringValue();
boolean isWhitespace = Whitespace.isWhite(content);
if (isWhitespace && whitespaceHandling.equals(DiffXML.WhitespaceStrippingPolicy.ALL)) {
break;
}
node = doc.createTextNode(content);
break;
case Type.WHITESPACE_TEXT:
content = nodeInfo.getStringValue();
if (whitespaceHandling.equals(DiffXML.WhitespaceStrippingPolicy.ALL)) {
node = doc.createTextNode(content);
}
break;
case Type.ELEMENT:
if (nodeInfo.getURI().equals("")) {
node = doc.createElement(nodeInfo.getLocalPart());
} else {
node = doc.createElementNS(nodeInfo.getURI(), nodeInfo.getLocalPart());
}
AxisIterator namespaces = nodeInfo.iterateAxis(AxisInfo.NAMESPACE);
NodeInfo ns;
while ((ns = namespaces.next()) != null) {
String localPart = ns.getLocalPart();
String qualifiedName;
if (localPart.equals(""))
qualifiedName = "xmlns";
else
qualifiedName = "xmlns:" + localPart;
((Element) node).setAttributeNS("http://www.w3.org/2000/xmlns/", qualifiedName, ns.getStringValue());
}
AxisIterator attrs = nodeInfo.iterateAxis(AxisInfo.ATTRIBUTE);
NodeInfo attr;
while ((attr = attrs.next()) != null) {
if (attr.getURI().equals("")) {
((Element) node).setAttribute(attr.getLocalPart(), attr.getStringValue());
} else if (attr.getURI().equals(Definitions.NAMESPACEURI_DELTAXML) && attr.getLocalPart().equals("whitespace")) {
String value = attr.getStringValue();
try {
whitespaceHandling = WhitespaceStrippingPolicy.valueOf(value);
} catch (Exception e) {
throw new XSLWebException("Value for whitespace handling not supported: \"" + value + "\"");
}
} else {
((Element) node).setAttributeNS(attr.getURI(), attr.getPrefix() + ":" + attr.getLocalPart(), attr.getStringValue());
}
}
break;
/*
case Type.COMMENT:
treeNode = new CommentNode(nodeInfo.getStringValue());
break;
case Type.PROCESSING_INSTRUCTION:
treeNode = new ProcessingInstructionNode(nodeInfo.getStringValue()); // TODO
break;
*/
}
if (node != null && nodeInfo.hasChildNodes()) {
AxisIterator childs = nodeInfo.iterateAxis(AxisInfo.CHILD);
NodeInfo childNodeInfo;
while ((childNodeInfo = childs.next()) != null) {
Node newNode = createNodeFromNodeInfo(childNodeInfo, doc, whitespaceHandling);
if (newNode != null) {
node.appendChild(newNode);
}
}
}
return node;
}
示例6: isText
/** Checks if this is a text node */
public boolean isText() {
return wrapped.getNodeKind() == Type.TEXT;
}
示例7: getNodeKind
/**
* Return the type of node.
* @return Type.TEXT
*/
public final int getNodeKind() {
return Type.TEXT;
}