String txt = handler.getConfig(item);
txtPath.setText(txt);
treeAddButton.computeShowArea(item);
HTMLExtractor extractor = new HTMLExtractor();
NodePathParser pathParser = new NodePathParser();
try {
NodePath nodePath = pathParser.toPath(txt);
HTMLNode node = extractor.lookNode(document.getRoot(), nodePath);
if(node == null) return;
if(node.isNode(Name.CONTENT)
|| node.isNode(Name.COMMENT)
|| node.isNode(Name.UNKNOWN)) {
browser.setText(node.getTextValue());
return;
}
NodePath headerPath = pathParser.toPath("HEAD");
HTMLNode header = extractor.lookNode(document.getRoot(), headerPath);
if(toolbar.isShowAll()) {
if(hyperlinkUtil == null) hyperlinkUtil = new HyperLinkUtil();
try {
String address = toolbar.getText();
URL home = new URL(address);
hyperlinkUtil.createFullNormalLink(node, home);
hyperlinkUtil.createFullImageLink(node, home);
HashMap<String, String> map = new HashMap<String,String>();
map.put("link","href");
map.put("script","src");
hyperlinkUtil.createFullLink(header, map, home, null);
} catch(MalformedURLException me) {
} catch (Exception e) {
ClientLog.getInstance().setException(getShell(), e);
}
}
StringBuilder builder = new StringBuilder();
builder.append("<html>");
builder.append("<head>");
if(toolbar.isShowAll() && header != null && header.getChildren() != null) {
for(HTMLNode ele : header.getChildren()){
builder.append(ele.getTextValue()).append('\n');
}
}
// String baseHref = HTMLExplorer.class.getResource("").toString();
// builder.append("<base href=\""+baseHref+"\">");
if(node.isNode(Name.BODY)) {
HTMLNode body = null;
try {
nodePath = pathParser.toPath("BODY");
body = extractor.lookNode(document.getRoot(), nodePath);
} catch (Exception e) {
ClientLog.getInstance().setException(getShell(), e);
}
if(header == null || body == null) return;