# OpenLayers.Format.Atom

Read/write Atom feeds. Create a new instance with the <OpenLayers.Format.AtomFeed> constructor.

#### Inherits from

- OpenLayers.Format.XML

Summary

OpenLayers.Format.Atom | Read/write Atom feeds.
Properties |
namespaces | {Object} Mapping of namespace aliases to namespace URIs.
feedTitle | {String} Atom feed elements require a title.
defaultEntryTitle | {String} Atom entry elements require a title.
gmlParse | {Object} GML Format object for parsing features Non-API and only created if necessary
xy | {Boolean} Order of the GML coordinate: true:(x,y) or false:(y,x) For GeoRSS the default is (y,x), therefore: false
Constructor |
OpenLayers.Format.AtomEntry | Create a new parser for Atom.
Functions |
write | Serialize or more feature nodes to Atom documents.
buildContentNode |
buildEntryNode | Build an Atom entry node from a feature object.
initGmlParser | Creates a GML parser.
buildGeometryNode | builds a GeoRSS node with a given geometry
buildPersonConstructNode |
getFirstChildValue |
parseFeature | Parse feature from an Atom entry node..
parseFeatures | Return features from an Atom entry or feed.
parseLocations | Parse the locations from an Atom entry or feed.
parsePersonConstruct | Parse Atom person constructs from an Atom entry node.

### Properties

### namespaces

{Object} Mapping of namespace aliases to namespace URIs. Properties of this object should not be set individually. Read-only. All XML subclasses should have their own namespaces object. Use <setNamespace> to add or set a namespace alias after construction.

### feedTitle

{String} Atom feed elements require a title. Default is “untitled”.

### defaultEntryTitle

{String} Atom entry elements require a title. In cases where one is not provided in the feature attributes, this will be used. Default is “untitled”.

### gmlParse

{Object} GML Format object for parsing features Non-API and only created if necessary

### xy

{Boolean} Order of the GML coordinate: true:(x,y) or false:(y,x) For GeoRSS the default is (y,x), therefore: false

### Constructor

### OpenLayers.Format.AtomEntry

Create a new parser for Atom.

#### Parameters

options | {Object} An optional object whose properties will be set on this instance.

### Functions

### write

> write: function( | features | )

Serialize or more feature nodes to Atom documents.

#### Parameters

features | {OpenLayers.Feature.Vector} or Array({OpenLayers.Feature.Vector})

#### Returns

{String} an Atom entry document if passed one feature node, or a feed document if passed an array of feature nodes.

### buildContentNode

> buildContentNode: function( | content | )

#### Parameters

content | {Object}

#### Returns

{DOMElement} an Atom content node.

TODO: types other than text.

### buildEntryNode

> buildEntryNode: function( | feature | )

Build an Atom entry node from a feature object.

#### Parameters

feature | {OpenLayers.Feature.Vector}

#### Returns

{DOMElement} an Atom entry node.

These entries are geared for publication using AtomPub.

TODO: support extension elements

### initGmlParser

> initGmlParser: function()

Creates a GML parser.

### buildGeometryNode

> buildGeometryNode: function( | geometry | )

builds a GeoRSS node with a given geometry

#### Parameters

geometry | {OpenLayers.Geometry}

#### Returns

{DOMElement} A gml node.

### buildPersonConstructNode

> buildPersonConstructNode: function( | name,
> | value | )

#### Parameters

name | {String}
value | {Object}

#### Returns

{DOMElement} an Atom person construct node.

#### Example

>     >> buildPersonConstructNode("author", {name: "John Smith"})

{<author><name>John Smith</name></author>}

TODO: how to specify extension elements? Add to the oNames array?

### getFirstChildValue

> getFirstChildValue: function( | node,
> | nsuri,
> | name,
> | def | )

#### Parameters

node | {DOMElement}
nsuri | {String} Child node namespace uri (“*” for any).
name | {String} Child node name.
def | {String} Optional string default to return if no child found.

#### Returns

{String} The value of the first child with the given tag name. Returns default value or empty string if none found.

### parseFeature

> parseFeature: function( | node | )

Parse feature from an Atom entry node..

#### Parameters

node | {DOMElement} An Atom entry or feed node.

#### Returns

{OpenLayers.Feature.Vector}

### parseFeatures

> parseFeatures: function( | node | )

Return features from an Atom entry or feed.

#### Parameters

node | {DOMElement} An Atom entry or feed node.

#### Returns

Array({OpenLayers.Feature.Vector})

### parseLocations

> parseLocations: function( | node | )

Parse the locations from an Atom entry or feed.

#### Parameters

node | {DOMElement} An Atom entry or feed node.

#### Returns

Array({OpenLayers.Geometry})

### parsePersonConstruct

> parsePersonConstructs: function( | node,
> | name,
> | data | )

Parse Atom person constructs from an Atom entry node.

#### Parameters

node | {DOMElement} An Atom entry or feed node.
name | {String} Construcy name (“author” or “contributor”) data = {Object} Object in which to put parsed persons.

#### Returns

An {Object}.

> write: function( | features | )

Serialize or more feature nodes to Atom documents.

> buildContentNode: function( | content | )

> buildEntryNode: function( | feature | )

Build an Atom entry node from a feature object.

> initGmlParser: function()

Creates a GML parser.

> buildGeometryNode: function( | geometry | )

builds a GeoRSS node with a given geometry

> buildPersonConstructNode: function( | name,
> | value | )

> getFirstChildValue: function( | node,
> | nsuri,
> | name,
> | def | )

> parseFeature: function( | node | )

Parse feature from an Atom entry node..

> parseFeatures: function( | node | )

Return features from an Atom entry or feed.

> parseLocations: function( | node | )

Parse the locations from an Atom entry or feed.

> parsePersonConstructs: function( | node,
> | name,
> | data | )

Parse Atom person constructs from an Atom entry node.
Vector features use the OpenLayers.Geometry classes as geometry description.
A Geometry is a description of a geographic object.
Close