本文整理汇总了Java中org.apache.xpath.NodeSet类的典型用法代码示例。如果您正苦于以下问题:Java NodeSet类的具体用法?Java NodeSet怎么用?Java NodeSet使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
NodeSet类属于org.apache.xpath包,在下文中一共展示了NodeSet类的17个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: features
import org.apache.xpath.NodeSet; //导入依赖的package包/类
public static final NodeList features(ExpressionContext ctx) {
NodeSet result = new NodeSet();
Node node = ctx.getContextNode();
Element elt = getElement(node);
if (elt != null) {
Document doc = node.getOwnerDocument();
for (String name : elt.getFeatureKeys()) {
for (String value : elt.getFeature(name)) {
org.w3c.dom.Element e = doc.createElementNS(ALVISNLP_PROXY_NAMESPACE_URI, "feature");
e.setAttribute("name", name);
e.setAttribute("value", value);
result.addElement(e);
}
}
}
return result;
}
开发者ID:Bibliome,项目名称:alvisnlp,代码行数:18,代码来源:XMLWriter2ForINIST.java
示例2: features
import org.apache.xpath.NodeSet; //导入依赖的package包/类
public static final NodeList features(ExpressionContext ctx) {
NodeSet result = new NodeSet();
Node node = ctx.getContextNode();
Element elt = getElement(node);
if (elt != null) {
Document doc = node.getOwnerDocument();
for (String name : elt.getFeatureKeys()) {
for (String value : elt.getFeature(name)) {
org.w3c.dom.Element e = doc.createElementNS(ALVISNLP_PROXY_NAMESPACE_URI, "feature");
e.setAttribute("name", name);
e.setAttribute("value", value);
result.addElement(e);
}
}
}
return result;
}
开发者ID:Bibliome,项目名称:alvisnlp,代码行数:18,代码来源:XMLWriter.java
示例3: getAdditionalParameters
import org.apache.xpath.NodeSet; //导入依赖的package包/类
public NodeSet getAdditionalParameters() throws ParserConfigurationException, TransformerException {
org.w3c.dom.Document dom = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
NodeSet nodeSet = new NodeSet();
Map<String, String[]> parameters = editorSession.getRequestParameters();
for (String name : parameters.keySet())
for (String value : parameters.get(name))
if ((value != null) && !value.isEmpty())
nodeSet.addNode(buildAdditionalParameterElement(dom, name, value));
String xPaths2CheckResubmission = editorSession.getSubmission().getXPaths2CheckResubmission();
if (!xPaths2CheckResubmission.isEmpty())
nodeSet.addNode(buildAdditionalParameterElement(dom, MCREditorSubmission.PREFIX_CHECK_RESUBMISSION,
xPaths2CheckResubmission));
Map<String, String> defaultValues = editorSession.getSubmission().getDefaultValues();
for (String xPath : defaultValues.keySet())
nodeSet.addNode(buildAdditionalParameterElement(dom, MCREditorSubmission.PREFIX_DEFAULT_VALUE + xPath,
defaultValues.get(xPath)));
editorSession.setBreakpoint("After transformation to HTML");
nodeSet.addNode(buildAdditionalParameterElement(dom, MCREditorSessionStore.XEDITOR_SESSION_PARAM,
editorSession.getCombinedSessionStepID()));
return nodeSet;
}
开发者ID:MyCoRe-Org,项目名称:mycore,代码行数:27,代码来源:MCRXEditorTransformer.java
示例4: resolve
import org.apache.xpath.NodeSet; //导入依赖的package包/类
public XNodeSet resolve(ExpressionContext context, String uri, String sStatic) throws TransformerException {
boolean bStatic = "true".equals(sStatic) || includesPerApplication.containsKey(uri);
Map<String, Node> includes = bStatic ? includesPerApplication : includesPerTransformation;
LOGGER.debug("Including {} static={} cached={}", uri, bStatic, includes.containsKey(uri));
Node node = includes.get(uri);
if (node == null) {
Source source = MCRURIResolver.instance().resolve(uri, null);
if (source instanceof DOMSource)
node = ((DOMSource) source).getNode();
else {
DOMResult result = new DOMResult();
TransformerFactory.newInstance().newTransformer().transform(source, result);
node = result.getNode();
}
includes.put(uri, node);
}
NodeSet nodeSet = new NodeSet();
nodeSet.addNode(node);
return new XNodeSetForDOM((NodeList) nodeSet, context.getXPathContext());
}
开发者ID:MyCoRe-Org,项目名称:mycore,代码行数:24,代码来源:MCRIncludeHandler.java
示例5: order
import org.apache.xpath.NodeSet; //导入依赖的package包/类
/** This method returns a node list with all _active_ Markables started at DiscourseElement with ID discourseElementId. Markables
are grouped by levels in reverse MarkableChart layer order (cf. this.orderedLayers[]). Within each group, Markables are ordered
in discourse position order, with longer before shorter ones (for embedding visualization). */
public final NodeSet getActiveStartedMarkables(String discourseElementId)
{
NodeSet result = new NodeSet();
// Iterate over all levels in reverse order,
// so that deeper levels are processed before higher ones.
MarkableLevel level = null;
for (int z=size-1;z>=0;z--)
{
// Get current level
level = (MarkableLevel) orderedLevels[z];
if ((level.getIsActive() || level.getIsVisible()) && level.isDefined())
{
// getStartedMarkables returns a list in the proper ordering for opening bracket insertion.
level.getAllStartedMarkablesAsNodes(discourseElementId, result);
}
}
return result;
}
开发者ID:simonkrenger,项目名称:mmax2,代码行数:22,代码来源:MarkableChart.java
示例6: getAllStartedMarkablesAsNodes
import org.apache.xpath.NodeSet; //导入依赖的package包/类
/** This method updates a NodeSet of those Markables at the current MarkableLayer beginning at discourseElementId, with
longer Markables before shorter ones. Since this is on MarkableLayer level, no distinction is made wrt to active/inactive. */
public final void getAllStartedMarkablesAsNodes(String discourseElementId, NodeSet result)
{
// Get Array of Markables, or null if none
// long time = System.currentTimeMillis();
Markable[] temp = getAllMarkablesStartedByDiscourseElement(discourseElementId);
if (temp != null)
{
// Sort markables in discourse position order,
// with longer before shorter ones (for embedding visualization)
// TODO: Sort only once!
Arrays.sort(temp,getCurrentDiscourse().STARTCOMP);
// Add markables to node list in ordering sequence
int len = temp.length;
for (int o=0;o<len;o++)
{
result.addNode(temp[o].getNodeRepresentation());
}
}
}
开发者ID:simonkrenger,项目名称:mmax2,代码行数:22,代码来源:MarkableLevel.java
示例7: getAllEndedMarkablesAsNodes
import org.apache.xpath.NodeSet; //导入依赖的package包/类
/** This method updates a NodeSet of those Markables at the current MarkableLayer ending at discourseElementId, with
shorter Markables before longer ones. Since this is on MarkableLayer level, no distinction is made wrt to active/inactive. */
public final void getAllEndedMarkablesAsNodes(String discourseElementId, NodeSet result)
{
// Get Array of Markables, or null if none
Markable[] temp = getAllMarkablesEndedByDiscourseElement(discourseElementId);
if (temp != null)
{
// Sort markables in rev discourse position order,
// with shorter before longer ones (for embedding visualization)
// TODO: Sort only once!
Arrays.sort(temp,getCurrentDiscourse().ENDCOMP);
// Add markables to node list in ordering sequence
int len = temp.length;
for (int o=0;o<len;o++)
{
result.addNode(temp[o].getNodeRepresentation());
}
}
}
开发者ID:simonkrenger,项目名称:mmax2,代码行数:21,代码来源:MarkableLevel.java
示例8: elements
import org.apache.xpath.NodeSet; //导入依赖的package包/类
public static final NodeList elements(ExpressionContext ctx, String exprStr) {
Evaluator expr = expressionCache.safeGet(exprStr);
NodeSet result = new NodeSet();
Node node = ctx.getContextNode();
Document doc = node instanceof Document ? (Document) node : node.getOwnerDocument();
// System.err.println("node = " + node);
Element elt = getElement(node);
if (elt != null) {
for (Element e : Iterators.loop(expr.evaluateElements(EVALUATION_CONTEXT, elt))) {
result.addElement(getElementProxy(doc, e));
}
}
return result;
}
开发者ID:Bibliome,项目名称:alvisnlp,代码行数:15,代码来源:XMLWriter2ForINIST.java
示例9: inline
import org.apache.xpath.NodeSet; //导入依赖的package包/类
public static final NodeList inline(ExpressionContext ctx, String exprStr) {
InlineContext inlineContext = inlineCache.safeGet(exprStr);
if (inlineContext.init(ctx.getContextNode())) {
return inlineContext.inline();
}
return new NodeSet();
}
开发者ID:Bibliome,项目名称:alvisnlp,代码行数:8,代码来源:XMLWriter2ForINIST.java
示例10: inline
import org.apache.xpath.NodeSet; //导入依赖的package包/类
public static final NodeList inline(NodeList nodes) {
NodeSet result = new NodeSet();
int position = 0;
for (Node node : XMLUtils.getListOfNodes(nodes))
position = inline(result, position, node, 0);
return result;
}
开发者ID:Bibliome,项目名称:alvisnlp,代码行数:8,代码来源:XMLReader.java
示例11: elements
import org.apache.xpath.NodeSet; //导入依赖的package包/类
public static final NodeList elements(ExpressionContext ctx, String exprStr) {
Evaluator expr = expressionCache.safeGet(exprStr);
NodeSet result = new NodeSet();
Node node = ctx.getContextNode();
Document doc = node instanceof Document ? (Document) node : node.getOwnerDocument();
// System.err.println("node = " + node);
Element elt = getElement(node);
if (elt != null)
for (Element e : Iterators.loop(expr.evaluateElements(EVALUATION_CONTEXT, elt)))
result.addElement(getElementProxy(doc, e));
return result;
}
开发者ID:Bibliome,项目名称:alvisnlp,代码行数:13,代码来源:XMLWriter.java
示例12: buildExtentPagesNodeSet
import org.apache.xpath.NodeSet; //导入依赖的package包/类
public static NodeSet buildExtentPagesNodeSet(String input) throws JDOMException {
Element extent = buildExtentPages(input);
org.w3c.dom.Element domElement = new DOMOutputter().output(extent);
NodeSet nodeSet = new NodeSet();
nodeSet.addNode(domElement);
return nodeSet;
}
开发者ID:MyCoRe-Org,项目名称:mycore,代码行数:8,代码来源:MCRMODSPagesHelper.java
示例13: getElementsByTagName
import org.apache.xpath.NodeSet; //导入依赖的package包/类
/**
*
* @param tagname
*
*
* @see org.w3c.dom.Document
*/
public final NodeList getElementsByTagName(String tagname)
{
Vector listVector = new Vector();
Node retNode = dtm.getNode(node);
if (retNode != null)
{
boolean isTagNameWildCard = "*".equals(tagname);
if (DTM.ELEMENT_NODE == retNode.getNodeType())
{
NodeList nodeList = retNode.getChildNodes();
for (int i = 0; i < nodeList.getLength(); i++)
{
traverseChildren(listVector, nodeList.item(i), tagname,
isTagNameWildCard);
}
} else if (DTM.DOCUMENT_NODE == retNode.getNodeType()) {
traverseChildren(listVector, dtm.getNode(node), tagname,
isTagNameWildCard);
}
}
int size = listVector.size();
NodeSet nodeSet = new NodeSet(size);
for (int i = 0; i < size; i++)
{
nodeSet.addNode((Node) listVector.elementAt(i));
}
return (NodeList) nodeSet;
}
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:36,代码来源:DTMNodeProxy.java
示例14: getElementsByTagNameNS
import org.apache.xpath.NodeSet; //导入依赖的package包/类
/**
*
* @param namespaceURI
* @param localName
*
*
* @see org.w3c.dom.Document as of DOM Level 2
*/
public final NodeList getElementsByTagNameNS(String namespaceURI,
String localName)
{
Vector listVector = new Vector();
Node retNode = dtm.getNode(node);
if (retNode != null)
{
boolean isNamespaceURIWildCard = "*".equals(namespaceURI);
boolean isLocalNameWildCard = "*".equals(localName);
if (DTM.ELEMENT_NODE == retNode.getNodeType())
{
NodeList nodeList = retNode.getChildNodes();
for(int i = 0; i < nodeList.getLength(); i++)
{
traverseChildren(listVector, nodeList.item(i), namespaceURI, localName, isNamespaceURIWildCard, isLocalNameWildCard);
}
}
else if(DTM.DOCUMENT_NODE == retNode.getNodeType())
{
traverseChildren(listVector, dtm.getNode(node), namespaceURI, localName, isNamespaceURIWildCard, isLocalNameWildCard);
}
}
int size = listVector.size();
NodeSet nodeSet = new NodeSet(size);
for (int i = 0; i < size; i++)
{
nodeSet.addNode((Node)listVector.elementAt(i));
}
return (NodeList) nodeSet;
}
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:39,代码来源:DTMNodeProxy.java
示例15: inline
import org.apache.xpath.NodeSet; //导入依赖的package包/类
public static final NodeList inline(ExpressionContext ctx, String exprStr) {
InlineContext inlineContext = inlineCache.safeGet(exprStr);
if (inlineContext.init(ctx.getContextNode()))
return inlineContext.inline();
return new NodeSet();
}
开发者ID:Bibliome,项目名称:alvisnlp,代码行数:7,代码来源:XMLWriter.java
示例16: getFailedValidationRules
import org.apache.xpath.NodeSet; //导入依赖的package包/类
public NodeSet getFailedValidationRules() {
NodeSet nodeSet = new NodeSet();
for (MCRValidator failedRule : editorSession.getValidator().getFailedRules())
nodeSet.addNode(failedRule.getRuleElement());
return nodeSet;
}
开发者ID:MyCoRe-Org,项目名称:mycore,代码行数:7,代码来源:MCRXEditorTransformer.java
示例17: getEndedMarkables
import org.apache.xpath.NodeSet; //导入依赖的package包/类
public final static NodeSet getEndedMarkables(String discourseElementId)
{
return currentDiscourse.getCurrentMarkableChart().getActiveEndedMarkables(discourseElementId);
}
开发者ID:simonkrenger,项目名称:mmax2,代码行数:5,代码来源:MMAX2DiscourseLoader.java
注:本文中的org.apache.xpath.NodeSet类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论