* parse the content-type, possibly changing character-encoding.
*/
private void parseContentType(Node parent, String contentType)
throws IOException, XslParseException
{
CharCursor cursor = new StringCharCursor(contentType);
CharBuffer buf = new CharBuffer();
wsScanner.skip(cursor);
delimScanner.scan(cursor, buf);
if (buf.length() <= 0)
return;
Element output = xsl.createElementNS(XSLNS, "xsl:output");
parent.appendChild(output);
output.setAttribute("media-type", buf.toString());
delimScanner.skip(cursor);
buf.clear();
delimScanner.scan(cursor, buf);
wsScanner.skip(cursor);
if (cursor.current() == '=' && buf.toString().equals("charset")) {
delimScanner.skip(cursor);
buf.clear();
delimScanner.scan(cursor, buf);
if (buf.length() > 0) {
output.setAttribute("encoding", Encoding.getMimeName(buf.toString()));