/** * This is a factory method that allows sublasses to use a different type inside this class's methods * @return an empty Assessment object ready to fill up. */ protected Assessment newImportable() { return new Assessment(); }
HtmlDocument doc = new HtmlDocument(); doc.Load("file.htm"); foreach(HtmlNode link in doc.DocumentElement.SelectNodes("//a[@href"]) { }
public Importable translate(Node resourceNode, Document descriptor, String contextPath, String archiveBasePath) { Assessment rv = new Assessment(); rv.setQti(descriptor); rv.setVersion("1.2"); return rv; }
public Importable translate(Node resourceNode, Document descriptor, String contextPath, String archiveBasePath) { Assessment rv = new Assessment(); Document stylesheet = readDocument(xsl); rv.setQti(transformDocument(descriptor, stylesheet)); rv.setVersion("1.2"); rv.setLegacyGroup(Blackboard6FileParser.ASSESSMENT_GROUP); return rv; }
// you get data but do nothing with it here name = nameTf.getText(); type = typeTf.getText(); weighting = Double.parseDouble(weightingTf.getText()); // you create an Assessment object Assessment a = new Assessment(); // you call a bunch of getters??? Shouldn't you be calling setters? a.getName(); a.getType(); a.getWeighting(); aList.add(a);
HtmlDocument document = new HtmlDocument(); document.Load(downloadedHtml); XPathNavigator n = document.CreateNavigator(); XPathNodeIterator scriptTags = n.Select("//script"); foreach (XPathNavigator nav in scriptTags) { string innerXml = nav.InnerXml; // Parse inner xml using regex }
HtmlDocument html = new HtmlDocument(); html.OptionWriteEmptyNodes = true; html.Load("page.htm"); html.DocumentNode.Element("html").Element("body").InnerHtml = "<input type=\"text\" />"; html.LoadHtml(html.DocumentNode.OuterHtml); //Reload the document
HtmlDocument html = new HtmlDocument(); html.OptionWriteEmptyNodes = true; html.LoadHtml("<!DOCTYPE html><html><head><title>ttt</title></head><body></body></html>"); var ETagTable = html.CreateElement("table"); html.DocumentNode.Element("html").Element("body").AppendChild(ETagTable); ETagTable.InnerHtml = "<tr><th>Reference:</th><td><input type=\"text\" size=\"30\"" +"maxlength=\"32\" value=\"\" /></td></tr>"; html.LoadHtml(html.DocumentNode.OuterHtml); //<-- Reload the document Console.WriteLine(html.DocumentNode.InnerHtml);
//fetch the html as string string htmlAsString = webBrowser.SaveToString(); //create an html document from the string HtmlDocument htmlDocument = new HtmlDocument(); htmlDocument.LoadHtml(htmlPage); htmlDocument.GetElementbyId("dynamicTitle").InnerHtml = javascript_tag;
using OpenQA.Selenium; ..... IWebDriver driver = new PhantomJS.PhantomJSDriver(); driver.Navigate().GoToUrl(url); HtmlDocument doc = new HtmlDocument(); doc.LoadHtml(driver.PageSource);
HtmlDocument doc = new HtmlDocument(); doc.OptionWriteEmptyNodes = true; HtmlNode nodeDiv = doc.CreateElement("div"); nodeDiv.InnerHtml = "<table><tr><th>Reference:</th></tr><tr><td><input type='text' id='e.crm_reference' size='30' maxlength='32' value='' /></td></tr></table>";
public Importable translate(Node resourceNode, Document descriptor, String contextPath, String archiveBasePath) { DiscussionTopic rv = new DiscussionTopic(); rv.setTitle(XPathHelper.getNodeValue("//title[1]", descriptor)); rv.setDescription(XPathHelper.getNodeValue("//text[1]", descriptor)); return rv; }
var doc = new HtmlDocument(); doc.LoadHtml(html); foreach(var node in doc.DocumentNode.SelectNodes("//div|//span|//p")) if (string.IsNullOrWhiteSpace(node.InnerText.Replace(@"\n", string.Empty))) node.Remove(); var result = doc.DocumentNode.OuterHtml;
protected Assessment newImportable() { return new QuestionPool(); } }
public Importable translate(Node resourceNode, Document descriptor, String contextPath, String archiveBasePath) { Assessment rv = new Assessment(); rv.setQti(descriptor); rv.setVersion("1.2"); return rv; }
protected Assessment newImportable() { return new Assessment(); }
HtmlDocument doc = new HtmlDocument(); doc.Load("file.htm"); foreach(HtmlNode link in doc.DocumentElement.SelectNodes("//a[@href"]) { HtmlAttribute att = link["href"]; att.Value = FixLink(att); } doc.Save("file.htm");
// Initialize the Chrome Driver (or any other supported browser) using (var driver = new ChromeDriver()) { // open the target page driver.Navigate().GoToUrl("the_targt_page_url_here"); //maybe add selenium waits if needed, //to wait until certain element appear in the page //pass the HTML page to HAP's HtmlDocument HtmlDocument doc = new HtmlDocument(); doc.LoadHtml(driver.PageSource); }
public Importable translate(Node resourceNode, Document descriptor, String contextPath, String archiveBasePath) { DiscussionTopic rv = new DiscussionTopic(); rv.setTitle(XPathHelper.getNodeValue("//title[1]", descriptor)); rv.setDescription(XPathHelper.getNodeValue("//text[1]", descriptor)); return rv; }
protected Assessment newImportable() { return new QuestionPool(); }