Automatically retrieving XML

Hi all,

I'm using a SAXParser created with a SAXParserFactory with a custom
ContentHandler for parsing XML files and creating some graph
representation of the files contents.

Currently, I generate plain trees, but what I really want is to indicate
cross references as well, as given by element attributes of type

However, Attributes.getType(int) reports only CDATA for all attributes.
So probably I need to create a validating parser. I tried that, but
still no luck, and SAXParserFactory.setValidating(boolean) says that
this is mostly for DTDs anyway and I should set a Schema using

However, the XML files I parse may be completely arbitrary, so I cannot
set some fixed schema. But at least I can presume that they all declare
their schemas properly (and in general there are mostly well-known
schemas), like

--8<---------------cut here---------------start------------->8---
<?xml version="1.0" encoding="UTF-8"?>
<uml:Package xmi:version="2.1"
xmi:id="_FbjLzPlaEeCo98mycbxXgw" name="de.uko.nsd.NSDSchema">
--8<---------------cut here---------------end--------------->8---

Isn't there something that retrieves the needed schemas automatically by
the declarations given in the XML file?

(I remember some years back, I've used some open-source parser [maybe
xerces] that did exactly that when some option was set.)

Thanks for any pointers!