public void FixRefs() { PrepareHAP(); var fixRules = new FixTagRule[] { new FixTagRule { TagName = "img", ResAttrName = "src", FolderToRelocateRes = _imgFolder }, new FixTagRule { TagName = "link", ResAttrName = "href", FolderToRelocateRes = null }, new FixTagRule { TagName = "script", ResAttrName = "src", FolderToRelocateRes = null }, new FixTagRule { TagName = "a", ResAttrName = "href", FolderToRelocateRes = null }, new FixTagRule { TagName = "area", ResAttrName = "href", FolderToRelocateRes = null }, new FixTagRule { TagName = "embed", ResAttrName = "src", FolderToRelocateRes = null } }; FixRefsUsingRules(fixRules); }
private void FixRefs(HtmlDocument doc, FixTagRule rule, string srcFile, List <string> errors) { HtmlNodeCollection tags = doc.DocumentNode.SelectNodes("//" + rule.TagName); if (tags != null) { foreach (HtmlNode tag in tags) { HtmlAttribute attr = tag.Attributes.Where(x => string.Compare(x.Name, rule.ResAttrName, true) == 0).FirstOrDefault(); if (attr != null) { FixTagRef(tag, attr, rule.FolderToRelocateRes, srcFile, errors); } } } }