Here is what I am trying to do, I need to know the tags supported by parsing an xsd document. The xsd document unfortunately is not a monolith and is broken into several includes. I tried dom4j, jdom and apache xerces SAXParser and it looks like I can see that the parser recognizes the includes but does not actually load the include inline (as I would expect) for me to know the set of tags.
SAXParser parser = new SAXParser(); parser.setDocumentHandler(new DocHandler()); parser.setContentHandler(new ContentHandler()); parser.parse("http://.../my.xsd");
The parser does not apply any meaning to the element names when it parses an XML file. And that's exactly what your code does there: it tells the parser to parse an XML file. So it sees the element name "xs:include" and treats it just any old element name, no more than that. So yes, that's the expected behaviour.
Now, when you parse some other XML file, and tell the parser that your file is the schema that the other XML file is supposed to conform to, then the parser understands that it's dealing with a schema. In this case when it sees the element name "xs:include" then it understands that it must go and find some other files and do something with them.