void visitXmlElement(XmlElement element, ElementStub parent, int index) {

    if (XmlIncludeHandler.isXInclude(element)) {
      XmlTag tag = (XmlTag)element;
      new XIncludeStub(parent, tag.getAttributeValue("href"), tag.getAttributeValue("xpointer"));
      return;
    }

    DomInvocationHandler handler = myManager.getDomHandler(element);
    if (handler == null || handler.getAnnotation(Stubbed.class) == null && !handler.getChildDescription().isStubbed()) return;

    AbstractDomChildrenDescription description = handler.getChildDescription();
    String nsKey = description instanceof DomChildrenDescription ? ((DomChildrenDescription)description).getXmlName().getNamespaceKey() : "";
    if (element instanceof XmlTag tag) {
      String elementClass = null;
      if (handler.getAnnotation(StubbedOccurrence.class) != null) {
        elementClass = ((Class<?>)description.getType()).getName();
      }
      ElementStub stub = new ElementStub(parent,
                                         tag.getName(),
                                         StringUtil.notNullize(nsKey),
                                         index,
                                         description instanceof CustomDomChildrenDescription,
                                         elementClass,
                                         tag.getSubTags().length == 0 ? tag.getValue().getTrimmedText() : "");

      for (XmlAttribute attribute : tag.getAttributes()) {
        visitXmlElement(attribute, stub, 0);
      }
      Map<String, Integer> indices = new HashMap<>();
      for (final XmlTag subTag : tag.getSubTags()) {
        String name = subTag.getName();
        Integer i = indices.get(name);
        i = i == null ? 0 : i + 1;
        visitXmlElement(subTag, stub, i);
        indices.put(name, i);
      }
    } else if (element instanceof XmlAttribute xmlAttribute) {
      new AttributeStub(parent, xmlAttribute.getLocalName(),
                        StringUtil.notNullize(nsKey),
                        StringUtil.notNullize(xmlAttribute.getValue()));
    }
  }
void visitXmlElement(XmlElement element, ElementStub parent, int index)