当前位置: 首页>>代码示例>>Java>>正文


Java Type.ELEMENT属性代码示例

本文整理汇总了Java中net.sf.saxon.type.Type.ELEMENT属性的典型用法代码示例。如果您正苦于以下问题:Java Type.ELEMENT属性的具体用法?Java Type.ELEMENT怎么用?Java Type.ELEMENT使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在net.sf.saxon.type.Type的用法示例。


在下文中一共展示了Type.ELEMENT属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getChildElementIndexWithinParent

@Override
public int getChildElementIndexWithinParent() {
	final NodeInfo parent = saxonNode.getParent();
	if (parent == null) {
		return -1;
	} else {
		final AxisIterator 	iterator 	= saxonNode.getParent().iterateAxis(AxisInfo.CHILD, NodeKindTest.ELEMENT);
		int index = 1;
		NodeInfo sibling = null;
		do {
			sibling = iterator.next();
			if (saxonNode.getNodeKind() == Type.ELEMENT) {
				if (saxonNode.isSameNodeInfo(sibling)) {
					//logger.info("getChildIndexWithinParent(" + saxonNode.getLocalPart() + "): " + index);
					return index;
				}
				++index;
			}
		}
		while (sibling != null);
	}
	return -1;
}
 
开发者ID:dita-semia,项目名称:dita-semia-resolver,代码行数:23,代码来源:SaxonNodeWrapper.java

示例2: getDeclaredNamespaces

@Override
public NamespaceBinding[] getDeclaredNamespaces(NamespaceBinding[] buffer) {
       if (nodeKind == Type.ELEMENT) {
           Element elem = (Element)node;
           int size = elem.getNamespaceDeclarationCount();
           if (size == 0) {
               return new NamespaceBinding[0];
           }
           NamespaceBinding[] result = (buffer != null && size <= buffer.length ? buffer : new NamespaceBinding[size]);
           for (int i=0; i < size; i++) {
               String prefix = elem.getNamespacePrefix(i);
               String uri = elem.getNamespaceURI(prefix);
               result[i] = new NamespaceBinding(prefix, uri);
           }
           if (size < result.length) {
               result[size] = null;
           }
           return result;
       }
       return null;
}
 
开发者ID:kenweezy,项目名称:teiid,代码行数:21,代码来源:NodeWrapper.java

示例3: hasNoNsChild

@Override
public boolean hasNoNsChild() throws HttpClientException {
  NamePool pool = myNode.getConfiguration().getNamePool();
  NodeTest no_ns_pred = new NamespaceTest(pool, Type.ELEMENT, "");
  return myNode.iterateAxis(AxisInfo.CHILD, no_ns_pred).next() != null;
}
 
开发者ID:Armatiek,项目名称:xslweb,代码行数:6,代码来源:SaxonElement.java

示例4: 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());
}
 
开发者ID:esacinc,项目名称:sdcct,代码行数:22,代码来源:SdcctLocation.java

示例5: 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;
		}
	}
}
 
开发者ID:kenweezy,项目名称:teiid,代码行数:23,代码来源:PathMapFilter.java

示例6: 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;
}
 
开发者ID:kenweezy,项目名称:teiid,代码行数:34,代码来源:NodeWrapper.java

示例7: 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));
    }
  }
}
 
开发者ID:CDLUC3,项目名称:dash-xtf,代码行数:22,代码来源:EasyNode.java

示例8: serializeItem

/**
 * Serializes item after XPath or XQuery processor execution using Saxon.
 */
public static String serializeItem(Item item) throws XPathException {
	if (item instanceof NodeInfo) {
		int type = ((NodeInfo)item).getNodeKind();
        if (type == Type.DOCUMENT || type == Type.ELEMENT) {
         Properties props = new Properties();
         props.setProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
         props.setProperty(OutputKeys.INDENT, "yes");

            StringWriter stringWriter = new java.io.StringWriter();
            QueryResult.serialize((NodeInfo)item, new StreamResult(stringWriter), props);
            stringWriter.flush();
            return stringWriter.toString().replaceAll(" xmlns=\"http\\://www.w3.org/1999/xhtml\"", "");
        }
	}
	
	return item.getStringValue();
}
 
开发者ID:huajun2013,项目名称:ablaze,代码行数:20,代码来源:CommonUtil.java

示例9: toDOMDocument

@Converter
public static Document toDOMDocument(NodeInfo node) throws XPathException {
    switch (node.getNodeKind()) {
    case Type.DOCUMENT:
        // DOCUMENT type nodes can be wrapped directly
        return (Document) NodeOverNodeInfo.wrap(node);
    case Type.ELEMENT:
        // ELEMENT nodes need to build a new DocumentInfo before wrapping
        Configuration config = node.getConfiguration();
        DocumentInfo documentInfo = config.buildDocument(node);
        return (Document) NodeOverNodeInfo.wrap(documentInfo);
    default:
        return null;
    }
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:15,代码来源:SaxonConverter.java

示例10: getArgumentTypes

@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 };
}
 
开发者ID:Armatiek,项目名称:xslweb,代码行数:13,代码来源:SendRequestFunction.java

示例11: httpNsChildren

@Override
public Iterable<Element> httpNsChildren() throws HttpClientException {
  String http_ns = HttpConstants.HTTP_CLIENT_NS_URI;
  NamePool pool = myNode.getConfiguration().getNamePool();
  NodeTest pred = new NamespaceTest(pool, Type.ELEMENT, http_ns);
  AxisIterator it = myNode.iterateAxis(AxisInfo.CHILD, pred);
  return new ElemIterable(it);
}
 
开发者ID:Armatiek,项目名称:xslweb,代码行数:8,代码来源:SaxonElement.java

示例12: getAttributeValue

@Override
public String getAttributeValue(String uri, String localName) {
	if (nodeKind == Type.ELEMENT) {
		Attribute att = ((Element) node).getAttribute(localName, uri);
		if (att != null) return att.getValue();
	}
	return null;
}
 
开发者ID:kenweezy,项目名称:teiid,代码行数:8,代码来源:NodeWrapper.java

示例13: 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;
	}
}
 
开发者ID:kenweezy,项目名称:teiid,代码行数:21,代码来源:NodeWrapper.java

示例14: 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 "";
	}
}
 
开发者ID:kenweezy,项目名称:teiid,代码行数:19,代码来源:NodeWrapper.java

示例15: 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 "";
	}
}
 
开发者ID:kenweezy,项目名称:teiid,代码行数:16,代码来源:NodeWrapper.java


注:本文中的net.sf.saxon.type.Type.ELEMENT属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。