/src/com/google/maps/extras/xmlparsers/atom/Link.as

http://gmaps-utility-library-flash.googlecode.com/ · ActionScript · 140 lines · 52 code · 15 blank · 73 comment · 0 complexity · fc13fcbd043fb606693c64a80f451d55 MD5 · raw file

  1. /*
  2. Copyright (c) 2008, Adobe Systems Incorporated
  3. All rights reserved.
  4. Redistribution and use in source and binary forms, with or without
  5. modification, are permitted provided that the following conditions are
  6. met:
  7. * Redistributions of source code must retain the above copyright notice,
  8. this list of conditions and the following disclaimer.
  9. * Redistributions in binary form must reproduce the above copyright
  10. notice, this list of conditions and the following disclaimer in the
  11. documentation and/or other materials provided with the distribution.
  12. * Neither the name of Adobe Systems Incorporated nor the names of its
  13. contributors may be used to endorse or promote products derived from
  14. this software without specific prior written permission.
  15. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
  16. IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
  17. THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  18. PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
  19. CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  20. EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  21. PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  22. PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
  23. LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  24. NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  25. SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  26. */
  27. package com.google.maps.extras.xmlparsers.atom
  28. {
  29. import com.google.maps.extras.xmlparsers.XmlElement;
  30. import com.google.maps.extras.xmlparsers.XmlParser;
  31. import com.google.maps.extras.xmlparsers.ParsingTools;
  32. import com.google.maps.extras.xmlparsers.Namespaces;
  33. /**
  34. * Class that represents a Link element within an Atom feed.
  35. *
  36. * @langversion ActionScript 3.0
  37. * @playerversion Flash 8.5
  38. * @tiptext
  39. *
  40. * @see http://www.atomenabled.org/developers/syndication/atom-format-spec.php#rfc.section.4.2.7
  41. */
  42. public class Link extends XmlElement
  43. {
  44. private var atom:Namespace = Namespaces.ATOM_NS;
  45. /**
  46. * Constant for the "alternate" value of the rel property.
  47. *
  48. * @langversion ActionScript 3.0
  49. * @playerversion Flash 8.5
  50. * @tiptext
  51. */
  52. public static const REL_ALTERNATE:String = "alternate";
  53. /**
  54. * Constant for the "related" value of the rel property.
  55. *
  56. * @langversion ActionScript 3.0
  57. * @playerversion Flash 8.5
  58. * @tiptext
  59. */
  60. public static const REL_RELATED:String = "related";
  61. /**
  62. * Constant for the "self" value of the rel property.
  63. *
  64. * @langversion ActionScript 3.0
  65. * @playerversion Flash 8.5
  66. * @tiptext
  67. */
  68. public static const REL_SELF:String = "self";
  69. /**
  70. * Constant for the "enclosure" value of the rel property.
  71. *
  72. * @langversion ActionScript 3.0
  73. * @playerversion Flash 8.5
  74. * @tiptext
  75. */
  76. public static const REL_ENCLOSURE:String = "enclosure";
  77. /**
  78. * Constant for the "via" value of the rel property.
  79. *
  80. * @langversion ActionScript 3.0
  81. * @playerversion Flash 8.5
  82. * @tiptext
  83. */
  84. public static const REL_VIA:String = "via";
  85. private var _rel:String;
  86. private var _type:String;
  87. private var _hreflang:String;
  88. private var _href:String;
  89. private var _title:String;
  90. private var _length:Number;
  91. public function Link(x:XMLList)
  92. {
  93. super(x);
  94. this._rel = ParsingTools.nullCheck(this.x.atom::link.@rel);
  95. this._type = ParsingTools.nullCheck(this.x.atom::link.@type);
  96. this._hreflang = ParsingTools.nullCheck(this.x.atom::link.@hreflang);
  97. this._href = ParsingTools.nullCheck(this.x.atom::link.@href);
  98. this._title = ParsingTools.nullCheck(this.x.atom::link.@title);
  99. this._length = ParsingTools.nanCheck(this.x.atom::link.@["length"]);
  100. }
  101. public function get rel():String
  102. {
  103. return this._rel;
  104. }
  105. public function get type():String
  106. {
  107. return this._type;
  108. }
  109. public function get hreflang():String
  110. {
  111. return this._hreflang;
  112. }
  113. public function get title():String
  114. {
  115. return this._title;
  116. }
  117. public function get length():Number
  118. {
  119. return this._length;
  120. }
  121. }
  122. }