void (boolean onStubs) { myFixture.copyFileToProject("include.xml"); doBuilderTest("inclusion.xml", """ File:foo Element:foo XInclude:href=include.xml xpointer=xpointer(/foo/*) Element:bar Attribute:string:xxx Attribute:int:666 Element:bar XInclude:href=include.xml xpointer=xpointer(/foo/bar-2/*) """); PsiFile file = myFixture.getFile(); if (onStubs) { GCWatcher.tracking(file.getNode()).ensureCollected(); } assertEquals(!onStubs, ((PsiFileImpl) file).isContentsLoaded()); DomManager domManager = DomManager.getDomManager(getProject()); DomFileElement<Foo> element = domManager.getFileElement((XmlFile)file, Foo.class); assert element != null; List<Bar> bars = element.getRootElement().getBars(); assertEquals(3, bars.size()); assertEquals("included", bars.get(0).getString().getValue()); // assertEquals("inclusion.xml", bar.getXmlTag().getContainingFile().getName()); assertEquals(!onStubs, ((PsiFileImpl) file).isContentsLoaded()); Bar lastBar = bars.get(2); assertEquals("included2", assertOneElement(lastBar.getBars()).getString().getStringValue()); XmlTag[] barTags = ((XmlFile)file).getRootTag().findSubTags("bar"); assertSize(3, barTags); for (int i = 1; i < barTags.length; i++) { assertEquals(String.valueOf(i), bars.get(i), domManager.getDomElement(barTags[i])); } }