@Override
  public XmlElement getXmlElement() {
    DomStub parentStub = myStub.getParentStub();
    if (parentStub == null) return null;
    List<? extends Stub> children = parentStub.getChildrenStubs();
    if (children.isEmpty()) return null;
    XmlTag parentTag = parentStub.getHandler().getXmlTag();
    if (parentTag == null) return null;

    // for custom elements, namespace information is lost
    // todo: propagate ns info through DomChildDescriptions
    XmlTag[] tags;
    try {
      XmlUtil.BUILDING_DOM_STUBS.set(true);
      tags = parentTag.getSubTags();
    }
    finally {
      XmlUtil.BUILDING_DOM_STUBS.set(false);
    }

    int i = 0;
    String nameToFind = myStub.getName();
    for (XmlTag xmlTag : tags) {
      if (nameToFind.equals(xmlTag.getName()) && !(xmlTag instanceof IncludedXmlTag) && myStub.getIndex() == i++) {
        return xmlTag;
      }
    }
    return null;
  }
@Override
  public XmlElement getXmlElement()