| This routine will return an InputStream which will strip off the DOCTYPE declaration from the source InputStream.
Example declaration: ''
This is mostly used on incomming JAXB unmarshalling where there is no way specify a default
entity resolver. Here is an example...
URL xmlFile = "testfile.xml";
try {
xmlFile = URLHelper.newExtendedURL(name);
} catch (MalformedURLException e) {
log.fatal("Can't Find Components Definition File. Bad URL - " + name, e);
return null;
}
try {
// create a JAXBContext capable of handling classes generated into the package
JAXBContext jc = JAXBContext.newInstance("org.jaffa.presentation.portlet.component.componentdomain");
// create an Unmarshaller
Unmarshaller u = jc.createUnmarshaller();
// enable validation
u.setValidating(true);
// unmarshal a document into a tree of Java content objects composed of classes from the package.
compList = (Components) u.unmarshal(XmlHelper.stripDoctypeDeclaration(xmlFile));
} catch (JAXBException e) {
log.fatal("XML Formatting Error Reading Components Definition File", e);
return null;
} catch (IOException e) {
log.fatal("Error in Reading Components Definition File", e);
return null;
}
Parameters: in - The source InputStream from which the DOCTYPE will be stripped off. The InputStream with no DOCTYPE. throws: IOException - if an I/O error occurs. |