while ((iNbByteRead = in.read(buffer)) != -1) {
bOut.write(buffer, 0, iNbByteRead);
} // end while
String document = new String(bOut.toByteArray(), "utf-8");
CSSStyleSheet sheet = CCSSParser.parse(document, null,
null, href);
if (sheet != null) {
cssList.add(sheet);
}
} // end try
catch (final Exception ignore) {
System.err.println("WARNING: could not load CSS : " + href);
} // end catch
} // end if
} // end for
nl = this.getElementsByTagName("style");
StringBuffer sbuffer = new StringBuffer();
for (int i = 0; i < nl.getLength(); i++) {
Element style = (Element) nl.item(i);
NodeList c = style.getChildNodes();
for (int j = 0; j < c.getLength(); j++) {
Node node = c.item(j);
if ((node.getNodeType() == Node.TEXT_NODE)
|| (node.getNodeType() == Node.CDATA_SECTION_NODE)
|| (node.getNodeType() == Node.COMMENT_NODE)
|| (node.getNodeType() == Node.ENTITY_REFERENCE_NODE)) {
sbuffer.append(node.toString());
} // end if
} // end for
} // end for
try {
String document = sbuffer.toString();
CSSStyleSheet sheet = CCSSParser.parse(document, null, null, this
.getDocumentURI());
if (sheet != null) {
cssList.add(sheet);
}