gpt4 book ai didi

org.xmlpull.v1.builder.XmlElement.getParent()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-25 20:01:05 28 4
gpt4 key购买 nike

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

XmlElement.getParent介绍

[英]XML Infoset [parent] property. If current element is not child of containing parent XmlElement or XmlDocument then builder exception will be thrown
[中]XML信息集[parent]属性。如果当前元素不是包含父XmlElement或XmlDocument的子元素,则将引发生成器异常

代码示例

代码示例来源:origin: org.ogce/xpp3

private static XmlDocument getDocument(XmlElement el) {
  //TODO recursively work until parent document
  XmlElement root = el;
  while(root.getParent() instanceof XmlElement) {
    root = (XmlElement) root.getParent();
  }
  return (XmlDocument) root.getParent();
}

代码示例来源:origin: xpp3/xpp3_xpath

private static XmlDocument getDocument(XmlElement el) {
  //TODO recursively work until parent document
  XmlElement root = el;
  while(root.getParent() instanceof XmlElement) {
    root = (XmlElement) root.getParent();
  }
  return (XmlDocument) root.getParent();
}

代码示例来源:origin: org.ogce/xpp3

public XmlContainer getRoot() {
  XmlContainer root = this;
  while(true) {
    if(! ( root instanceof XmlElement )) {
      break;
    }
    XmlElement el = (XmlElement) root;
    if(el.getParent() != null) {
      root= el.getParent();
    } else {
      break;
    }
  }
  return root;
}

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

public XmlContainer getRoot() {
  XmlContainer root = this;
  while(true) {
    if(! ( root instanceof XmlElement )) {
      break;
    }
    XmlElement el = (XmlElement) root;
    if(el.getParent() != null) {
      root= el.getParent();
    } else {
      break;
    }
  }
  return root;
}

代码示例来源:origin: org.ogce/xpp3

private void fixImportedChildParent(Object child) {
  if(child instanceof XmlElement) {
    XmlElement childEl = (XmlElement) child;
    XmlContainer childElParent = childEl.getParent();
    if(childElParent == target) {
      childEl.setParent(this);
    }
  }
}

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

private void fixImportedChildParent(Object child) {
  if(child instanceof XmlElement) {
    XmlElement childEl = (XmlElement) child;
    XmlContainer childElParent = childEl.getParent();
    if(childElParent == target) {
      childEl.setParent(this);
    }
  }
}

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

private void fixImportedChildParent(Object child) {
  if(child instanceof XmlElement) {
    XmlElement childEl = (XmlElement) child;
    XmlContainer childElParent = childEl.getParent();
    if(childElParent == target) {
      childEl.setParent(this);
    }
  }
}

代码示例来源:origin: org.ogce/xpp3

private void fixImportedChildParent(Object child) {
  if(child instanceof XmlElement) {
    XmlElement childEl = (XmlElement) child;
    XmlContainer childElParent = childEl.getParent();
    if(childElParent == target) {
      childEl.setParent(this);
    }
  }
}

代码示例来源:origin: org.ogce/xpp3

private void checkChildParent(Object child) {
  if(child instanceof XmlContainer) {
    if(child instanceof XmlElement) {
      XmlElement elChild = (XmlElement) child;
      XmlContainer childParent = elChild.getParent();
      if(childParent != null) {
        if(childParent != parent) {
          throw new XmlBuilderException(
            "child must have no parent to be added to this node");
        }
      }
    } else if(child instanceof XmlDocument) {
      throw new XmlBuilderException("docuemet can not be stored as element child");
    }
  }
}

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

private void checkChildParent(Object child) {
  if(child instanceof XmlContainer) {
    if(child instanceof XmlElement) {
      XmlElement elChild = (XmlElement) child;
      XmlContainer childParent = elChild.getParent();
      if(childParent != null) {
        if(childParent != parent) {
          throw new XmlBuilderException(
            "child must have no parent to be added to this node");
        }
      }
    } else if(child instanceof XmlDocument) {
      throw new XmlBuilderException("docuemet can not be stored as element child");
    }
  }
}

代码示例来源:origin: org.ogce/xpp3

private void setTarget(XmlElement target) {
  this.target = target;
  if(target.getParent() != null) {
    //
    //throw new XmlBuilderException("element to wrap must have no parent to be wrapped");
    //XmlContainer parent = target.getParent();
    parent = target.getParent();
    if(parent instanceof XmlDocument) {
      XmlDocument doc = (XmlDocument) parent;
      doc.setDocumentElement(this);
    } if(parent instanceof XmlElement) {
      XmlElement parentEl = (XmlElement) parent;
      parentEl.replaceChild(this, target);
    }
  }
  // new "wrapping" parent replaces old parent for children
  Iterator iter = target.children();
  while (iter.hasNext())
  {
    Object child = iter.next();
    fixImportedChildParent(child);
  }
  //target.setParent(null);
  //IdentityHashMap id = nul;
}

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

private void setTarget(XmlElement target) {
  this.target = target;
  if(target.getParent() != null) {
    //
    //throw new XmlBuilderException("element to wrap must have no parent to be wrapped");
    //XmlContainer parent = target.getParent();
    parent = target.getParent();
    if(parent instanceof XmlDocument) {
      XmlDocument doc = (XmlDocument) parent;
      doc.setDocumentElement(this);
    } if(parent instanceof XmlElement) {
      XmlElement parentEl = (XmlElement) parent;
      parentEl.replaceChild(this, target);
    }
  }
  // new "wrapping" parent replaces old parent for children
  Iterator iter = target.children();
  while (iter.hasNext())
  {
    Object child = iter.next();
    fixImportedChildParent(child);
  }
  //target.setParent(null);
  //IdentityHashMap id = nul;
}

代码示例来源:origin: org.ogce/xpp3

if(current.getParent() instanceof XmlElement) {
  current = (XmlElement) current.getParent();
} else {
  current = null;

代码示例来源:origin: xpp3/xpp3_xpath

if(current.getParent() instanceof XmlElement) {
  current = (XmlElement) current.getParent();
} else {
  current = null;

代码示例来源:origin: org.ogce/xpp3

parent = ((XmlElement)contextNode).getParent();

代码示例来源:origin: xpp3/xpp3_xpath

parent = ((XmlElement)contextNode).getParent();

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

curElem = child;
} else if(eventType == XmlPullParser.END_TAG) {
  XmlContainer parent = curElem.getParent();
  if(parent == null) {
    if(pp.getDepth() != depth) {

代码示例来源:origin: org.ogce/xpp3

curElem = child;
} else if(eventType == XmlPullParser.END_TAG) {
  XmlContainer parent = curElem.getParent();
  if(parent == null) {
    if(pp.getDepth() != depth) {

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com