Chilkat C# Atom Class Reference

Atom

Represents an Atom document. The Atom API allows one to download, create and modify Atom documents.

Properties

public bool EnableEvents {get; set; }

To be documented soon...

public string LastErrorHtml {get; }

Error information in HTML format for the last method called.

public string LastErrorText {get; }

Error information in plain-text format for the last method called.

public string LastErrorXml {get; }

Error information in XML format for the last method called.

public int NumEntries {get; }

Number of entries in the Atom document.

Methods

public int AddElement(string tag, string value);

Adds a new element to the Atom document. The tag is a string such as "title", "subtitle", "summary", etc.

public int AddElementDate(string tag, DateTime dateTime);

Adds a new date-formatted element to the Atom document. The tag is a string such as "created", "modified", "issued", etc.

public int AddElementHtml(string tag, string htmlStr);

Adds a new HTML formatted element to the Atom document.

public int AddElementXHtml(string tag, string xmlStr);

Adds a new XHTML formatted element to the Atom document.

public int AddElementXml(string tag, string xmlStr);

Adds a new XML formatted element to the Atom document.

public void AddEntry(string xmlStr);

Adds an "entry" Atom XML document to the caller's Atom document.

public void AddLink(string rel, string href, string title, string typ);

Adds a link to the Atom document.

public void AddPerson(string tag, string name, string uri, string email);

Adds a person to the Atom document. The tag should be a string such as "author", "contributor", etc. If a piece of information is not known, an empty string or NULL value may be passed.

public void DeleteElement(string tag, int index);

Removes the Nth occurance of a given element from the Atom document. Indexing begins at 0. For example, to remove the 2nd category, set tag = "category" and index = 1.

public void DeleteElementAttr(string tag, int index, string attrName);

Remove an attribute from an element.The index should be 0 unless there are multiple elements having the same tag, in which case it selects the Nth occurrence based on the index ( 0 = first occurrence ).

public void DeletePerson(string tag, int index);

Deletes a person from the Atom document. The tag is a string such as "author". The index should be 0 unless there are multiple elements having the same tag, in which case it selects the Nth occurrence based on the index. For example, DeletePerson("author",2) deletes the 3rd author.

public bool DownloadAtom(string url);

Download an Atom feed from the Internet and load it into the Atom object.

Returns true for success, false for failure.

public string GetElement(string tag, int index);

Returns the content of the Nth element having a specified tag.

Returns a null on failure

public string GetElementAttr(string tag, int index, string attrName);

Returns the value of an element's attribute. The element is selected by the tag name and the index (the Nth element having a specific tag) and the attribute is selected by name.

Returns a null on failure

public int GetElementCount(string tag);

The number of elements having a specific tag.

public DateTime GetElementDate(string tag, int index);

Returns an element's value as a Date.

public Atom GetEntry(int index);

Returns the Nth entry as an Atom object. (Indexing begins at 0)

public string GetLinkHref(string relName);

Returns the href attribute of the link having a specified "rel" attribute (such as "service.feed", "alternate", etc.).

Returns a null on failure

public string GetPersonInfo(string tag, int index, string tag2);

Returns a piece of information about a person. To get the 2nd author's name, call GetPersonInfo("author",1,"name").

Returns a null on failure

public string GetTopAttr(string attrName);

Returns the value of an attribute on the top-level XML node. The tag of a top-level Atom XML node is typically "feed" or "entry", and it might have attributes such as "xmlns" and "xml:lang".

Returns a null on failure

public bool HasElement(string tag);

True (1) if the element exists in the Atom document. Otherwise 0.

public bool LoadXml(string xmlStr);

Loads the Atom document from an XML string.

public void NewEntry();

Initializes the Atom document to be a new "entry".

public void NewFeed();

Initializes the Atom document to be a new "feed".

public bool SaveLastError(string filename);

Saves the last error information to an XML formatted file.

public void SetElementAttr(string tag, int index, string attrName, string attrValue);

Adds or replaces an attribute on an element.

public void SetTopAttr(string attrName, string value);

Adds or replaces an attribute on the top-level XML node of the Atom document.

public string ToXmlString();

Serializes the Atom document to an XML string.

Returns a null on failure

public void UpdateElement(string tag, int index, string value);

Replaces the content of an element.

public void UpdateElementDate(string tag, int index, DateTime dateTime);

Replaces the content of a date-formatted element.

public void UpdateElementHtml(string tag, int index, string htmlStr);

Replaces the content of an HTML element.

public void UpdateElementXHtml(string tag, int index, string xmlStr);

Replaces the content of an XHTML element.

public void UpdateElementXml(string tag, int index, string xmlStr);

Replaces the content of an XML element.

public void UpdatePerson(string tag, int index, string name, string uri, string email);

Replaces the content of a person. To update the 3rd author, call UpdatePerson("author",2,"new name","new URL","new email"). If a piece of information is not known, pass an empty string or a NULL.