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)
To: <www-dom@w3.org>


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

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:




<xs:element name="parent">
    <xs:choice minOccurs="2" maxOccurs="2">
      <xs:element name="childA" type="xs:string"/>
      <xs:element name="childB" type="xs:string"/>
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.


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

This archive was generated by hypermail 2.3.1 : Tuesday, 20 October 2015 10:46:10 UTC