// It wasn't in the cache, so create a parser to parse the file. We only
// deal with correct files, so turn on validation and install an error
// handler that will throw an exception.
profiles = new ArrayList();
DOMParser parser = XML.createDOMParser();
parser.setErrorHandler(new ErrorHandler() {
public void error(SAXParseException ex) throws SAXParseException {
System.err.println("Parse error line " + ex.getLineNumber() + " column "
+ ex.getColumnNumber() + ": " + ex.getMessage());
throw ex;
}
public void warning(SAXParseException ex) {
System.err.println("Parse warning: " + ex.getMessage());
}
public void fatalError(SAXParseException ex) throws SAXParseException {
throw ex;
}
});
// Parse the file.
InputSource inputSource = new InputSource(url.toString());
parser.parse(inputSource);
Document doc = parser.getDocument();
// Normalize it and get the document element, and from that, create a list
// of profiles, and add it to the cache.
doc.normalize();
Element root = doc.getDocumentElement();