void (XmlTag tag, @Nullable XmlTag context) { if (myVisited.contains(tag)) return; myVisited.add(tag); if (!XmlNSDescriptorImpl.checkSchemaNamespace(tag)) { processTagWithSubTags(tag, context, null); return; } String tagName = tag.getLocalName(); if (checkTagName(tagName, "element", "attribute")) { XmlAttribute ref = tag.getAttribute("ref"); if (ref != null) { XmlTag resolved = resolveTagReference(ref); if (resolved != null) { tagStarted(resolved, resolved.getLocalName(), tag, tag); } } else { tagStarted(tag, tag.getLocalName(), context, null); } } else if (checkTagName(tagName, "group")) { String value = tag.getAttributeValue("ref"); if (value != null) { XmlTag group = myNsDescriptor.findGroup(value); if (group == null) group = resolveTagReference(tag.getAttribute("ref")); processTagWithSubTags(group, tag, tag); } } else if (checkTagName(tagName, "attributeGroup")) { String ref = tag.getAttributeValue("ref"); if (ref == null) return; XmlTag group; XmlTag parentTag = tag.getParentTag(); assert parentTag != null; if (XmlNSDescriptorImpl.equalsToSchemaName(parentTag, "attributeGroup") && ref.equals(parentTag.getAttributeValue("name"))) { group = resolveTagReference(tag.getAttribute("ref")); if (group == null) group = myNsDescriptor.findAttributeGroup(ref); } else { group = myNsDescriptor.findAttributeGroup(ref); if (group == null) group = resolveTagReference(tag.getAttribute("ref")); } processTagWithSubTags(group, tag, null); } else if (checkTagName(tagName, "restriction", "extension")) { processTagWithSubTags(resolveTagReference(tag.getAttribute("base")), tag, null); processTagWithSubTags(tag, context, null); } else if (!checkTagName(tagName, myTagsToIgnore)) { processTagWithSubTags(tag, context, null); } }