xr = spf.newSAXParser().getXMLReader();
} catch (SAXException e) {
xr = new XmlnsUrisPatcher
(spf.newSAXParser().getXMLReader());
}
SAXEventBufferImpl seb = new SAXEventBufferImpl ();
XMLFilterImpl filter = new XMLFilterImpl () {
private int level = 0;
public void startElement
(String uri, String localName, String qName,
Attributes atts) throws SAXException {
if (level > 0) {
super.startElement (uri,localName,qName,atts);
}
level += 1;
}
public void endElement
(String uri, String localName, String qName)
throws SAXException{
level -= 1;
if (level > 0) {
super.endElement (uri, localName, qName);
}
}
};
filter.setContentHandler (seb);
xr.setContentHandler (filter);
xr.parse (new InputSource
(new StringReader
("<temporary-root>" + text + "</temporary-root>")));
seb.pack();
return seb;
} catch (ParserConfigurationException e) {
throw new IllegalArgumentException
("Error initiliazing schema type: " + e.getMessage ());
} catch (SAXException e) {