--- messaging/manakai/lib/Message/Markup/Atom.dis 2006/09/10 11:19:24 1.13 +++ messaging/manakai/lib/Message/Markup/Atom.dis 2006/10/03 09:37:36 1.14 @@ -43,7 +43,7 @@ @DISCore:author: DISCore|Wakaba @License: license|Perl+MPL @Date: - $Date: 2006/09/10 11:19:24 $ + $Date: 2006/10/03 09:37:36 $ @Require: @@Module: @@ -119,6 +119,8 @@ http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/Element/ @test: http://suika.fam.cx/~wakaba/archive/2004/dis/Test# + @thr: + http://purl.org/syndication/thread/1.0 @tx: http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/XML/ @urigen: @@ -270,8 +272,6 @@ @@@@: s|ElementType @@@ForCheck: s|ForML - @@f:implements: AtomFeature10 - ElementTypeBinding: @Name: IFClsDef @ElementType: @@ -300,8 +300,6 @@ @@@ContentType: DISCore|TFPQNames @@@ForCheck: ManakaiDOM|ForClass ManakaiDOM|ManakaiDOMLatest - @@f:implements: AtomFeature10 - ElementTypeBinding: @Name: IFClsConstructDef @ElementType: @@ -341,7 +339,6 @@ @@@@: mv|ElementContentModel @@@ForCheck: mv|ForCM - @@f:implements: AtomFeature10 ElementTypeBinding: @Name: IFQName @@ -568,6 +565,17 @@ @@enDesc: The Atom DOM, version 1.0. +FeatureDef: + @featureQName: fe|AtomThreading + @QName: AtomThreadingFeature + @FeatureVerDef: + @@QName: AtomThreadingFeature10 + @@Version: 1.0 + @@f:instanceOf: AtomThreadingFeature + @@f:requires: fe|AtomFeature10 + @@enDesc: + The Atom Threading Extension DOM, version 1.0. + ## -- Modules ModuleSetDef: @@ -708,6 +716,7 @@ methods to create Atom documents. @f:provides: AtomFeature10 + @f:implements: AtomFeature10 @Test: @@QName: AtomImplementation.interface.test @@ -1512,6 +1521,98 @@ attribute should be provided for published and created? } + + @CODE: + @@QName: getReflectAttrNonNegativeIntegerValue + @@enDesc: + {P:: If a DOM attribute is defined to attribute> + of the node , the getter of the attribute + return the value defined by the algorithm: + + {OLI:: If the contains an attribute node whose name + is : + + = If the of the is + one or more sequence of digits (, + , ..., ) optionally + preceding by a , then + the attribute getter return a value + by interpreting the of the + as a decimal number. + + } + + = If a default value is explicitly defined + where this algorithm is referenced, it + return the default value. + + = Otherwise, it return a binding-specific + default value, if it is defined by the specification + of the binding, or . + + } + + {NOTE:: + In Atom Threading Extension , + the and leading s + are prohibitted. + } + @@PerlDef: + __DEEP{ + E: { + $r = $node-> ($namespaceURI, $localName); + if (defined $r) { + if ($r =~ /\A\+?([0-9]+)\z/) { + $r = 0+$1; + last E; + } + } + + $r = $defaultValue; + $r = -1 unless defined $r; + } # E + }__; + + @CODE: + @@QName: setReflectAttrNonNegativeIntegerValue + @@enDesc: + {P:: If a DOM attribute is defined to attribute> of the node , + the setter of the attribute modify the node as + defined by the algorithm: + + = If the given value is or one of binding-specific + default values, if any, as defined by the specification + of the binding, it + remove the attribute node, if any, + from the list of attribute nodes of . + + = Otherwise, it set the + attribute node value to a string representation + of the given value as if + the method were invoked. + The string representation be a decimal + number consist of one or more sequence of digits + (, , ..., ) + any leading . + The be omitted. + + } + + {NOTE:: + It might throw an exception. + } + @@PerlDef: + __DEEP{ + if (defined $given and $given >= 0) { + $node-> + ($namespaceURI, $localName, 0+$given); + } else { + $node-> ($namespaceURI, $localName); + } + }__; ##AtomImplementation IFClsDef: @@ -1521,6 +1622,7 @@ @IFISA: Document @ClsISA: td|ManakaiDOMDocument + @f:implements: AtomFeature10 @s:rootElementType: AnyAtomElement||ManakaiDOM|all @enDesc: @@ -1552,6 +1654,7 @@ @IFISA: AtomDocument @ClsISA: ManakaiAtomDocument + @f:implements: AtomFeature10 @s:rootElementType: @@@: atom|feed @@DISCore:stopISARecursive: 1 @@ -1589,6 +1692,7 @@ @IFISA: AtomDocument @ClsISA: ManakaiAtomDocument + @f:implements: AtomFeature10 @s:rootElementType: @@@: atom|entry @@DISCore:stopISARecursive: 1 @@ -1730,6 +1834,7 @@ @IFISA: Element @ClsISA: te|ManakaiDOMElement + @f:implements: AtomFeature10 @s:elementType: AnyAtomElement||ManakaiDOM|all @enDesc: @@ -1799,6 +1904,7 @@ @IFISA: AtomElement @ClsISA: ManakaiAtomElement + @f:implements: AtomFeature10 @mv:refers: atomCommonAttributes @cm: @@ -1940,6 +2046,7 @@ @IFISA: AtomElement @ClsISA: ManakaiAtomElement + @f:implements: AtomFeature10 @mv:refers: atomCommonAttributes @cm: @@ -2096,6 +2203,7 @@ @IFISA: AtomElement @ClsISA: ManakaiAtomElement + @f:implements: AtomFeature10 @mv:refers: atomCommonAttributes @cm: @@ -2203,6 +2311,7 @@ @IFISA: AtomElement @ClsISA: ManakaiAtomElement + @f:implements: AtomFeature10 @mv:refers: atomCommonAttributes @cm: @@ -2926,6 +3035,7 @@ @IFISA: AtomElement @ClsISA: ManakaiAtomElement + @f:implements: AtomFeature10 @mv:refers: atomCommonAttributes @cm: @@ -3459,6 +3569,7 @@ @IFISA: AtomElement @ClsISA: ManakaiAtomElement + @f:implements: AtomFeature10 @mv:refers: atomCommonAttributes @cm: atomUriCM @@ -3473,6 +3584,7 @@ @IFISA: AtomElement @ClsISA: ManakaiAtomElement + @f:implements: AtomFeature10 @mv:refers: atomCommonAttributes @cm: atomUriCM @@ -3487,6 +3599,7 @@ @IFISA: AtomElement @ClsISA: ManakaiAtomElement + @f:implements: AtomFeature10 # no common attribs @cm: TextCM @@ -3502,6 +3615,7 @@ @IFISA: AtomElement @ClsISA: ManakaiAtomElement + @f:implements: AtomFeature10 # no common attribs @cm: atomUriCM @@ -3517,6 +3631,7 @@ @IFISA: AtomElement @ClsISA: ManakaiAtomElement + @f:implements: AtomFeature10 # no common attribs @cm: atomEmailAddressCM @@ -3532,6 +3647,7 @@ @IFISA: AtomElement @ClsISA: ManakaiAtomElement + @f:implements: AtomFeature10 @mv:refers: atomCommonAttributes @cm: atomUriCM @@ -3546,6 +3662,7 @@ @IFISA: AtomElement @ClsISA: ManakaiAtomElement + @f:implements: AtomFeature10 @mv:refers: atomCommonAttributes @cm: @@ -3799,6 +3916,8 @@ @IFISA: AtomPersonConstruct @ClsISA: ManakaiAtomPersonConstruct + + @f:implements: AtomFeature10 @mv:refers: PersonAG @mv:elementContentModel: PersonCM @@ -3816,6 +3935,7 @@ @IFISA: AtomElement @ClsISA: ManakaiAtomElement + @f:implements: AtomFeature10 @mv:refers: atomCommonAttributes @cm: undefinedContent @@ -3933,6 +4053,8 @@ @IFISA: AtomPersonConstruct @ClsISA: ManakaiAtomPersonConstruct + + @f:implements: AtomFeature10 @mv:refers: PersonAG @mv:elementContentModel: PersonCM @@ -3951,6 +4073,7 @@ @IFISA: AtomElement @ClsISA: ManakaiAtomElement + @f:implements: AtomFeature10 @mv:refers: atomCommonAttributes @cm: @@ -4037,6 +4160,7 @@ @IFISA: AtomElement @ClsISA: ManakaiAtomElement + @f:implements: AtomFeature10 @mv:refers: atomCommonAttributes @cm: undefinedContent @@ -4172,6 +4296,18 @@ of the attribute> of the node. @@Type: DOMString @@Get: + @@@enDesc: + {P:: If the feature + is supported, the attribute getter return + the string when both of the + following conditions are met: + + - The attribute getter would otherwise return . + + - The attribute contains + a string value of . + + } @@@nullCase: @@@@enDesc: If the algorithm returns . @@ -4183,6 +4319,15 @@ $r => $r, $defaultValue => {null}, }__; + + unless (defined $r) { + __DEEP{ + my $rel = $self->; + if (defined $rel and $rel eq ) { + $r = q; + } + }__; + } @@Set: @@@nullCase: @@@@enDesc: @@ -4196,6 +4341,74 @@ $given => $given, }__; + @@Test: + @@@QName: AtomLinkElement.type.!rel.test + @@@PerlDef: + my $doc; + __CODE{tc|createEmptyDocumentForTest:: $doc => $doc}__; + + my $el = $doc-> (, 'link'); + + $test->id ('implied'); + my $type0 = $el->; + $test->assert_null ($type0); + + $test->id ('explicit'); + $el-> ('application/atom+xml'); + my $type1 = $el->; + $test->assert_equals ($type1, q); + + $test->id ('different'); + $el-> ('application/xhtml+xml'); + my $type2 = $el->; + $test->assert_equals ($type2, q); + @@Test: + @@@QName: AtomLinkElement.type.rel!=replies.test + @@@PerlDef: + my $doc; + __CODE{tc|createEmptyDocumentForTest:: $doc => $doc}__; + + my $el = $doc-> (, 'link'); + + $el-> (); + + $test->id ('implied'); + my $type0 = $el->; + $test->assert_null ($type0); + + $test->id ('explicit'); + $el-> ('application/atom+xml'); + my $type1 = $el->; + $test->assert_equals ($type1, q); + + $test->id ('different'); + $el-> ('application/xhtml+xml'); + my $type2 = $el->; + $test->assert_equals ($type2, q); + @@Test: + @@@QName: AtomLinkElement.type.rel=replies.test + @@@PerlDef: + my $doc; + __CODE{tc|createEmptyDocumentForTest:: $doc => $doc}__; + + my $el = $doc-> (, 'link'); + + $el-> (); + + $test->id ('implied'); + my $type0 = $el->; + $test->assert_equals ($type0, q); + + $test->id ('explicit'); + $el-> ('application/atom+xml'); + my $type1 = $el->; + $test->assert_equals ($type1, q); + + $test->id ('different'); + $el-> ('application/xhtml+xml'); + my $type2 = $el->; + $test->assert_equals ($type2, q); + @ATTR: @@Name: hreflang @@enDesc: @@ -4304,6 +4517,8 @@ @IFISA: AtomDateConstruct @ClsISA: ManakaiAtomDateConstruct + + @f:implements: AtomFeature10 @mv:refers: DateAG @mv:elementContentModel: DateCM @@ -4324,6 +4539,8 @@ @IFISA: AtomTextConstruct @ClsISA: ManakaiAtomTextConstruct + + @f:implements: AtomFeature10 @mv:refers: TextAG @mv:elementContentModel: TextCM @@ -4359,6 +4576,7 @@ @IFISA: AtomElement @ClsISA: ManakaiAtomElement + @f:implements: AtomFeature10 @mv:refers: atomCommonAttributes @cm: @@ -4573,6 +4791,8 @@ @IFISA: AtomTextConstruct @ClsISA: ManakaiAtomTextConstruct + + @f:implements: AtomFeature10 @mv:refers: TextAG @mv:elementContentModel: TextCM @@ -4589,6 +4809,8 @@ @IFISA: AtomTextConstruct @ClsISA: ManakaiAtomTextConstruct + + @f:implements: AtomFeature10 @mv:refers: TextAG @mv:elementContentModel: TextCM @@ -4605,6 +4827,8 @@ @IFISA: AtomTextConstruct @ClsISA: ManakaiAtomTextConstruct + + @f:implements: AtomFeature10 @mv:refers: TextAG @mv:elementContentModel: TextCM @@ -4621,6 +4845,8 @@ @IFISA: AtomDateConstruct @ClsISA: ManakaiAtomDateConstruct + + @f:implements: AtomFeature10 @mv:refers: DateAG @mv:elementContentModel: DateCM @@ -4743,3 +4969,445 @@ @cm: dxm|ANY||ManakaiDOM|all @enImplNote: (text | anyForeignElement)* + +## -- Atom Threading Extension [RFC 4685] + +IFClsDef: + @IFQName: AtomEntryElementThread + @ClsQName: ManakaiAtomEntryElementThread + + @ClsISA: ManakaiAtomEntryElement + + @f:implements: AtomThreadingFeature10 + + @enDesc: + If the feature + is supported, any whose element type + is implement the + interface in addition to other appropriate interfaces. + + @Test: + @@QName: AtomEntryElementThread.1.test + @@PerlDef: + my $doc; + __CODE{tc|createEmptyDocumentForTest:: $doc => $doc}__; + + my $el = $doc->create_element_ns (, 'entry'); + + $test->id ('interface'); + $test->assert_isa ($el, ); + + $test->id ('feature'); + $test->assert_true ($el->is_supported ( => '1.0')); + + @Attr: + @@Name: threadInReplyToElements + @@enDesc: + A static list of child elements of the node. + @@Type: StaticNodeList + @@Get: + @@@enDesc: + It child element list> + of the node. + @@@PerlDef: + __CODE{returnChildElementList:: + $node => $self, + $namespaceURI => {}, + $localName => 'in-reply-to', + $r => $r, + }__; +##AtomEntryElementThread + +IFClsETDef: + @IFQName: AtomThreadInReplyToElement + @ETQName: thr|in-reply-to + @ETRQName: thr|in-reply-to + @ClsQName: ManakaiAtomThreadInReplyToElement + + @IFISA: AtomDateConstruct + @ClsISA: ManakaiAtomDateConstruct + + @f:implements: AtomThreadingFeature10 + @mv:refers: atomCommonAttributes + + @cm: undefinedContent + + @enDesc: + The element is used to indicate + that an entry is a response to another resource. + + If the entry is a response to multiple resources, + additional element + be used. + + RFC 4685 assigns no significance to the order in which + multiple element appear within + an entry. + + @Test: + @@QName: AtomThreadInReplyToElement.1.test + @@PerlDef: + my $doc; + __CODE{tc|createEmptyDocumentForTest:: $doc => $doc}__; + + my $el = $doc->create_element_ns (, 'in-reply-to'); + + $test->id ('interface'); + $test->assert_isa ($el, ); + + $test->id ('feature'); + $test->assert_true ($el->is_supported ( => '1.0')); + + @ATTR: + @@Name: ref + @@enDesc: + The attribute of the element. + + It attribute> of the node. + + The attribute specifies the persistent, + universally unique identifier of the resource being + responded to. The value conform to + the same construction and comparison rules as the + value of the element. Though the IRI + might use a dereferenceable scheme, processors + assume that it can be dereferenced. + + The element contain + a attribute identifying the resource that + is being respnoded to. + + If the resource being responded to does not have a persistent, + universally unique identifier, the publisher assign an + identifier that satisfies all the considerations in Section 4.2.6 of + RFC 4287 for use as the value of the attribute. + In that case, if a representation of the resource can be retrieved + from an IRI that can be used as a valid atom:id value, then this IRI + be used as the value of both the and + attributes. + @@Type: DOMString + @@actualType: DOMURI + @@Get: + @@@nullCase: + @@@@enDesc: + If the algorithm returns . + @@@PerlDef: + __CODE{getReflectAttrURIValue:: + $node => $self, + $namespaceURI => {null}, + $localName => 'ref', + $r => $r, + $defaultValue => {null}, + }__; + @@Set: + @@@nullCase: + @@@@enDesc: + Removes the attribute. + @@@NodeReadOnlyError: + @@@PerlDef: + __CODE{setReflectAttrURIValue:: + $node => $self, + $namespaceURI => {null}, + $localName => 'ref', + $given => $given, + }__; + + @ATTR: + @@Name: source + @@enDesc: + The attribute of the element. + + It attribute> of the node. + + The attribute be used to specify the IRI + of an Atom Feed or Entry Document containing an + with an value equal to the + value of the attribute. The IRI specified + be dereferenceable. + @@Type: DOMString + @@actualType: DOMURI + @@Get: + @@@nullCase: + @@@@enDesc: + If the algorithm returns . + @@@PerlDef: + __CODE{getReflectAttrURIValue:: + $node => $self, + $namespaceURI => {null}, + $localName => 'source', + $r => $r, + $defaultValue => {null}, + }__; + @@Set: + @@@nullCase: + @@@@enDesc: + Removes the attribute. + @@@NodeReadOnlyError: + @@@PerlDef: + __CODE{setReflectAttrURIValue:: + $node => $self, + $namespaceURI => {null}, + $localName => 'source', + $given => $given, + }__; + + @ATTR: + @@Name: href + @@enDesc: + The attribute of the element. + + It attribute> of the node. + + The attribute specifies an IRI that may be used + to retrieve a representation of the resource being + responded to. The IRI specified be + dereferenceable. + @@Type: DOMString + @@actualType: DOMURI + @@Get: + @@@nullCase: + @@@@enDesc: + If the algorithm returns . + @@@PerlDef: + __CODE{getReflectAttrURIValue:: + $node => $self, + $namespaceURI => {null}, + $localName => 'href', + $r => $r, + $defaultValue => {null}, + }__; + @@Set: + @@@nullCase: + @@@@enDesc: + Removes the attribute. + @@@NodeReadOnlyError: + @@@PerlDef: + __CODE{setReflectAttrURIValue:: + $node => $self, + $namespaceURI => {null}, + $localName => 'href', + $given => $given, + }__; + + @ATTR: + @@Name: type + @@enDesc: + The attribute of the element. + + It attribute> of the node. + + The attribute be used to provide + a hint to the client about the media type of the + resource identified by the attribute. + The attribute is only meaningful if a + corresponding attribute is also provided. + @@Type: DOMString + @@Get: + @@@nullCase: + @@@@enDesc: + If the algorithm returns . + @@@PerlDef: + __CODE{getReflectAttrStringValue:: + $node => $self, + $namespaceURI => {null}, + $localName => 'type', + $r => $r, + $defaultValue => {null}, + }__; + @@Set: + @@@nullCase: + @@@@enDesc: + Removes the attribute. + @@@NodeReadOnlyError: + @@@PerlDef: + __CODE{setReflectAttrStringValue:: + $node => $self, + $namespaceURI => {null}, + $localName => 'type', + $given => $given, + }__; +##AtomThreadInReplyToElement + +IFClsDef: + @IFQName: AtomLinkElementThread + @ClsQName: ManakaiAtomLinkElementThread + + @ClsISA: ManakaiAtomLinkElement + + @f:implements: AtomThreadingFeature10 + + @enDesc: + An element with a attribute value of + may be used to reference a resource where responses + to an entry may be found. If the attribute of the + is omitted, its value is assumed to be + . + + A link appearing as a child of the + or element indicates that the referenced + resource likely contains responses to any of that + feed's entries. A + link appearing as a child of an element + indicates that the linked resource likely contains responses + specific to that entry. + + If the feature + is supported, any whose element type + is implement the + interface in addition to other appropriate interfaces. + + @Test: + @@QName: AtomLinkElementThread.1.test + @@PerlDef: + my $doc; + __CODE{tc|createEmptyDocumentForTest:: $doc => $doc}__; + + my $el = $doc->create_element_ns (, 'link'); + + $test->id ('interface'); + $test->assert_isa ($el, ); + + $test->id ('feature'); + $test->assert_true ($el->is_supported ( => '1.0')); + + @ATTR: + @@Name: threadCount + @@enDesc: + The attribute of the element. + + It attribute> of the node. + + An element using the + attribute value contain + a attribute whose value is a + non-negative integer that provides a hint to clients + as to the total number of replies contained by the + linked resource. The value is advisory and + may not accurately reflect the actual number of replies. + @@Type: idl|long||ManakaiDOM|all + @@Get: + @@@PerlDef: + __CODE{getReflectAttrNonNegativeIntegerValue:: + $node => $self, + $namespaceURI => {}, + $localName => 'count', + $r => $r, + $defaultValue => {null}, + }__; + @@Set: + @@@NodeReadOnlyError: + @@@PerlDef: + __CODE{setReflectAttrNonNegativeIntegerValue:: + $node => $self, + $namespaceURI => {}, + $localName => 'count', + $given => $given, + }__; + + @@Test: + @@@QName: AtomLinkElementThread.threadCount.1.test + @@@PerlDef: + my $doc; + __CODE{tc|createEmptyDocumentForTest:: $doc => $doc}__; + + my $link = $doc->create_element_ns (, 'link'); + + $test->id ('default'); + $test->assert_num_equals + (expected_value => -1, + actual_value => + $link->); + + $test->id ('zero'); + $link-> (0); + $test->assert_num_equals + (expected_value => 0, + actual_value => + $link->); + $test->id ('zero.attr'); + $test->assert_equals ($link->get_attribute_ns (, 'count'), '0'); + + $test->id ('one'); + $link-> (1); + $test->assert_num_equals + (expected_value => 1, + actual_value => + $link->); + $test->id ('one.attr'); + $test->assert_equals ($link->get_attribute_ns (, 'count'), '1'); + + $test->id ('10000'); + $link-> (10000); + $test->assert_num_equals + (expected_value => 10000, + actual_value => + $link->); + $test->id ('10000.attr'); + $test->assert_equals ($link->get_attribute_ns (, 'count'), + '10000'); + + $test->id ('+10000'); + $link->set_attribute_ns (, 'thr:count', '+10000'); + $test->assert_num_equals + (expected_value => 10000, + actual_value => + $link->); + + $test->id ('010000'); + $link->set_attribute_ns (, 'thr:count', '010000'); + $test->assert_num_equals + (expected_value => 10000, + actual_value => + $link->); + + $test->id ('-100'); + $link-> (-100); + $test->assert_num_equals + (expected_value => -1, + actual_value => + $link->); + $test->id ('-100.attr'); + $test->assert_false ($link->has_attribute_ns (, 'count')); + + $test->id ('120a'); + $link->set_attribute_ns (, 'thr:count', '120a'); + $test->assert_num_equals + (expected_value => -1, + actual_value => + $link->); + + $test->id ('-1'); + $link-> (-1); + $test->assert_num_equals + (expected_value => -1, + actual_value => + $link->); + $test->id ('-1.attr'); + $test->assert_false ($link->has_attribute_ns (, 'count')); + + @enImplNote: + @@ddid: updated + @@@: + {TODO:: + attribute + } +##AtomLinkElementThread + +enImplNote: + @@ddid: total + @@@: + {TODO:: + + } + +enImplNote: + @@ddid: threaddtd + @@@: + {TODO:: + DTD impl for threading + }