diff options
Diffstat (limited to '')
-rw-r--r-- | sca-cpp/trunk/modules/js/htdocs/atomutil.js | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/sca-cpp/trunk/modules/js/htdocs/atomutil.js b/sca-cpp/trunk/modules/js/htdocs/atomutil.js index 6b998dceda..24a47980f7 100644 --- a/sca-cpp/trunk/modules/js/htdocs/atomutil.js +++ b/sca-cpp/trunk/modules/js/htdocs/atomutil.js @@ -44,16 +44,32 @@ atom.entriesElementsToValues = function(e) { }; /** - * Convert a list of strings to a list of values representing an ATOM entry. + * Return true if a list of strings represents an ATOM entry. */ -atom.readATOMEntry = function(l) { - var e = readXML(l); +atom.isATOMEntry = function(l) { + if (!isXML(l)) + return false; + return car(l).match('<entry') != null && car(l).match('<feed') == null && car(l).match('="http://www.w3.org/2005/Atom"') != null; +}; + +/** + * Convert a DOM Document to a list of values representing an ATOM entry. + */ +atom.readATOMEntryDocument = function(doc) { + var e = readXMLDocument(doc); if (isNil(e)) return mklist(); return atom.entryElementsToValues(car(e)); }; /** + * Convert a list of strings to a list of values representing an ATOM entry. + */ +atom.readATOMEntry = function(l) { + return atom.readATOMEntryDocument(parseXML(l)); +}; + +/** * Convert a list of values representy an ATOM entry to a value. */ atom.entryValue = function(e) { |