public void startElement(QName element, XMLAttributes attrs, Augmentations augs) throws XNIException { if (this.baseUrl != null) { try { int attrCount = attrs != null ? attrs.getLength() : 0; for (int i = 0; i < attrCount; i++) { String aname = attrs.getQName(i); /** update by jiangjun 2011-5-24 补全file的相对地址 */ if (aname.matches("href|src|action|lsrc|real_src|dynamic-src|file")) { String avalue = attrs.getValue(i); if (null != avalue & !"".equals(avalue) & avalue.indexOf("javascript:") < 0) { attrs.setValue(i, UrlUtil.guessURL(baseUrl, avalue)); } } } } catch (MalformedURLException e) { // TODO Auto-generated catch block e.printStackTrace(); } } String depth = String.valueOf(fElementDepth); attrs.addAttribute( new QName(element.localpart, DEPTH_NAME, DEPTH_NAME, element.uri), "String", depth); if (baseUrl != null && baseUrl.toString().indexOf("app.wumii.com") == -1 && STYLE.equalsIgnoreCase(element.rawname)) { if (attrs.getValue("media") != null && !"screen".equalsIgnoreCase(attrs.getValue("media"))) { notCollectCss = 1; } styleBuffer = new StringBuffer(); } else { super.startElement(element, attrs, augs); fElementDepth++; } }
public void startElement(QName element, XMLAttributes attrs, Augmentations augs) throws XNIException { if (element.rawname.equalsIgnoreCase("script") && attrs != null) { String value = attrs.getValue("type"); if (value != null && value.equalsIgnoreCase(SCRIPT_TYPE)) { String src = attrs.getValue("src"); if (src != null && src.indexOf("/dojo/dojo.js") != -1) { scriptURL = src; scriptURLPrefix = scriptURL.substring(0, scriptURL.indexOf("/dojo/dojo.js")); dojoLoaderPath = scriptURL.substring(0, scriptURL.lastIndexOf('/') + 1); configScriptTag = configScriptTag.replace("__URLPREFIX__", scriptURLPrefix); } } } super.startElement(element, attrs, augs); }