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


Java AxisInfo类代码示例

本文整理汇总了Java中net.sf.saxon.om.AxisInfo的典型用法代码示例。如果您正苦于以下问题:Java AxisInfo类的具体用法?Java AxisInfo怎么用?Java AxisInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: resolveToNode

import net.sf.saxon.om.AxisInfo; //导入依赖的package包/类
public NodeInfo resolveToNode(List<Parameter> frameworkParameters) throws XPathException, TempContextException {
	//logger.info("resolveToNode: " + getScriptName());
	final NodeInfo 	resolvedNode 	= resolve(frameworkParameters);
	NodeInfo 		resolvedElement = resolvedNode.iterateAxis(AxisInfo.CHILD, NodeKindTest.ELEMENT).next();
	//logger.info("needsReparse: " + XsltConref.needsReparse(resolvedElement));
	if (XsltConref.needsReparse(resolvedElement)) {
		final String 	serialized 		= SaxonNodeWrapper.serializeNode(resolvedNode);
		try {
			//logger.info("reparsing...");
			//logger.info(serialized);
			final XdmNode 	reparsedNode 	= xsltConrefCache.getDocumentBuilder().buildFromString(serialized, true);
			
			resolvedElement = reparsedNode.getUnderlyingNode().iterateAxis(AxisInfo.CHILD, NodeKindTest.ELEMENT).next();
			//logger.info("---");
			//logger.info(SaxonNodeWrapper.serializeNode(reparsedElement));
		} catch (SaxonApiException e) {
			logger.info("------");
			logger.info("serialized node:");
			logger.info(serialized);
			logger.info("------");
			throw new XPathException("Failed to reparse resolved xslt-conref ('" + getScriptName() + "'): " + e.getMessage());
		}
	} 
	resolvedElement.setSystemId(node.getBaseUrl().toString());
	return resolvedElement;
}
 
开发者ID:dita-semia,项目名称:dita-semia-resolver,代码行数:27,代码来源:XsltConref.java

示例2: getChildElementIndexWithinParent

import net.sf.saxon.om.AxisInfo; //导入依赖的package包/类
@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,代码行数:24,代码来源:SaxonNodeWrapper.java

示例3: hasNoNsChild

import net.sf.saxon.om.AxisInfo; //导入依赖的package包/类
@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,代码行数:7,代码来源:SaxonElement.java

示例4: noOtherNCNameAttribute

import net.sf.saxon.om.AxisInfo; //导入依赖的package包/类
@Override
public void noOtherNCNameAttribute(String[] names) throws HttpClientException {
  if (names == null) {
    throw new NullPointerException("the names array is null");
  }
  String[] sorted = new String[names.length];
  for (int i = 0; i < names.length; ++i) {
    sorted[i] = names[i];
  }
  Arrays.sort(sorted);
  String elem_name = myNode.getDisplayName();
  AxisIterator it = myNode.iterateAxis(AxisInfo.ATTRIBUTE);
  NodeInfo attr;
  while ((attr = (NodeInfo) it.next()) != null) {
    String attr_name = attr.getDisplayName();
    if (HttpConstants.HTTP_CLIENT_NS_URI.equals(attr.getURI())) {
      throw new HttpClientException("@" + attr_name + " not allowed on " + elem_name);
    } else if (!"".equals(attr.getURI())) {
      // ignore other-namespace-attributes
    } else if (Arrays.binarySearch(sorted, attr.getLocalPart()) < 0) {
      throw new HttpClientException("@" + attr_name + " not allowed on " + elem_name);
    }
  }
}
 
开发者ID:Armatiek,项目名称:xslweb,代码行数:25,代码来源:SaxonElement.java

示例5: startElement

import net.sf.saxon.om.AxisInfo; //导入依赖的package包/类
@Override
public void startElement(NodeName elemName, SchemaType typeCode,
		int locationId, int properties) throws XPathException {
	MatchContext mc = matchContext.getLast();
	MatchContext newContext = new MatchContext();
	if (mc.elementArcs != null) {
		for (PathMapArc arc : mc.elementArcs) {
			NodeTest test = arc.getNodeTest();
			if (test == null || test.matches(Type.ELEMENT, elemName, typeCode.getFingerprint())) {
				newContext.bulidContext(arc.getTarget());
				newContext.matchedElement = true;
			} 
			if (arc.getAxis() == AxisInfo.DESCENDANT || arc.getAxis() == AxisInfo.DESCENDANT_OR_SELF) {
				newContext.processArc(arc);
			}
		}
	}
	matchContext.add(newContext);
	if (newContext.matchedElement) {
		super.startElement(elemName, typeCode, locationId, properties);
	} else if (logTrace) {
		LogManager.logTrace(LogConstants.CTX_RUNTIME, "Document projection did not match element", elemName.getURI(), ':', elemName.getLocalPart()); //$NON-NLS-1$
	}
}
 
开发者ID:kenweezy,项目名称:teiid,代码行数:25,代码来源:PathMapFilter.java

示例6: iterateAxis

import net.sf.saxon.om.AxisInfo; //导入依赖的package包/类
/**
 * Determines axis iteration algorithm. Throws {@code UnsupportedOperationException} in case,
 * when there is no axis iterator for given axisNumber.
 * @param axisNumber element from {@code AxisInfo}
 * @return {@code AxisIterator} object
 */
@Override
public AxisIterator iterateAxis(byte axisNumber) {
    final AxisIterator result;
    switch (axisNumber) {
        case AxisInfo.ANCESTOR:
        case AxisInfo.ATTRIBUTE:
        case AxisInfo.PARENT:
            result = EmptyIterator.OfNodes.THE_INSTANCE;
            break;
        case AxisInfo.ANCESTOR_OR_SELF:
        case AxisInfo.SELF:
            result = SingleNodeIterator.makeIterator(this);
            break;
        case AxisInfo.CHILD:
            if (hasChildNodes()) {
                result = new ArrayIterator.OfNodes(
                        getChildren().toArray(new AbstractNode[getChildren().size()]));
            }
            else {
                result = EmptyIterator.OfNodes.THE_INSTANCE;
            }
            break;
        case AxisInfo.DESCENDANT:
            if (hasChildNodes()) {
                result = new Navigator.DescendantEnumeration(this, false, true);
            }
            else {
                result = EmptyIterator.OfNodes.THE_INSTANCE;
            }
            break;
        case AxisInfo.DESCENDANT_OR_SELF:
            result = new Navigator.DescendantEnumeration(this, true, true);
            break;
        default:
            throw throwUnsupportedOperationException();
    }
    return result;
}
 
开发者ID:rnveach,项目名称:checkstyle-backport-jre6,代码行数:45,代码来源:RootNode.java

示例7: testIterate

import net.sf.saxon.om.AxisInfo; //导入依赖的package包/类
@Test
public void testIterate() {
    try {
        attributeNode.iterateAxis(AxisInfo.SELF);
        fail("Exception is excepted");
    }
    catch (UnsupportedOperationException ex) {
        assertEquals(
            "Invalid exception message",
            "Operation is not supported",
            ex.getMessage());
    }
}
 
开发者ID:rnveach,项目名称:checkstyle-backport-jre6,代码行数:14,代码来源:AttributeNodeTest.java

示例8: testIterate

import net.sf.saxon.om.AxisInfo; //导入依赖的package包/类
@Test
public void testIterate() {
    assertEquals("Result iterator does not match expected",
            EmptyIterator.OfNodes.THE_INSTANCE, rootNode.iterateAxis(AxisInfo.PARENT));
    assertEquals("Result iterator does not match expected",
            EmptyIterator.OfNodes.THE_INSTANCE, rootNode.iterateAxis(AxisInfo.PARENT,
                    null));
}
 
开发者ID:rnveach,项目名称:checkstyle-backport-jre6,代码行数:9,代码来源:RootNodeTest.java

示例9: testRootWithNullDetailAst

import net.sf.saxon.om.AxisInfo; //导入依赖的package包/类
@Test
public void testRootWithNullDetailAst() {
    final RootNode emptyRootNode = new RootNode(null);
    assertFalse("Empty node should not have children", emptyRootNode.hasChildNodes());
    assertEquals("Invalid number of nodes", EmptyIterator.OfNodes.THE_INSTANCE,
            emptyRootNode.iterateAxis(
            AxisInfo.DESCENDANT));
    assertEquals("Invalid number of nodes", EmptyIterator.OfNodes.THE_INSTANCE,
            emptyRootNode.iterateAxis(AxisInfo.CHILD));
}
 
开发者ID:rnveach,项目名称:checkstyle-backport-jre6,代码行数:11,代码来源:XpathMapperTest.java

示例10: getAttributeNamesOfNamespace

import net.sf.saxon.om.AxisInfo; //导入依赖的package包/类
@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;
}
 
开发者ID:dita-semia,项目名称:dita-semia-resolver,代码行数:15,代码来源:SaxonNodeWrapper.java

示例11: getChildNodes

import net.sf.saxon.om.AxisInfo; //导入依赖的package包/类
@Override
public List<NodeWrapper> getChildNodes() {
	final AxisIterator 		iterator 	= saxonNode.iterateAxis(AxisInfo.CHILD);
	final List<NodeWrapper>	list		= new LinkedList<>();
	NodeInfo childNode = iterator.next();
	while (childNode != null) {
		list.add(new SaxonNodeWrapper(childNode, xPathCache));
		childNode = iterator.next();
	}
	return list;
}
 
开发者ID:dita-semia,项目名称:dita-semia-resolver,代码行数:12,代码来源:SaxonNodeWrapper.java

示例12: getValueOfChildElementByLocalName

import net.sf.saxon.om.AxisInfo; //导入依赖的package包/类
public static String getValueOfChildElementByLocalName(NodeInfo parentElement, String localName, XPathContext context) {
  NodeInfo nodeInfo = parentElement.iterateAxis(AxisInfo.CHILD, new LocalNameTest(context.getNamePool(), Type.ELEMENT, localName)).next();
  if (nodeInfo != null) {
    return nodeInfo.getStringValue();
  }
  return null;
}
 
开发者ID:Armatiek,项目名称:xslweb,代码行数:8,代码来源:NodeInfoUtils.java

示例13: getOutputProperties

import net.sf.saxon.om.AxisInfo; //导入依赖的package包/类
protected Properties getOutputProperties(NodeInfo paramsElem) {
  Properties props = new Properties();
  paramsElem = unwrapNodeInfo(paramsElem);
  AxisIterator iter = paramsElem.iterateAxis(AxisInfo.CHILD, NodeKindTest.ELEMENT);
  NodeInfo paramElem;
  while ((paramElem = iter.next()) != null) {
    props.put(paramElem.getLocalPart(), paramElem.getAttributeValue("", "value"));
  }  
  return props;
}
 
开发者ID:Armatiek,项目名称:xslweb,代码行数:11,代码来源:ExtensionFunctionCall.java

示例14: createDocumentFromNodeInfo

import net.sf.saxon.om.AxisInfo; //导入依赖的package包/类
public static Document createDocumentFromNodeInfo(NodeInfo nodeInfo, 
    DiffXML.WhitespaceStrippingPolicy whitespaceHandling) throws ParserConfigurationException {
  if (nodeInfo.getNodeKind() == Type.DOCUMENT) {
    nodeInfo = nodeInfo.iterateAxis(AxisInfo.CHILD).next();
  }
  DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance(); 
  docFactory.setNamespaceAware(true);
  docFactory.setValidating(false);
  // docFactory.setExpandEntityReferences(true);
  Document doc = docFactory.newDocumentBuilder().newDocument();
  doc.setStrictErrorChecking(true); // TODO
  doc.appendChild(createNodeFromNodeInfo(nodeInfo, doc, whitespaceHandling));
  return doc;
}
 
开发者ID:Armatiek,项目名称:xslweb,代码行数:15,代码来源:DiffUtils.java

示例15: getAttribute

import net.sf.saxon.om.AxisInfo; //导入依赖的package包/类
@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();
  }
}
 
开发者ID:Armatiek,项目名称:xslweb,代码行数:15,代码来源:SaxonElement.java


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