W3C home > Mailing lists > Public > www-dom@w3.org > July to September 2002

canMoveUp, canMoveDown

From: Laurens van den Oever <laurens@Q42.nl>
Date: Fri, 26 Jul 2002 05:36:50 -0400 (EDT)
Message-ID: <E45658F2AAA3AF4A9CE4B5E7EAA70B2D0124AC@SOUTHERNCOMFORT.Q42.nl>
To: <www-dom@w3.org>




Hi,

I just saw the DOM Level 3 Validation Specification. This looks very
interesting to me since we at Q42 are building Xopus (xopus.org), a
validating XML editor. During development of this editor we came to a
similar interface:

boolean  canContainNode (parentNode, nodeName, namespaceURI)
boolean  canMoveUp (node)
boolean  canMoveDown (node)
boolean  canDeleteNode (node)
array    getPossibleChildren (node) // Returns both elements and
attributes

Obviously, our interface not as extensive as the proposed specification,
but we do have atomic functions for moving nodes (swapping them with a
sibling). I wondered how the proposed interface would deal with the
following situation:

XML:

<parent>
  <childA/>
  <childB/>
</parent>

Schema:

<xs:element name="parent">
  <xs:complexType>
    <xs:choice minOccurs="2" maxOccurs="2">
      <xs:element name="childA" type="xs:string"/>
      <xs:element name="childB" type="xs:string"/>
    </xs:choice>
  <xs:complexType>
</xs:element>
      
In this example the parent element is valid if and only if it has 2
children. However, it remains valid when its children are swapped. So
canMoveUp(childBNode) is true for the given xml. How could I draw the
same conclusion when using the proposed specification?

Note: both canMoveUp and canMoveDown can easily be implemented when
using a canSwap(firstNode, secondNode) method.

Greetings,

Laurens van den Oever
Received on Friday, 26 July 2002 09:48:08 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 22 June 2012 06:13:56 GMT