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


Java Node类代码示例

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


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

示例1: advance

import nu.xom.Node; //导入依赖的package包/类
private NodeInfo advance() {
	Node nextChild;
	do {
		if (forwards) {
			if (cursor == par.getChildCount()) return null;
			nextChild = par.getChild(cursor++);
		} else { // backwards
			if (cursor == 0) return null;
			nextChild = par.getChild(--cursor);
		}
	} while (nextChild instanceof DocType);
	// DocType is not an XPath node; can occur for /child::node()

	NodeInfo curr = makeWrapper(nextChild, docWrapper, commonParent, ix);
	ix += (forwards ? 1 : -1);
	return curr;
}
 
开发者ID:kenweezy,项目名称:teiid,代码行数:18,代码来源:NodeWrapper.java

示例2: prependCopy

import nu.xom.Node; //导入依赖的package包/类
@Override
public void prependCopy(XomNode node) throws XmlBuilderException {
    final Node wrappedNode = node.getNode();
    if (!(wrappedNode instanceof Element)) {
        throw new XmlBuilderException("Unable to copy non-element node " + node);
    }
    final ParentNode parent = wrappedNode.getParent();
    if (null == parent) {
        throw new XmlBuilderException("Unable to prepend - no parent found of " + node);
    }
    try {
        final int prependIndex = parent.indexOf(wrappedNode);
        final Node copiedNode = wrappedNode.copy();
        parent.insertChild(copiedNode, prependIndex);
    } catch (IllegalAddException iae) {
        throw new XmlBuilderException("Unable to append an copied element to " + parent, iae);
    }
}
 
开发者ID:SimY4,项目名称:xpath-to-xml,代码行数:19,代码来源:XomNavigator.java

示例3: moveToParentBefore

import nu.xom.Node; //导入依赖的package包/类
public Node moveToParentBefore(
  Node pTargetParentNode
, Node pMovingNode
, Node pPositionBeforeTargetParentsChildNode
) {
  // mDocControl in context of pTargetParentNode
  mDocControl.setDocumentModifiedCount();
  //If this is being moved FROM another document, update the FROM document's modified count
  if(pMovingNode.getDocument() != pTargetParentNode.getDocument()){
    DocControl.setDocumentModified(pMovingNode);
  }

  // The SiblingChild should already be attached to Parent element - so this is belt & braces check
  if (pPositionBeforeTargetParentsChildNode != null && pPositionBeforeTargetParentsChildNode.getParent() != pTargetParentNode) {
    throw new ExInternal("insertBefore error, the sibling is not a child of this node");
  }

  //Detach from parent
  pMovingNode.detach();

  int lTargetPosition = ((ParentNode) pTargetParentNode).indexOf(pPositionBeforeTargetParentsChildNode);
  ((ParentNode) pTargetParentNode).insertChild(pMovingNode, lTargetPosition);

  return pMovingNode;
}
 
开发者ID:Fivium,项目名称:FOXopen,代码行数:26,代码来源:ActuateReadWrite.java

示例4: hasParentTask

import nu.xom.Node; //导入依赖的package包/类
public boolean hasParentTask(String id) {
	Element t = getTaskElement(id);
	
	Node parentNode = t.getParent();
	if (parentNode instanceof Element) {
	    Element parent = (Element) parentNode;
    	if (parent.getLocalName().equalsIgnoreCase("task")) {
    	    return true;
    	}
    	else {
    	    return false;
    	}
	}
	else {
	    return false;
	}
}
 
开发者ID:ser316asu,项目名称:Neukoelln_SER316,代码行数:18,代码来源:TaskListImpl.java

示例5: updateProject

import nu.xom.Node; //导入依赖的package包/类
protected static void updateProject(Element importProject, Element homeProject, boolean override) throws Exception {
  UpdateLogsParameter timeLogParam = UpdateLogsParameter.GetTimeLogParameter(homeProject, importProject, override);
  UpdateLogsParameter defectLogParam = UpdateLogsParameter.GetDefectLogParameter(homeProject, importProject, override);    
  updateLogs(timeLogParam);
  updateLogs(defectLogParam);
  updateEstimates(homeProject, importProject, override);
  Element importLocElement = importProject.getFirstChildElement(LocManager.ELEMENT_NAME);
      
  if (importLocElement != null) {
    int locValue = Integer.valueOf(importLocElement.getValue()); // valid test
    Element homeLocElement = homeProject.getFirstChildElement(LocManager.ELEMENT_NAME);
    Node newNode = importLocElement.copy();
    
    if (homeLocElement != null) {        
      homeLocElement.getParent().appendChild(newNode);
      homeLocElement.getParent().removeChild(homeLocElement);
    } else {
      homeProject.appendChild(newNode);
    }
  }
}
 
开发者ID:ser316asu,项目名称:Neukoelln_SER316,代码行数:22,代码来源:DataImporter.java

示例6: hasParentTask

import nu.xom.Node; //导入依赖的package包/类
/**
 * @see net.sf.memoranda.TaskList#hasParentTask(String)
 */     
public boolean hasParentTask(String id) {
    Element t = getTaskElement(id);
    
    Node parentNode = t.getParent();
    if (parentNode instanceof Element) {
        Element parent = (Element) parentNode;
        if (parent.getLocalName().equalsIgnoreCase("task")) {
            return true;
        }
        else {
            return false;
        }
    }
    else {
        return false;
    }
}
 
开发者ID:ser316asu,项目名称:SER316-Dresden,代码行数:21,代码来源:TaskListImpl.java

示例7: process

import nu.xom.Node; //导入依赖的package包/类
@Override
public <T> T process(T xml, Iterable<Effect> effects) throws XmlBuilderException {
    if (!canHandle(xml)) {
        throw new IllegalArgumentException("XML model is not supported");
    }
    final Node xmlNode = (Node) xml;
    final XomNode<?> node;
    if (xmlNode instanceof Document) {
        node = new XomDocument((Document) xmlNode);
    } else if (xmlNode instanceof Element) {
        node = new XomElement((Element) xmlNode);
    } else if (xmlNode instanceof Attribute) {
        node = new XomAttribute((Attribute) xmlNode);
    } else {
        throw new IllegalArgumentException("XML node type is not supported");
    }
    final Navigator<XomNode> navigator = new XomNavigator(xmlNode);
    for (Effect effect : effects) {
        effect.perform(navigator, node);
    }
    return xml;
}
 
开发者ID:SimY4,项目名称:xpath-to-xml,代码行数:23,代码来源:XomNavigatorSpi.java

示例8: hasParentTimeLogs

import nu.xom.Node; //导入依赖的package包/类
@Override
public boolean hasParentTimeLogs(String id) {
   	Element t = getTimeLogElement(id);
   	
   	Node parentNode = t.getParent();
   	if (parentNode instanceof Element) {
   	    Element parent = (Element) parentNode;
       	if (parent.getLocalName().equalsIgnoreCase("timelog")) {
       	    return true;
       	}
       	else {
       	    return false;
       	}
   	}
   	else {
   	    return false;
   	}
}
 
开发者ID:ser316asu,项目名称:Wilmersdorf_SER316,代码行数:19,代码来源:TimeLogListImpl.java

示例9: getNode

import nu.xom.Node; //导入依赖的package包/类
public static Node getNode(Document doc, String entityType, String entityName) {
  String query = createQueryStringByName(entityType, entityName);
  Nodes nodes = doc.query(query);
  if (nodes != null && nodes.size() > 0) {
    return nodes.get(0);
  } 
  return null;
}
 
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:9,代码来源:XmlUtils.java

示例10: hasParentTask

import nu.xom.Node; //导入依赖的package包/类
@Override
public boolean hasParentTask(String id) {
	Element t = getTaskElement(id);

	Node parentNode = t.getParent();
	if (parentNode instanceof Element) {
		Element parent = (Element) parentNode;
		if (parent.getLocalName().equalsIgnoreCase("task")) {
			return true;
		} else {
			return false;
		}
	} else {
		return false;
	}
}
 
开发者ID:cst316,项目名称:spring16project-Fortran,代码行数:17,代码来源:TaskListImpl.java

示例11: getBoolean

import nu.xom.Node; //导入依赖的package包/类
public static Boolean getBoolean(String xpath, Node node)
{
    String value = getString(xpath, node);

    if (StringUtils.isNotBlank(value))
    {
        if (ArrayUtils.contains(booleanValues, value.toLowerCase()))
        {
            if (StringUtils.isNumeric(value))
            {
                return Boolean.valueOf("1".equals(value));
            }
        }
        else
        {
            throw new XPathValueConvertException(value);
        }

        return Boolean.valueOf(value);
    }

    return null;
}
 
开发者ID:julian-eggers,项目名称:xpath-helper,代码行数:24,代码来源:XPathHelper.java

示例12: getDateTime

import nu.xom.Node; //导入依赖的package包/类
public static DateTime getDateTime(String xpath, String format, Node node)
{
    String value = getString(xpath, node);

    if (StringUtils.isNotBlank(value))
    {
        try
        {
            return DateHelper.toDateTime(value, format);
        }
        catch (Exception e)
        {
            throw new XPathValueConvertException(e, value);
        }
    }

    return null;
}
 
开发者ID:julian-eggers,项目名称:xpath-helper,代码行数:19,代码来源:XPathHelper.java

示例13: getLong

import nu.xom.Node; //导入依赖的package包/类
public static Long getLong(String xpath, Node node)
{
    String value = getString(xpath, node);

    if (StringUtils.isNotBlank(value))
    {
        try
        {
            return Long.valueOf(value);
        }
        catch (Exception e)
        {
            throw new XPathValueConvertException(e, value);
        }
    }

    return null;
}
 
开发者ID:julian-eggers,项目名称:xpath-helper,代码行数:19,代码来源:XPathHelper.java

示例14: getDate

import nu.xom.Node; //导入依赖的package包/类
public static Date getDate(String xpath, String format, Node node)
{
    String value = getString(xpath, node);

    if (StringUtils.isNotBlank(value))
    {
        try
        {
            return DateHelper.toDate(value, format);
        }
        catch (Exception e)
        {
            throw new XPathValueConvertException(e, value);
        }
    }

    return null;
}
 
开发者ID:julian-eggers,项目名称:xpath-helper,代码行数:19,代码来源:XPathHelper.java

示例15: getBool

import nu.xom.Node; //导入依赖的package包/类
public static boolean getBool(String xpath, Node node)
{
    String value = getString(xpath, node);

    if (StringUtils.isNotBlank(value))
    {
        if (ArrayUtils.contains(booleanValues, value.toLowerCase()))
        {
            if (StringUtils.isNumeric(value))
            {
                return "1".equals(value);
            }
        }
        else
        {
            throw new XPathValueConvertException(value);
        }

        return Boolean.parseBoolean(value);
    }

    return false;
}
 
开发者ID:julian-eggers,项目名称:xpath-helper,代码行数:24,代码来源:XPathHelper.java


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