本文整理汇总了C#中Google.GData.Client.AtomFeedParser类的典型用法代码示例。如果您正苦于以下问题:C# AtomFeedParser类的具体用法?C# AtomFeedParser怎么用?C# AtomFeedParser使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AtomFeedParser类属于Google.GData.Client命名空间,在下文中一共展示了AtomFeedParser类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Parse
//////////////////////////////////////////////////////////////////////
/// <summary>parses the inner state of the element</summary>
/// <param name="e">the Event arguments</param>
/// <param name="parser">the atomFeedParser that called this</param>
//////////////////////////////////////////////////////////////////////
public override void Parse(ExtensionElementEventArgs e, AtomFeedParser parser)
{
XmlNode eventNode = e.ExtensionElement;
Tracing.TraceMsg(eventNode.LocalName);
// Ensure that the namespace is correct.
if (String.Compare(eventNode.NamespaceURI,
GCodeSearchParserNameTable.CSNamespace, true) == 0)
{
// Parse a File Element
if (eventNode.LocalName == GCodeSearchParserNameTable.EVENT_FILE)
{
file = File.ParseFile(eventNode, parser);
e.DiscardEntry = true;
}
// Parse a Package Element
else if ((eventNode.LocalName == GCodeSearchParserNameTable.EVENT_PACKAGE))
{
package = Package.ParsePackage(eventNode, parser);
e.DiscardEntry = true;
}
// Parse Match Elements
else if (eventNode.LocalName == GCodeSearchParserNameTable.EVENT_MATCH)
{
matches.Add(Match.ParseMatch(eventNode, parser));
e.DiscardEntry = true;
}
}
}
开发者ID:nagyist,项目名称:GoogleAnalytics-MonoMac-Demo,代码行数:34,代码来源:codesearchentry.cs
示例2: CreateInstance
//////////////////////////////////////////////////////////////////////
/// <summary>Parses an xml node to create a GsaExtension object.</summary>
/// <param name="node">the node to parse node</param>
/// <param name="parser">the xml parser to use if we need to dive deeper</param>
/// <returns>the created GsaExtension object</returns>
//////////////////////////////////////////////////////////////////////
public IExtensionElementFactory CreateInstance(XmlNode node, AtomFeedParser parser)
{
Tracing.TraceCall();
GsaExtension gsa = null;
if (node != null)
{
object localname = node.LocalName;
if (localname.Equals(this.XmlName) == false ||
node.NamespaceURI.Equals(this.XmlNameSpace) == false)
{
return null;
}
}
gsa = new GsaExtension();
if (node != null)
{
if (node.Attributes == null || node.Attributes[PropertyName] == null)
{
throw new ArgumentException("GsaContent name can not found in this name space");
}
gsa.ContentName = node.Attributes[PropertyName].Value;
gsa.ContentValue = node.InnerText == null ? "" : node.InnerText;
}
return gsa;
}
开发者ID:samrazi,项目名称:google-enterprise-gdata-api,代码行数:34,代码来源:gsaextension.cs
示例3: ParseFile
//////////////////////////////////////////////////////////////////////
/// <summary>Parses an xml node to create a File object.</summary>
/// <param name="node">File node</param>
/// <param name="parser">AtomFeedParser to use</param>
/// <returns>the created File object</returns>
//////////////////////////////////////////////////////////////////////
public static File ParseFile(XmlNode node, AtomFeedParser parser)
{
Tracing.TraceCall();
File file = null;
Tracing.Assert(node != null, "node should not be null");
if (node == null)
{
throw new ArgumentNullException("node");
}
// Ensure that the namespace is correct.
if (String.Compare(node.NamespaceURI,
GCodeSearchParserNameTable.CSNamespace, true) == 0)
{
file = new File();
if (node.Attributes != null)
{
file.filename =
node.Attributes[
GCodeSearchParserNameTable.ATTRIBUTE_NAME].Value;
}
else
{
throw new ArgumentNullException(
BaseNameTable.gBatchNamespace +
":" + GCodeSearchParserNameTable.EVENT_FILE + " must contain exactly one "
+ GCodeSearchParserNameTable.ATTRIBUTE_NAME + " attribute");
}
}
return file;
}
开发者ID:nagyist,项目名称:GoogleAnalytics-MonoMac-Demo,代码行数:37,代码来源:file.cs
示例4: CreateInstance
//////////////////////////////////////////////////////////////////////
/// <summary>Parses an xml node to create a Where object.</summary>
/// <param name="node">the node to parse node</param>
/// <param name="parser">the xml parser to use if we need to dive deeper</param>
/// <returns>the created Where object</returns>
//////////////////////////////////////////////////////////////////////
public IExtensionElementFactory CreateInstance(XmlNode node, AtomFeedParser parser)
{
Tracing.TraceCall();
RecurrenceException exception = null;
if (node != null)
{
object localname = node.LocalName;
if (localname.Equals(this.XmlName) == false ||
node.NamespaceURI.Equals(this.XmlNameSpace) == false)
{
return null;
}
}
exception = new RecurrenceException();
if (node != null)
{
if (node.Attributes != null)
{
if (node.Attributes[GDataParserNameTable.XmlAttributeSpecialized] != null)
{
exception.Specialized = bool.Parse(node.Attributes[GDataParserNameTable.XmlAttributeSpecialized].Value);
}
}
if (node.HasChildNodes)
{
XmlNode childNode = node.FirstChild;
while (childNode != null && childNode is XmlElement)
{
if (childNode.LocalName == GDataParserNameTable.XmlEntryLinkElement)
{
exception.EntryLink = EntryLink.ParseEntryLink(childNode, parser);
}
childNode = childNode.NextSibling;
}
}
if (exception.EntryLink == null)
{
throw new ArgumentException("g:recurringException/entryLink is required.");
}
}
return exception;
}
开发者ID:yodiz,项目名称:Avega.ContactSynchronizer,代码行数:53,代码来源:recurexception.cs
示例5: Parse
/// <summary>
/// Parses the inner state of the element
/// </summary>
/// <param name="e">The extension element that should be added to this entry</param>
/// <param name="parser">The AtomFeedParser that called this</param>
public virtual void Parse(ExtensionElementEventArgs e, AtomFeedParser parser)
{
Tracing.TraceMsg("Entering Parse on AbstractEntry");
XmlNode node = e.ExtensionElement;
if (this.ExtensionFactories != null && this.ExtensionFactories.Count > 0)
{
Tracing.TraceMsg("Entring default Parsing for AbstractEntry");
IExtensionElementFactory f = FindExtensionFactory(node.LocalName,
node.NamespaceURI);
if (f != null)
{
this.ExtensionElements.Add(f.CreateInstance(node, parser));
e.DiscardEntry = true;
}
}
return;
}
开发者ID:mintwans,项目名称:cpsc483,代码行数:23,代码来源:abstractentry.cs
示例6: CreateAtomSubElement
/// <summary>
/// this is the subclassing method for AtomBase derived
/// classes to overload what childelements should be created
/// needed to create CustomLink type objects, like WebContentLink etc
/// </summary>
/// <param name="reader">The XmlReader that tells us what we are working with</param>
/// <param name="parser">the parser is primarily used for nametable comparisons</param>
/// <returns>AtomBase</returns>
public override AtomBase CreateAtomSubElement(XmlReader reader, AtomFeedParser parser)
{
if (reader == null)
{
throw new ArgumentNullException("reader");
}
if (parser == null)
{
throw new ArgumentNullException("parser");
}
Object localname = reader.LocalName;
if (localname.Equals(parser.Nametable.Category))
{
return new YouTubeCategory();
}
return base.CreateAtomSubElement(reader, parser);
}
开发者ID:yodiz,项目名称:Avega.ContactSynchronizer,代码行数:26,代码来源:youtubeentry.cs
示例7: ParseRecurrenceException
//////////////////////////////////////////////////////////////////////
/// <summary>parses an xml node to create a Recurrence object</summary>
/// <param name="node">Recurrence node</param>
/// <param name="parser">AtomFeedParser to use</param>
/// <returns> the created Recurrence object</returns>
//////////////////////////////////////////////////////////////////////
public static RecurrenceException ParseRecurrenceException(XmlNode node, AtomFeedParser parser)
{
Tracing.TraceCall();
RecurrenceException exception = null;
Tracing.Assert(node != null, "node should not be null");
if (node == null)
{
throw new ArgumentNullException("node");
}
object localname = node.LocalName;
if (localname.Equals(GDataParserNameTable.XmlRecurrenceExceptionElement))
{
exception = new RecurrenceException();
if (node.Attributes != null)
{
if (node.Attributes[GDataParserNameTable.XmlAttributeSpecialized] != null)
{
exception.Specialized = bool.Parse(node.Attributes[GDataParserNameTable.XmlAttributeSpecialized].Value);
}
}
if (node.HasChildNodes)
{
XmlNode childNode = node.FirstChild;
while (childNode != null && childNode is XmlElement)
{
if (childNode.LocalName == GDataParserNameTable.XmlEntryLinkElement)
{
exception.EntryLink = EntryLink.ParseEntryLink(childNode, parser);
}
childNode = childNode.NextSibling;
}
}
}
if (exception.EntryLink == null)
{
throw new ArgumentException("g:recurringException/entryLink is required.");
}
return exception;
}
开发者ID:mintwans,项目名称:cpsc483,代码行数:50,代码来源:recurexception.cs
示例8: CreateInstance
//////////////////////////////////////////////////////////////////////
/// <summary>Parses an xml node to create a Where object.</summary>
/// <param name="node">the node to parse node</param>
/// <param name="parser">the xml parser to use if we need to dive deeper</param>
/// <returns>the created Where object</returns>
//////////////////////////////////////////////////////////////////////
public IExtensionElementFactory CreateInstance(XmlNode node, AtomFeedParser parser)
{
Tracing.TraceCall();
Comments comments = null;
if (node != null)
{
object localname = node.LocalName;
if (!localname.Equals(this.XmlName) ||
!node.NamespaceURI.Equals(this.XmlNameSpace))
{
return null;
}
}
comments = new Comments();
if (node != null)
{
if (node.HasChildNodes)
{
XmlNode commentsChild = node.FirstChild;
while (commentsChild != null && commentsChild is XmlElement)
{
if (commentsChild.LocalName == GDataParserNameTable.XmlFeedLinkElement &&
commentsChild.NamespaceURI == BaseNameTable.gNamespace)
{
if (comments.FeedLink == null)
{
comments.FeedLink = FeedLink.ParseFeedLink(commentsChild);
}
else
{
throw new ArgumentException("Only one feedLink is allowed inside the gd:comments");
}
}
commentsChild = commentsChild.NextSibling;
}
}
}
return comments;
}
开发者ID:Zelxin,项目名称:RPiKeg,代码行数:49,代码来源:comments.cs
示例9: ParsePackage
//////////////////////////////////////////////////////////////////////
/// <summary>Parses an xml node to create a Package object.</summary>
/// <param name="node">Package node</param>
/// <param name="parser">AtomFeedParser to use</param>
/// <returns>the created Package object</returns>
//////////////////////////////////////////////////////////////////////
public static Package ParsePackage(XmlNode node, AtomFeedParser parser)
{
Tracing.TraceCall();
Package package = null;
Tracing.Assert(node != null, "node should not be null");
if (node == null)
{
throw new ArgumentNullException("node");
}
object localname = node.LocalName;
// Ensure that the namespace is correct.
if (String.Compare(node.NamespaceURI,
GCodeSearchParserNameTable.CSNamespace, true) == 0)
{
if (localname.Equals(GCodeSearchParserNameTable.EVENT_PACKAGE))
{
package = new Package();
if (node.Attributes != null)
{
package.name =
node.Attributes[
GCodeSearchParserNameTable.ATTRIBUTE_NAME].Value;
package.uri =
node.Attributes[
GCodeSearchParserNameTable.ATTRIBUTE_URI].Value;
}
else
{
throw new ArgumentNullException(
BaseNameTable.gBatchNamespace +
":" + GCodeSearchParserNameTable.EVENT_PACKAGE +
" must contain the attributes " +
GCodeSearchParserNameTable.ATTRIBUTE_NAME + " and " +
GCodeSearchParserNameTable.ATTRIBUTE_URI);
}
}
}
return package;
}
开发者ID:yodiz,项目名称:Avega.ContactSynchronizer,代码行数:46,代码来源:package.cs
示例10: CreateInstance
//////////////////////////////////////////////////////////////////////
/// <summary>Parses an xml node to create a Reminder object.</summary>
/// <param name="node">the node to parse node</param>
/// <param name="parser">the xml parser to use if we need to dive deeper</param>
/// <returns>the created Reminder object</returns>
//////////////////////////////////////////////////////////////////////
public IExtensionElementFactory CreateInstance(XmlNode node, AtomFeedParser parser)
{
Tracing.TraceCall();
if (node != null)
{
object localname = node.LocalName;
if (!localname.Equals(this.XmlName) ||
!node.NamespaceURI.Equals(this.XmlNameSpace))
{
return null;
}
}
Recurrence recurrence = new Recurrence();
if (node != null)
{
recurrence.Value = node.InnerText.Trim();
}
return recurrence;
}
开发者ID:Zelxin,项目名称:RPiKeg,代码行数:28,代码来源:recurrence.cs
示例11: CreateInstance
//////////////////////////////////////////////////////////////////////
/// <summary>Parses an xml node to create a Reminder object.</summary>
/// <param name="node">the node to parse node</param>
/// <param name="parser">the xml parser to use if we need to dive deeper</param>
/// <returns>the created Reminder object</returns>
//////////////////////////////////////////////////////////////////////
public IExtensionElementFactory CreateInstance(XmlNode node, AtomFeedParser parser)
{
Tracing.TraceCall();
Reminder reminder = null;
if (node != null)
{
object localname = node.LocalName;
if (localname.Equals(this.XmlName) == false ||
node.NamespaceURI.Equals(this.XmlNameSpace) == false)
{
return null;
}
}
reminder = new Reminder();
if (node != null && node.Attributes != null)
{
if (node.Attributes[GDataParserNameTable.XmlAttributeAbsoluteTime] != null)
{
try
{
reminder.AbsoluteTime =
DateTime.Parse(node.Attributes[GDataParserNameTable.XmlAttributeAbsoluteTime].Value);
}
catch (FormatException fe)
{
throw new ArgumentException("Invalid g:reminder/@absoluteTime.", fe);
}
}
if (node.Attributes[GDataParserNameTable.XmlAttributeDays] != null)
{
try
{
reminder.Days = Int32.Parse(node.Attributes[GDataParserNameTable.XmlAttributeDays].Value);
}
catch (FormatException fe)
{
throw new ArgumentException("Invalid g:reminder/@days.", fe);
}
}
if (node.Attributes[GDataParserNameTable.XmlAttributeHours] != null)
{
try
{
reminder.Hours = Int32.Parse(node.Attributes[GDataParserNameTable.XmlAttributeHours].Value);
}
catch (FormatException fe)
{
throw new ArgumentException("Invalid g:reminder/@hours.", fe);
}
}
if (node.Attributes[GDataParserNameTable.XmlAttributeMinutes] != null)
{
try
{
reminder.Minutes = Int32.Parse(node.Attributes[GDataParserNameTable.XmlAttributeMinutes].Value);
}
catch (FormatException fe)
{
throw new ArgumentException("Invalid g:reminder/@minutes.", fe);
}
}
if (node.Attributes[GDataParserNameTable.XmlAttributeMethod] != null)
{
try
{
reminder.Method = (ReminderMethod)Enum.Parse(typeof(ReminderMethod),
node.Attributes[GDataParserNameTable.XmlAttributeMethod].Value,
true);
}
catch (Exception e)
{
throw new ArgumentException("Invalid g:reminder/@method.", e);
}
}
}
return reminder;
}
开发者ID:nagyist,项目名称:GoogleAnalytics-MonoMac-Demo,代码行数:89,代码来源:reminder.cs
示例12: CreateInstance
//////////////////////////////////////////////////////////////////////
/// <summary>Parses an xml node to create a Where object.</summary>
/// <param name="node">the node to parse node</param>
/// <param name="parser">the xml parser to use if we need to dive deeper</param>
/// <returns>the created Where object</returns>
//////////////////////////////////////////////////////////////////////
public IExtensionElementFactory CreateInstance(XmlNode node, AtomFeedParser parser)
{
return FeedLink.ParseFeedLink(node);
}
开发者ID:Zelxin,项目名称:RPiKeg,代码行数:10,代码来源:feedlink.cs
示例13: CreateInstance
// end of accessor public ArrayList Extensions
//////////////////////////////////////////////////////////////////////
/// <summary>Parses an xml node to create a Who object.</summary>
/// <param name="node">the node to work on, can be NULL</param>
/// <param name="parser">the xml parser to use if we need to dive deeper</param>
/// <returns>the created SimpleElement object</returns>
//////////////////////////////////////////////////////////////////////
public override IExtensionElement CreateInstance(XmlNode node, AtomFeedParser parser)
{
Tracing.TraceCall("for: " + XmlName);
if (node != null)
{
object localname = node.LocalName;
if (localname.Equals(this.XmlName) == false ||
node.NamespaceURI.Equals(this.XmlNameSpace) == false)
{
return null;
}
}
SimpleContainer sc = null;
// create a new container
sc = this.MemberwiseClone() as SimpleContainer;
if (node != null && node.HasChildNodes)
{
XmlNode childNode = node.FirstChild;
while (childNode != null && childNode is XmlElement)
{
foreach (IExtensionElementFactory f in this.ExtensionFactories)
{
if (String.Compare(childNode.NamespaceURI, f.XmlNameSpace) == 0)
{
if (String.Compare(childNode.LocalName, f.XmlName) == 0)
{
Tracing.TraceMsg("Added extension to SimpleContainer for: " + f.XmlName);
sc.ExtensionElements.Add(f.CreateInstance(childNode, parser));
break;
}
}
}
childNode = childNode.NextSibling;
}
if (node.Attributes != null)
{
sc.ProcessAttributes(node);
}
}
return sc;
}
开发者ID:mintwans,项目名称:cpsc483,代码行数:53,代码来源:simplecontainer.cs
示例14: CreateInstance
/// <summary>
/// creates a new GDataBatchEntryData
/// </summary>
/// <param name="node"></param>
/// <param name="parser"></param>
/// <returns></returns>
public IExtensionElementFactory CreateInstance(XmlNode node, AtomFeedParser parser) {
//we really don't know how to create an instance of ourself.
throw new Exception("The method or operation is not implemented.");
}
开发者ID:Zelxin,项目名称:RPiKeg,代码行数:10,代码来源:gdatabatch.cs
示例15: HandleExtensionElements
/// <summary>
/// Is called after we already handled the custom entry, to handle all
/// other potential parsing tasks
/// </summary>
/// <param name="e"></param>
/// <param name="parser">the atom feed parser used</param>
protected override void HandleExtensionElements(ExtensionElementEventArgs e,
AtomFeedParser parser) {
base.HandleExtensionElements(e, parser);
}
开发者ID:saeedesmaeili,项目名称:google-gdata,代码行数:10,代码来源:accountfeed.cs
示例16: ProcessChildNodes
/// <summary>
/// used to copy the unknown childnodes for later saving
/// </summary>
public virtual void ProcessChildNodes(XmlNode node, AtomFeedParser parser) {
if (node != null && node.HasChildNodes) {
XmlNode childNode = node.FirstChild;
while (childNode != null) {
if (childNode.NodeType == XmlNodeType.Element) {
this.ChildNodes.Add(childNode);
}
childNode = childNode.NextSibling;
}
}
}
开发者ID:Zelxin,项目名称:RPiKeg,代码行数:14,代码来源:extensionbase.cs
示例17: HandleExtensionElements
/// <summary>
/// get's called after we already handled the custom entry, to handle all
/// other potential parsing tasks
/// </summary>
/// <param name="e">the event arguments</param>
/// <param name="parser">the atom feed parser calling</param>
protected override void HandleExtensionElements(ExtensionElementEventArgs e, AtomFeedParser parser)
{
Tracing.TraceMsg("\t HandleExtensionElements for ListFeedcalled");
}
开发者ID:nagyist,项目名称:GoogleAnalytics-MonoMac-Demo,代码行数:10,代码来源:listfeed.cs
示例18: CreateInstance
/// <summary>Parses an xml node to create an instance object.</summary>
/// <param name="node">the parsed xml node, can be NULL</param>
/// <param name="parser">the xml parser to use if we need to dive deeper</param>
/// <returns>the created SimpleElement object</returns>
public override IExtensionElementFactory CreateInstance(XmlNode node, AtomFeedParser parser) {
Tracing.TraceCall();
SimpleElement e = null;
if (node != null) {
object localname = node.LocalName;
if (!localname.Equals(this.XmlName) ||
!node.NamespaceURI.Equals(this.XmlNameSpace)) {
return null;
}
}
// memberwise close is fine here, as everything is identical besides the value
e = this.MemberwiseClone() as SimpleElement;
e.InitInstance(this);
if (node != null) {
e.ProcessAttributes(node);
if (node.HasChildNodes) {
XmlNode n = node.ChildNodes[0];
if (n.NodeType == XmlNodeType.Text && node.ChildNodes.Count == 1) {
e.Value = node.InnerText;
} else {
e.ProcessChildNodes(node, parser);
}
}
}
return e;
}
开发者ID:saeedesmaeili,项目名称:google-gdata,代码行数:35,代码来源:simpleelement.cs
示例19: CreateInstance
public IExtensionElementFactory CreateInstance(XmlNode node, AtomFeedParser parser)
{
return ParseGBaseAttribute(node);
}
开发者ID:nagyist,项目名称:GoogleAnalytics-MonoMac-Demo,代码行数:4,代码来源:gbaseattribute.cs
示例20: CreateInstance
//////////////////////////////////////////////////////////////////////
/// <summary>Parses an xml node to create a Who object.</summary>
/// <param name="node">the xml parses node, can be NULL</param>
/// <param name="parser">the xml parser to use if we need to dive deeper</param>
/// <returns>the created IExtensionElement object</returns>
//////////////////////////////////////////////////////////////////////
public override IExtensionElement CreateInstance(XmlNode node, AtomFeedParser parser)
{
IExtensionElement ele = base.CreateInstance(node, parser);
OriginalEvent ev = ele as OriginalEvent;
if (ev != null)
{
if (ev.IdOriginal == null)
{
throw new ArgumentException("g:originalEvent/@id is required.");
}
if (ev.OriginalStartTime == null)
{
throw new ArgumentException("g:when inside g:originalEvent is required.");
}
}
return ev;
}
开发者ID:mintwans,项目名称:cpsc483,代码行数:26,代码来源:originalevent.cs
注:本文中的Google.GData.Client.AtomFeedParser类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论