<https://suika.suikawiki.org/www/markup/xml/atomdom><https://suika.suikawiki.org/gate/git/wi/markup/xmlexts.git/history/HEAD:/atomdom-source.en.html><wakaba@suikawiki.org>
To the
extent possible under law, the editor has waived all copyright and
related or neighboring rights to this work. In addition, as of
18 September 2022, the editor has made this specification available under the Open
Web Foundation Agreement Version 1.0.
This section describes the status of this document at the time of its publication. Other documents might supersede this document.
This document is a technical specification produced as part of the manakai project. It might be updated, replaced, or obsoleted by other documents at any time.
The scope of this specification is explicitly limited within the manakai project. It does not intended to be supported by multiple parties, although nothing prevents it from implemented by other DOM implementations.
Comments on this document are welcome and may be sent to the author.
Translations of thie document might be available. The English version of the document is the only normative version.
AtomElement interfaceAtomTextConstruct interfaceAtomPersonConstruct interfaceAtomDateConstruct interfaceAtomFeedElement interfaceAtomEntryElement interfaceAtomSourceElement interfaceAtomContentElement interfaceAtomCategoryElement interfaceAtomGeneratorElement interfaceAtomLinkElement interfaceThe Atom DOM is a language and platform independent programming language interface to Atom documents built on top of language-neutral DOM APIs [DOM]. It defines a number of interfaces that provide convenience methods and attributes to process Atom documents [ATOM].
The Atom DOM interfaces are defined for the manakai DOM implementation in April 2006. It extends the standard DOM interface by adding convinience methods and attributes to construct or interpret Atom 1.0 documents [ATOM]. Additional interfaces are defined in October 2006 to support Atom Threading extension [ATOMTHREADING]. Interface specificaiton at those days were embedded in the source file of manakai's DOM implementation. The interfaces were defined in terms of DOM3.
The interfaces are extended several times. Some of additions and work items were recorded in SuikaWiki.
In April 2013, these documents are replaced by this specification. Unlike the earlier versions, it defines the interfaces in terms of WebIDL [WEBIDL] and DOM Standard [DOM]. Changes from the earlier versions are listed in the last section of the specification. Changes to this specification are recorded as the Git repository.
Future revision of this specification might include support for following technologies:
The keywords "MUST" and "MAY" in the normative parts of this document are to be interpreted as described in RFC 2119 [RFC2119].
Requirements phrased in the imperative as part of algorithms (such as "strip any leading space characters" or "return false and abort these steps") are to be interpreted with the meaning of the key word ("MUST", "MAY", etc) used in introducing the algorithm.
Conformance requirements phrased as algorithms or specific steps MAY be implemented in any manner, so long as the end result is equivalent. (In particular, the algorithms defined in this specification are intended to be easy to follow, and not intended to be performant.)
User agents MAY impose implementation-specific limits on otherwise unconstrained inputs, e.g. to prevent denial of service attacks, to guard against running out of memory, or to work around platform-specific limitations.
The terms context object, parent, child, tree order, append, pre-insert, node document, textContent,
Document, document, content type, document
element, Element, element, local name, namespace, element interface, id, attribute, content attribute,
value, set an attribute,
Text, data,
collection,
HTMLCollection, live, static, XML
namespace, HTML namespace,
DOMImplementation, and createDocument
are defined by the DOM Standard [DOM].
The term URL is defined by the URL Standard [URL].
The terms IDL attribute, reflect, resolve a URL, valid non-negative integer, rules for parsing non-negative integers, and a valid global date and time string are defined by the HTML Standard [HTML].
The Atom namespace is
http://www.w3.org/2005/Atom [ATOM].
The Atom Threading namespace is
http://purl.org/syndication/thread/1.0 [ATOMTHREADING].
The SVGElement interface is defined in the
SVG specification [SVG].
The manakai-create-child-element
configuration parameter is defined in the manakai DOM
Extensions specification [MANAKAI]. If the implementation does
not support the configuration parameter, it MUST behave as if the configuration
parameter is set to its default value.
The IDL fragments in this specification MUST be interpreted as described in the WebIDL specification [WEBIDL].
When the user agent is to convert an Atom
date-time string to a number, it MUST run the following steps:
date-time which does not represent a
leap second, return the number which is equal to the
time value of the JavaScript Date object which
represents the same instance as the string.
Unlike a valid global date and time string, the
string can represent a date in year 0000 and the time
zone hour component can be greater than 23.
Unfortunately, there is no specification for this...
When the user agent is to convert a number to an Atom
date-time string, it MUST
return a valid global date and time string representing
the same instance as the JavaScript Date object whose
time value is equal to the number. The string MUST be in UTC, with the time-zone offset string
Z. If the number cannot be represented by
such a string, the result MAY be an
implementation-dependent string.
To set the xml:lang attribute of an element element to value
value, the set
an attribute steps MUST be invoked using
element, value, local
name lang, prefix
xml, and namespace the XML
namespace.
To append an Atom element local name with text content to parent, the following steps MUST be run:
Text node whose
data is text
content.
To obtain the child element of element with local name and optionally namespace, the following steps MUST be run:
manakai-create-child-element
configuration parameter of the node document of element is set to true:
feed
element in the Atom
namespace and it has an entry child element, let entry be
first such an element in tree
order.
null.
XXX Attributes which obtain the child element should be defined as methods? No other IDL attribute in the platform mutates underlying DOM...
The child element list of type local
name for element element with optional namespace is an
HTMLCollection rooted at the element,
whose filter matches only child
elements of element with local
name local name and namespace namespace, if specified, or the Atom
namespace.
As specified in the DOM Standard, HTMLCollection
objects are live by
default. Attributes returning HTMLCollection always
return the same object.
If an attribute reflects the string value of the child element local name, optionally with namespace, on getting, the attribute MUST run the following steps:
textContent
attribute value of the first such element in tree order.
If an attribute reflects the URL value of the child element local name, optionally with namespace, on getting, the attribute MUST run the following steps:
textContent attribute value of
child, relative to child. If it
results in an error, return the empty string. Otherwise, return the
result.
If an attribute reflects the string or URL value of the child element, on setting, the attribute MUST run the following steps:
textContent
attribute of the first such element
in tree order is set to the
given value and abort these steps.
Text whose
data is the given value to child.
Document constructor methods are added to the
DOMImplementation object as follows:
partial interface DOMImplementation {
Document createAtomFeedDocument(DOMString id, [TreatNullAs=EmptyString] DOMString title, [TreatNullAs=EmptyString] DOMString lang);
Document createAtomEntryDocument(DOMString id, [TreatNullAs=EmptyString] DOMString title, [TreatNullAs=EmptyString] DOMString lang);
};
The createAtomFeedDocument(id, title, lang) method MUST run
the following steps:
application/atom+xml.
feed element in the Atom
namespace.
xml:lang attribute of feed to lang.
id element whose text content is
id to feed.
title element whose text content
is title to feed.
updated element whose text
content is the current time, converted to a string, to feed.
The createAtomEntryDocument(id, title, lang) method MUST run
the following steps:
application/atom+xml.
entry element in the Atom
namespace.
xml:lang attribute of entry to lang.
id element whose text content is
id to entry.
title element whose text content
is title to entry.
updated element whose text
content is the current time, converted to a string, to entry.
partial interface Document {
readonly attribute AtomFeedElement? atomFeedElement;
};
The atomFeedElement
attribute of the Document interface MUST run the following steps:
null and abort
these steps.
feed
element in the Atom
namespace, return the element.
null.
AtomElement interfaceThe element interface
for elements in the Atom
namespace or the Atom Threading namespace is
AtomElement, unless stated otherwise.
interface AtomElement : Element {
attribute DOMString xmlbase;
attribute DOMString xmllang;
};
The xmlbase
attribute of the AtomElement interface MUST behave in the same way as the xmlbase
attribute of the SVGElement interface.
The xmllang
attribute of the AtomElement interface MUST behave in the same way as the xmllang
attribute of the SVGElement interface.
The element interface
for the id element in
the Atom namespace is AtomIdElement.
The element interface
for the icon element
in the Atom namespace is AtomIconElement.
The element interface
for the name element
in the Atom namespace is AtomNameElement.
The element interface
for the uri element in
the Atom namespace is AtomUriElement.
The element interface
for the email element
in the Atom namespace is AtomEmailElement.
The element interface
for the logo element
in the Atom namespace is AtomLogoElement.
interface AtomIdElement : AtomElement {};
interface AtomIconElement : AtomElement {};
interface AtomNameElement : AtomElement {};
interface AtomUriElement : AtomElement {};
interface AtomEmailElement : AtomElement {};
interface AtomLogoElement : AtomElement {};
AtomTextConstruct interface[NoInterfaceObject]
interface AtomTextConstruct : AtomElement {
attribute DOMString type;
readonly attribute Element? container;
};
The type
attribute of the AtomTextConstruct MUST reflect the content
attribute of the same name. The default value for the
attribute is text.
The container
attribute MUST run the following steps:
type content
attribute of the context object, if any, is
xhtml, return the
div child element of element, in
the HTML namespace.
The element interface
for the rights element
in the Atom namespace is AtomRightsElement.
The element interface
for the subtitle element in the Atom
namespace is AtomSubtitleElement.
The element interface
for the summary element in the Atom
namespace is AtomSummaryElement.
The element interface
for the title element
in the Atom namespace is AtomTitleElement.
interface AtomRightsElement : AtomTextConstruct {};
interface AtomSubtitleElement : AtomTextConstruct {};
interface AtomSummaryElement : AtomTextConstruct {};
interface AtomTitleElement : AtomTextConstruct {};
AtomPersonConstruct interface[NoInterfaceObject]
interface AtomPersonConstruct : AtomElement {
attribute DOMString name;
readonly attribute AtomNameElement? nameElement;
attribute DOMString uri;
attribute DOMString email;
};
The name
attribute MUST reflect the string value of the
name child element.
The nameElement
attribute MUST return the name child element.
The uri
attribute MUST reflect the URL value of the
uri child element.
The email attribute
MUST reflect the string value of the name child
element.
The element interface
for the author element
in the Atom namespace is AtomAuthorElement.
The element interface
for the contributor element in the Atom
namespace is AtomContributorElement.
interface AtomAuthorElement : AtomPersonConstruct {};
interface AtomContributorElement : AtomPersonConstruct {};
AtomDateConstruct interface[NoInterfaceObject]
interface AtomDateConstruct : AtomElement {
attribute DOMTimeStamp value;
};
On getting, the value attribute
of the AtomDateConstruct interface MUST convert the textContent of the context
object and return the result.
On setting, the value attribute of the
AtomDateConstruct interface MUST
act as if the textContent
attribute is set to the given value, converted to a string.
The element interface
for the published element in the Atom
namespace is AtomPublishedElement.
The element interface
for the updated element in the Atom
namespace is AtomUpdatedElement.
interface AtomPublishedElement : AtomDateConstruct {};
interface AtomUpdatedElement : AtomDateConstruct {};
AtomFeedElement interfaceThe element interface
for the feed element
in the Atom namespace is AtomFeedElement.
interface AtomFeedElement : AtomElement {
readonly attribute HTMLCollection authorElements;
readonly attribute HTMLCollection categoryElements;
readonly attribute HTMLCollection contributorElements;
readonly attribute AtomGeneratorElement? generatorElement;
attribute DOMString icon;
attribute DOMString atomId;
readonly attribute HTMLCollection linkElements;
attribute DOMString logo;
readonly attribute AtomRightsElement? rightsElement;
readonly attribute AtomSubtitleElement? subtitleElement;
readonly attribute AtomTitleElement? titleElement;
readonly attribute AtomUpdatedElement? updatedElement;
readonly attribute HTMLCollection entryElements;
AtomEntryElement? getEntryElementById(DOMString id);
AtomEntryElement addNewEntry(DOMString id, [TreatNullAs=EmptyString] DOMString title, [TreatNullAs=EmptyString] DOMString lang);
};
The authorElements
attribute of the AtomFeedElement interface MUST return the author child
element list for the context object.
The categoryElements
attribute of the AtomFeedElement interface MUST return the category child
element list for the context object.
The contributorElements
attribute of the AtomFeedElement interface MUST return the contributor
child element list for the context object.
The generatorElement
attribute MUST return the generator child element.
The icon
attribute MUST reflect the URL value of the
icon child element.
The atomId
attribute MUST reflect the string value of the
id child element.
The linkElements
attribute of the AtomFeedElement interface MUST return the link child
element list for the context object.
The logo
attribute MUST reflect the URL value of the
logo child element.
The rightsElement
attribute MUST return the subtitle child element.
The subtitleElement
attribute MUST return the subtitle child element.
The titleElement
attribute MUST return the title child element.
The updatedElement
attribute MUST return the updated child element.
The entryElements
attribute of the AtomFeedElement interface MUST return the entry child
element list for the context object.
The getEntryElementById(id) attribute MUST
return the first element in the
entryElements
collection whose atomId attribute value is
id and is not the empty string, if any, or
null otherwise.
The addNewEntry(id, title, lang) method MUST run
the following steps:
entry element in the Atom
namespace.
xml:lang attribute of entry to lang.
id element whose text content is
id to entry.
title element whose text content
is title to entry.
updated element whose text
content is the current time, converted to a string, to entry.
AtomEntryElement interfaceThe element interface
for the entry element
in the Atom namespace is AtomEntryElement.
interface AtomEntryElement : AtomElement {
readonly attribute HTMLCollection authorElements;
readonly attribute HTMLCollection entryAuthorElements;
readonly attribute HTMLCollection categoryElements;
readonly attribute AtomContentElement? contentElement;
readonly attribute HTMLCollection contributorElements;
attribute DOMString atomId;
readonly attribute HTMLCollection linkElements;
readonly attribute AtomPublishedElement? publishedElement;
readonly attribute AtomRightsElement? rightsElement;
readonly attribute AtomRightsElement? entryRightsElement;
readonly attribute AtomSourceElement? sourceElement;
readonly attribute AtomSummaryElement? summaryElement;
readonly attribute AtomTitleElement? titleElement;
readonly attribute AtomUpdatedElement? updatedElement;
readonly attribute HTMLCollection threadInReplyToElements;
};
The authorElements
attribute of the AtomEntryElement interface MUST return the author child
element list for the context object.
The entryAuthorElements
attribute of the AtomEntryElement interface MUST run the following steps:
author child
element in the Atom
namespace, return the authorElements
collection of the
context object and abort these steps.
source child
element in the Atom
namespace, return the authorElements
collection of the first such
element and abort these steps
unless that collection is
empty.
feed element in the Atom
namespace, return the authorElements collection of the element and abort these steps.
authorElements
collection of the
context object.
The categoryElements
attribute of the AtomEntryElement interface MUST return the category child
element list for the context object.
The contentElement
attribute MUST return the content child element.
The contributorElements
attribute of the AtomEntryElement interface MUST return the contributor
child element list for the context object.
The atomId attribute
MUST reflect the string value of the id child
element.
The linkElements
attribute of the AtomEntryElement interface MUST return the link child
element list for the context object.
The publishedElement
attribute MUST return the published child element.
The rightsElement
attribute MUST return the rights child element.
The entryRightsElement
attribute of the AtomEntryElement interface MUST run the following steps:
rights child
element in the Atom
namespace, return the first such element and abort these steps.
feed element in the Atom
namespace, return the rightsElement
attribute value of that element
and abort these steps unless it is null.
rightsElement
attribute value of the context object.
The sourceElement
attribute MUST return the source child element.
The summaryElement
attribute MUST return the summary child element.
The titleElement
attribute MUST return the title child element.
The updatedElement
attribute MUST return the updated child element.
The threadInReplyToElements
attribute of the AtomEntryElement interface MUST return the in-reply-to
child element list for the context object in
the Atom Threading namespace.
AtomSourceElement interfaceThe element interface
for the source element
in the Atom namespace is AtomSourceElement.
interface AtomSourceElement : AtomElement {
readonly attribute HTMLCollection authorElements;
readonly attribute HTMLCollection categoryElements;
readonly attribute HTMLCollection contributorElements;
readonly attribute AtomGeneratorElement? generatorElement;
attribute DOMString icon;
attribute DOMString atomId;
readonly attribute HTMLCollection linkElements;
attribute DOMString logo;
readonly attribute AtomRightsElement? rightsElement;
readonly attribute AtomSubtitleElement? subtitleElement;
readonly attribute AtomTitleElement? titleElement;
readonly attribute AtomUpdatedElement? updatedElement;
};
The authorElements
attribute of the AtomSourceElement interface MUST return the author child
element list for the context object.
The categoryElements
attribute of the AtomSourceElement interface MUST return the category child
element list for the context object.
The contributorElements
attribute of the AtomSourceElement interface MUST return the contributor
child element list for the context object.
The generatorElement
attribute MUST return the generator child element.
The icon
attribute MUST reflect the URL value of the
icon child element.
The atomId attribute
MUST reflect the string value of the id child
element.
The linkElements
attribute of the AtomSourceElement interface MUST return the link child
element list for the context object.
The logo
attribute MUST reflect the URL value of the
logo child element.
The rightsElement
attribute MUST return the rights child element.
The subtitleElement
attribute MUST return the subtitle child element.
The titleElement
attribute MUST return the title child element.
The updatedElement
attribute MUST return the updated child element.
AtomContentElement interfaceThe element interface
for the content element in the Atom
namespace is AtomContentElement.
interface AtomContentElement : AtomElement {
attribute DOMString type;
attribute DOMString src;
readonly attribute Element? container;
};
The type
attribute of the AtomContentElement interface MUST reflect the content
attribute of the same name. The default value for the
attribute is text if the context object does
not have the src content
attribute, or no default value otherwise.
The src
attribute of the AtomContentElement interface MUST reflect the content
attribute of the same name, which for the purposees of
reflection is defined as containing a URL.
The container
attribute of the AtomContentElement interface MUST run the following steps:
type content
attribute of the context object, if any, is
xhtml, return the
div child element of element, in
the HTML namespace.
src content attribute presents, return
null.
XXX Accessor for Base64ed content...
AtomCategoryElement interfaceThe element interface
for the category element in the Atom
namespace is AtomCategoryElement.
interface AtomCategoryElement : AtomElement {
attribute DOMString term;
attribute DOMString scheme;
attribute DOMString label;
};
The term
and label
attributes of the AtomCategoryElement interface MUST reflect the content
attribute of the same name.
The scheme
attribute of the AtomCategoryElement interface MUST reflect the content
attribute of the same name, which for the purposees of
reflection is defined as containing a URL.
AtomGeneratorElement interfaceThe element interface
for the generator element in the Atom
namespace is AtomGeneratorElement.
interface AtomGeneratorElement : AtomElement {
attribute DOMString uri;
attribute DOMString version;
};
The uri
attribute of the AtomGeneratorElement interface MUST reflect the content
attribute of the same name, which for the purposees of
reflection is defined as containing a URL.
The version
attribute of the AtomGeneratorElement interface MUST reflect the content
attribute of the same name.
AtomLinkElement interfaceThe element interface
for the link element
in the Atom namespace is AtomLinkElement.
interface AtomLinkElement : AtomElement {
attribute DOMString href;
attribute DOMString hreflang;
attribute DOMString length;
attribute DOMString rel;
attribute DOMString title;
attribute DOMString type;
attribute unsigned long threadCount;
attribute DOMTimeStamp threadUpdated;
};
The href
attribute of the AtomLinkElement interface MUST reflect the content
attribute of the same name, which for the purposees of
reflection is defined as containing a URL.
On getting, the rel attribute MUST run the following steps:
rel content
attribute, return the empty string and abort these steps.
rel attribute value of the context
object.
U+003A COLON character (:), return value and abort these steps.
http://www.iana.org/assignments/relation/ followed by
value.
On setting, the rel
attribute MUST run the following steps:
http://www.iana.org/assignments/relation/ followed by
sequence of one or more characters other than U+003A
COLON character (:),
U+0023 NUMBER SIGN
character (#), U+002F SOLIDUS character (/), and
U+003F QUESTION MARK
character (?), remove the
http://www.iana.org/assignments/relation/ prefix from
value.
rel attribute of the context object
to value.
The type
attribute of the AtomLinkElement interface MUST reflect the content
attribute of the same name. The default value for the
type attribute is application/atom+xml if
the rel attribute value of
the context object is
http://www.iana.org/assignments/relation/replies, or no
default value otherwise.
The hreflang, title, and length attributes
of the AtomLinkElement interface MUST reflect the content
attribute of the same name.
The threadCount
attributes of the AtomLinkElement interface MUST reflect the count
attribute in the Atom Threading namespace. When a new
attribute is set by the attribute, the namespace prefix MUST be thr.
On getting, the threadUpdated
attribute of the AtomLinkElement interface MUST convert the value of the updated
attribute in the Atom
Threading namespace and return the result. If the attribute is not present, it MUST return zero instead.
On setting, the threadUpdated attribute
of the AtomLinkElement interface MUST set
the updated attribute in the Atom Threading
namespace to the given value, converted to a string. If a new
content attribute is created, the prefix of the attribute MUST be set
to thr.
AtomThreadInReplyToElement interfaceThe element interface
for the in-reply-to element in the Atom Threading
namespace is AtomThreadInReplyToElement.
interface AtomThreadInReplyToElement : AtomElement {
attribute DOMString href;
attribute DOMString ref;
attribute DOMString source;
attribute DOMString type;
};
The href,
ref,
and source
attributes of the AtomThreadInReplyToElement interface
MUST reflect the content
attribute of the same name, which for the purposees of
reflection are defined as containing a URL.
The type
attribute of the AtomThreadInReplyToElement interface MUST reflect the content
attribute of the same name.
AtomThreadTotalElement interfaceThe element interface
for the total element
in the Atom Threading namespace is
AtomThreadTotalElement.
interface AtomThreadTotalElement : AtomElement {
attribute unsigned long value;
};
On getting, the value
attribute of the AtomThreadTotalElement interface MUST parse the textContent attribute value of the
context object according to the rules for parsing
non-negative integers, and if that is successful, and the value
is in the range 0 to 2147483647 inclusive, it MUST return the resulting value. If, on the other
hand, that fails or returns an out of range value, it MUST return 0 instead.
On setting, the value attribute of the
AtomThreadTotalElement interface MUST run the following steps:
textContent attribute of the
context object were set to the result of the previous
step.
Earlier versions of this specification defined following feature strings, which are now considered obsolete:
http://suika.fam.cx/www/2006/feature/Atom
version 1.0, identifying the core part of the Atom DOM.
http://suika.fam.cx/www/2006/feature/AtomThreading
version 1.0, identifying the Atom Threading Extension
support of the Atom DOM.
The AtomImplementation
interface is now defined as a partial interface for
DOMImplementation.
The AtomDocument
interface is now defined as a partial interface for
Document.
The AtomEntryElementThread and
AtomLinkElementThread interfaces are merged
with AtomEntryElement and AtomLinkElement
interfaces, respectively.
Earlier versions of this specification specified different handling
of null values for reflecting attributes. They are
removed for consistency with DOM and HTML.
Earlier versions of this specification specfied list of elements returned by various attributes as static, which is now changed to live for consistency with HTML DOM.
The id attribute of AtomFeedElement,
AtomEntryElement, and AtomSourceElement
interfaces is renamed as atomId to avoid
confliction with Element's id attribute defined by DOM.