nu.xom.Attribute.getParent()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(2.8k)|赞(0)|评价(0)|浏览(107)

本文整理了Java中nu.xom.Attribute.getParent()方法的一些代码示例,展示了Attribute.getParent()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Attribute.getParent()方法的具体详情如下:
包路径:nu.xom.Attribute
类名称:Attribute
方法名:getParent

Attribute.getParent介绍

暂无

代码示例

代码示例来源:origin: org.teiid/saxon-xom

/**
 * Get the index position of this node among its siblings (starting from 0)
 */
public int getSiblingPosition() {
  // This method is used only to support generate-id()
  if (index != -1) return index;
  switch (nodeKind) {
    case Type.ATTRIBUTE: {
      Attribute att = (Attribute) node;
      Element p = (Element) att.getParent();
      if (p == null) return 0;
      for (int i = p.getAttributeCount(); --i >= 0; ) {
        if (p.getAttribute(i) == att) {
          index = i;
          return i;
        }
      }
      throw new IllegalStateException("XOM node not linked to parent node");
    }
    default: {
      ParentNode p = node.getParent();
      int i = (p == null ? 0 : p.indexOf(node));
      if (i == -1) throw new IllegalStateException("XOM node not linked to parent node");
      index = i;
      return index;
    }
  }
}

代码示例来源:origin: org.jboss.teiid/teiid-engine

/**
 * Get the index position of this node among its siblings (starting from 0)
 */
public int getSiblingPosition() {
  // This method is used only to support generate-id()
  if (index != -1) return index;
  switch (nodeKind) {
    case Type.ATTRIBUTE: {
      Attribute att = (Attribute) node;
      Element p = (Element) att.getParent();
      if (p == null) return 0;
      for (int i = p.getAttributeCount(); --i >= 0; ) {
        if (p.getAttribute(i) == att) {
          index = i;
          return i;
        }
      }
      throw new IllegalStateException("XOM node not linked to parent node");
    }
    default: {
      ParentNode p = node.getParent();
      int i = (p == null ? 0 : p.indexOf(node));
      if (i == -1) throw new IllegalStateException("XOM node not linked to parent node");
      index = i;
      return index;
    }
  }
}

代码示例来源:origin: teiid/teiid

/**
 * Get the index position of this node among its siblings (starting from 0)
 */
public int getSiblingPosition() {
  // This method is used only to support generate-id()
  if (index != -1) return index;
  switch (nodeKind) {
    case Type.ATTRIBUTE: {
      Attribute att = (Attribute) node;
      Element p = (Element) att.getParent();
      if (p == null) return 0;
      for (int i = p.getAttributeCount(); --i >= 0; ) {
        if (p.getAttribute(i) == att) {
          index = i;
          return i;
        }
      }
      throw new IllegalStateException("XOM node not linked to parent node");
    }
    default: {
      ParentNode p = node.getParent();
      int i = (p == null ? 0 : p.indexOf(node));
      if (i == -1) throw new IllegalStateException("XOM node not linked to parent node");
      index = i;
      return index;
    }
  }
}

代码示例来源:origin: org.xml-cml/cmlxom

void substituteNameByValue(Attribute att) {
  // do not substitute refs
  if (att instanceof RefAttribute) {
  } else {
    String value = att.getValue();
    String value1 = value;
    String newValue = this.getValue().trim();
    if (!newValue.equals(S_EMPTY)) {
      value1 = value1.replaceAll(S_UNDER+this.getName()+S_UNDER, newValue);
      if (!value.equals(value1)) {
        Element parent = (Element) att.getParent();
        // remove attribute so as not to triffer reset error
        parent.removeAttribute(parent.getAttribute(att.getLocalName()));
        att.setValue(value1);
        parent.addAttribute(att);
      } else {
      }
    }
  }
}

代码示例来源:origin: pierre/meteo

ParentNode parent = this.getParent();
if (parent != null) {

相关文章