本文整理汇总了C#中DOM类的典型用法代码示例。如果您正苦于以下问题:C# DOM类的具体用法?C# DOM怎么用?C# DOM使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DOM类属于命名空间,在下文中一共展示了DOM类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: GetByQuery
public Player GetByQuery(string name)
{
var SearchResultUrl = "http://svenskfotboll.se/sok/?q=" + name + "&search-type=0";
var SearchDOM = new DOM(SearchResultUrl);
if (SearchDOM != null)
{
var PlayerUrls = Regex.Match(SearchDOM.Html, "<a href=\"(http://svenskfotboll.se/.*/person/.playerid=\\d*)\"");
if (PlayerUrls.Success)
{
string PlayerProfileUrl = PlayerUrls.Groups[1].Value;
return GetPlayerProfile(PlayerProfileUrl);
}
}
else
{
return null;
}
return null;
}
开发者ID:robcar,项目名称:getingarna,代码行数:25,代码来源:PlayerAPI.cs
示例2: GetPlayerProfile
private Player GetPlayerProfile(string url)
{
var Document = new DOM(url);
Player player = new Player();
player.Id = Regex.Match(url, "playerid=(\\d*)").Groups[1].Value;
player.Permalink = url;
player.Name = Document.DocumentModel.SelectSingleNode("//h1[@class='h']").InnerText;
player.ImageUrl = "http://svenskfotboll.se" + Document.DocumentModel.SelectSingleNode("//div[@class='player-image']/img/@src").InnerText;
var TableRows = Document.DocumentModel.SelectNodes("//table[@class='clTblStatBox']//tr");
player.ShirtNumber = Document.DocumentModel.SelectSingleNode("//table[@class='clTblStatBox']//thead").InnerText;
player.ShirtNumber = Regex.Match(player.ShirtNumber, "Nr (\\d*)").Groups[1].Value;
player.BirthDate = TableRows.GetCellValueByFirstColumn("Född:");
var HeightAndWeight = TableRows.GetCellValueByFirstColumn("Längd/Vikt:");
if (HeightAndWeight.Contains("/"))
{
player.Height = HeightAndWeight.Split('/')[0];
player.Weight = HeightAndWeight.Split('/')[1];
}
player.MotherClub = TableRows.GetCellValueByFirstColumn("Moderklubb:");
return player;
}
开发者ID:robcar,项目名称:getingarna,代码行数:28,代码来源:PlayerAPI.cs
示例3: ParseMatches
public List<Match> ParseMatches(DOM document)
{
var matches = new List<Match>();
try
{
var upcomingGamesSection = document.HtmlDoc.DocumentNode.SelectSingleNode("//section[@class='upcoming-games']");
var matchRows = upcomingGamesSection.SelectNodes("//tr[@data-match-id]");
var homeTeamNodes = upcomingGamesSection.SelectNodes("//span[@class='team home']");
var awayTeamNodes = upcomingGamesSection.SelectNodes("//span[@class='team away']");
var matchDates = upcomingGamesSection.SelectNodes("//span[@class='date-short matchTid']");
var matchTimes = upcomingGamesSection.SelectNodes("//span[@class='time matchTid']");
var locations = upcomingGamesSection.SelectNodes("//a[@class='location']");
for (int i = 0; i < matchRows.Count; i++)
{
var homeTeamNode = homeTeamNodes[i];
var homeTeamName = HttpUtility.HtmlDecode(homeTeamNode.InnerHtml);
var awayTeamNode = awayTeamNodes[i];
var awayTeamName = HttpUtility.HtmlDecode(awayTeamNode.InnerHtml);
var matchDate = matchDates[i].InnerText;
if (matchDate == "Imorgon")
{
var tomorrow = DateTime.Now.AddDays(1);
matchDate = string.Format("{0}/{1}", tomorrow.Day, tomorrow.Month);
}
if (matchDate == "Idag")
{
var today = DateTime.Now;
matchDate = string.Format("{0}/{1}", today.Day, today.Month);
}
var dateParts = matchDate.Split("/".ToCharArray());
var dayOfMonth = int.Parse(dateParts[0]);
var month = int.Parse(dateParts[1]);
var matchTime = matchTimes[i].InnerText;
var timeParts = matchTime.Split(":".ToCharArray());
var hour = int.Parse(timeParts[0]);
var minutes = int.Parse(timeParts[1]);
var matchDateComplete = new DateTime(DateTime.Now.Year, month, dayOfMonth, hour, minutes, 0);
var location = locations[i].InnerText;
matches.Add(Match.CreateNew(matchDateComplete, homeTeamName, awayTeamName, location));
}
return matches;
}
catch (Exception)
{
return matches;
}
}
开发者ID:robcar,项目名称:getingarna,代码行数:48,代码来源:AllsvenskanParser.cs
示例4: GetUpcomingMatches
public List<Match> GetUpcomingMatches(int seriesID)
{
List<Match> Upcoming = (List<Match>)Utilities.GetFromCache(seriesID + ":Upcoming");
if (Upcoming == null)
{
Upcoming = new List<Match>();
DOM Document = new DOM(GetWidgetUrl("cominginleague", seriesID));
var TableRows = Document.Query("tr");
char[] querystringSplitChar = { '=' };
int RowCount = 0;
foreach (XmlNode Row in TableRows)
{
try
{
if (RowCount > 2)
{
var Columns = Row.SelectNodes("td");
Match match = new Match();
match.Time = DateTime.Parse(Columns.ValueOfIndex(0));
match.MatchName = Columns.ValueOfIndex(1);
string MatchURI = Columns[1].SelectSingleNode("a").GetAttributeValue("href");
match.ID = MatchURI.Split(querystringSplitChar).LastOrDefault().ToString();
PopulateMatchDetails(match);
Upcoming.Add(match);
}
RowCount = RowCount + 1;
}
catch (Exception ex)
{
}
}
Utilities.InsertToCache(seriesID + ":Upcoming", Upcoming);
}
return Upcoming;
}
开发者ID:robcar,项目名称:getingarna,代码行数:46,代码来源:SoccerAPI.cs
示例5: GetScoreTable
public List<TeamResults> GetScoreTable(int seriesID)
{
List<TeamResults> ScoreTable = (List<TeamResults>)Utilities.GetFromCache(seriesID + ":Scores");
if (ScoreTable == null)
{
ScoreTable = new List<TeamResults>();
DOM Document = new DOM(GetWidgetUrl("table", seriesID));
var TableRows = Document.Query("table//tr");
int RowCount = 0;
foreach (XmlNode Row in TableRows)
{
if (RowCount > 2)
{
var Columns = Row.SelectNodes("td");
TeamResults score = new TeamResults();
score.TeamName = Columns.ValueOfIndex(0);
score.MatchesPlayed = Columns.ValueOfIndex(1);
score.MatchesWon = Columns.ValueOfIndex(2);
score.MatchesDraw = Columns.ValueOfIndex(3);
score.MatchesLost = Columns.ValueOfIndex(4);
score.GoalsMadeAndReceived = Columns.ValueOfIndex(5);
score.Difference = Columns.ValueOfIndex(6);
score.Points = Columns.ValueOfIndex(7);
ScoreTable.Add(score);
}
RowCount = RowCount + 1;
}
Utilities.InsertToCache(seriesID + ":Scores", ScoreTable);
}
return ScoreTable;
}
开发者ID:robcar,项目名称:getingarna,代码行数:41,代码来源:SoccerAPI.cs
示例6: GetSeries
public List<Series> GetSeries()
{
List<Series> AllSeries = (List<Series>)Utilities.GetFromCache("AllSeries");
if (AllSeries == null) {
AllSeries = new List<Series>();
DOM Document = new DOM("http://www.svenskfotboll.se");
var Series = Document.Query("select[@id='ftid-stickybar']//option");
foreach(XmlNode node in Series){
Series serie = new Series();
serie.ID = int.Parse(node.GetAttributeValue("value"));
serie.Name = node.InnerText;
AllSeries.Add(serie);
}
Utilities.InsertToCache("AllSeries", AllSeries);
}
return AllSeries;
}
开发者ID:robcar,项目名称:getingarna,代码行数:21,代码来源:SoccerAPI.cs
示例7: KhtmlValidAttrName
public static bool KhtmlValidAttrName(DOM.DOMString name)
{
return (bool) staticInterceptor.Invoke("khtmlValidAttrName#", "khtmlValidAttrName(const DOM::DOMString&)", typeof(bool), typeof(DOM.DOMString), name);
}
开发者ID:KDE,项目名称:kimono,代码行数:4,代码来源:DOM_Element.cs
示例8: AcceptNode
public virtual short AcceptNode(DOM.Node n)
{
return (short) interceptor.Invoke("acceptNode#", "acceptNode(const DOM::Node&)", typeof(short), typeof(DOM.Node), n);
}
开发者ID:KDE,项目名称:kimono,代码行数:4,代码来源:DOM_CustomNodeFilter.cs
示例9: HTMLTableElement
public HTMLTableElement(DOM.HTMLTableElement other)
: this((Type) null)
{
CreateProxy();
interceptor.Invoke("HTMLTableElement#", "HTMLTableElement(const DOM::HTMLTableElement&)", typeof(void), typeof(DOM.HTMLTableElement), other);
}
开发者ID:KDE,项目名称:kimono,代码行数:6,代码来源:DOM_HTMLTableElement.cs
示例10: SetTHead
/// <remarks>
/// see tHead
/// </remarks> <short> see tHead </short>
public void SetTHead(DOM.HTMLTableSectionElement arg1)
{
interceptor.Invoke("setTHead#", "setTHead(const DOM::HTMLTableSectionElement&)", typeof(void), typeof(DOM.HTMLTableSectionElement), arg1);
}
开发者ID:KDE,项目名称:kimono,代码行数:7,代码来源:DOM_HTMLTableElement.cs
示例11: HTMLSelectElement
public HTMLSelectElement(DOM.Node other)
: this((Type) null)
{
CreateProxy();
interceptor.Invoke("HTMLSelectElement#", "HTMLSelectElement(const DOM::Node&)", typeof(void), typeof(DOM.Node), other);
}
开发者ID:KDE,项目名称:kimono,代码行数:6,代码来源:DOM_HTMLSelectElement.cs
示例12: DOMImplementation
public DOMImplementation(DOM.DOMImplementation other)
: this((Type) null)
{
CreateProxy();
interceptor.Invoke("DOMImplementation#", "DOMImplementation(const DOM::DOMImplementation&)", typeof(void), typeof(DOM.DOMImplementation), other);
}
开发者ID:KDE,项目名称:kimono,代码行数:6,代码来源:DOM_DOMImplementation.cs
示例13: DocumentFragment
public DocumentFragment(DOM.Node other)
: this((Type) null)
{
CreateProxy();
interceptor.Invoke("DocumentFragment#", "DocumentFragment(const DOM::Node&)", typeof(void), typeof(DOM.Node), other);
}
开发者ID:KDE,项目名称:kimono,代码行数:6,代码来源:DOM_DocumentFragment.cs
示例14: AbstractView
public AbstractView(DOM.AbstractView other)
: this((Type) null)
{
CreateProxy();
interceptor.Invoke("AbstractView#", "AbstractView(const DOM::AbstractView&)", typeof(void), typeof(DOM.AbstractView), other);
}
开发者ID:KDE,项目名称:kimono,代码行数:6,代码来源:DOM_AbstractView.cs
示例15: GetInterface
/// <remarks>
/// Introduced in DOM Level 3
/// This method makes available a DOMImplementation's specialized
/// interface.
/// <param> name="feature" The name of the feature requested (case-insensitive)
/// </param></remarks> <return> Returns an alternate DOMImplementation which implements
/// the specialized APIs of the specified feature, if any, or null
/// if there is no alternate DOMImplementation object which implements
/// interfaces associated with that feature. Any alternate DOMImplementation
/// returned by this method must delegate to the primary core DOMImplementation
/// and not return results inconsistent with the primary DOMImplementation.
/// </return>
/// <short> Introduced in DOM Level 3 This method makes available a DOMImplementation's specialized interface.</short>
public DOM.DOMImplementation GetInterface(DOM.DOMString feature)
{
return (DOM.DOMImplementation) interceptor.Invoke("getInterface#", "getInterface(const DOM::DOMString&) const", typeof(DOM.DOMImplementation), typeof(DOM.DOMString), feature);
}
开发者ID:KDE,项目名称:kimono,代码行数:17,代码来源:DOM_DOMImplementation.cs
示例16: SetSelectorText
/// <remarks>
/// see selectorText
/// </remarks> <short> see selectorText </short>
public void SetSelectorText(DOM.DOMString arg1)
{
interceptor.Invoke("setSelectorText#", "setSelectorText(const DOM::DOMString&)", typeof(void), typeof(DOM.DOMString), arg1);
}
开发者ID:KDE,项目名称:kimono,代码行数:7,代码来源:DOM_CSSPageRule.cs
示例17: CSSPageRule
public CSSPageRule(DOM.CSSRule other)
: this((Type) null)
{
CreateProxy();
interceptor.Invoke("CSSPageRule#", "CSSPageRule(const DOM::CSSRule&)", typeof(void), typeof(DOM.CSSRule), other);
}
开发者ID:KDE,项目名称:kimono,代码行数:6,代码来源:DOM_CSSPageRule.cs
示例18: GetStyleFromElement
public WebKitDOMCSSDeclarationStyle GetStyleFromElement(DOM.Element element, string pseudoElement = "") // this feature has not been implemented yet
{
return new WebKitDOMCSSDeclarationStyle(browser.WebView.computedStyleForElement((IDOMElement)element.GetWebKitObject(), pseudoElement));
}
开发者ID:runt18,项目名称:open-webkit-sharp,代码行数:4,代码来源:WebKitCSSClasses.cs
示例19: CreateDocumentType
/// <remarks>
/// Introduced in DOM Level 2
/// Creates an empty DocumentType node. Entity declarations and notations
/// are not made available. Entity reference expansions and default
/// attribute additions do not occur. It is expected that a future version
/// of the DOM will provide a way for populating a DocumentType.
/// HTML-only DOM implementations do not need to implement this method.
/// <param> name="qualifiedName" The qualified name of the document type to be
/// created.
/// </param><param> name="publicId" The external subset public identifier.
/// </param><param> name="systemId" The external subset system identifier.
/// </param> NAMESPACE_ERR: Raised if the qualifiedName is malformed.
/// </remarks> <return> A new DocumentType node with Node.ownerDocument set to null.
/// </return>
/// <short> Introduced in DOM Level 2 </short>
public DOM.DocumentType CreateDocumentType(DOM.DOMString qualifiedName, DOM.DOMString publicId, DOM.DOMString systemId)
{
return (DOM.DocumentType) interceptor.Invoke("createDocumentType###", "createDocumentType(const DOM::DOMString&, const DOM::DOMString&, const DOM::DOMString&)", typeof(DOM.DocumentType), typeof(DOM.DOMString), qualifiedName, typeof(DOM.DOMString), publicId, typeof(DOM.DOMString), systemId);
}
开发者ID:KDE,项目名称:kimono,代码行数:19,代码来源:DOM_DOMImplementation.cs
示例20: CreateDocument
/// <remarks>
/// Introduced in DOM Level 2
/// Creates an XML Document object of the specified type with its document
/// element. HTML-only DOM implementations do not need to implement this
/// method.
/// <param> name="namespaceURI" The namespace URI of the document element to create.
/// </param><param> name="qualifiedName" The qualified name of the document element to be
/// created.
/// </param><param> name="doctype" The type of document to be created or null. When doctype
/// is not null, its Node.ownerDocument attribute is set to the document
/// being created.
/// </param> NAMESPACE_ERR: Raised if the qualifiedName is malformed, if the
/// qualifiedName has a prefix and the namespaceURI is null, or if the
/// qualifiedName has a prefix that is "xml" and the namespaceURI is
/// different from "http://www.w3.org/XML/1998/namespace" [Namespaces].
/// WRONG_DOCUMENT_ERR: Raised if doctype has already been used with a
/// different document or was created from a different implementation.
/// </remarks> <return> A new Document object.
/// </return>
/// <short> Introduced in DOM Level 2 </short>
public DOM.Document CreateDocument(DOM.DOMString namespaceURI, DOM.DOMString qualifiedName, DOM.DocumentType doctype)
{
return (DOM.Document) interceptor.Invoke("createDocument###", "createDocument(const DOM::DOMString&, const DOM::DOMString&, const DOM::DocumentType&)", typeof(DOM.Document), typeof(DOM.DOMString), namespaceURI, typeof(DOM.DOMString), qualifiedName, typeof(DOM.DocumentType), doctype);
}
开发者ID:KDE,项目名称:kimono,代码行数:24,代码来源:DOM_DOMImplementation.cs
注:本文中的DOM类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论