Hallo Pavel,
__________________________________________________________________________
Monday, July 09, 2001, 1:22:11 PM, you wrote:


PH> it ought to be fiwxed somewhere else (in the C API)

Yes, I have understood it.
What you look to add the following for simplification of syntax (?):


package XML::Sablotron::DOM::Node;

*nodeType        = \&getNodeType;
*parentNode      = \&getParentNode;
*firstChild      = \&getFirstChild;
*lastChild       = \&getLastChild;
*nextSibling     = \&getNextSibling;
*previousSibling = \&getPreviousSibling;
*ownerDocument   = \&getOwnerDocument;
sub nodeValue(;$){ $#_ ? setNodeValue(shift, shift) : getNodeValue(shift) }
sub nodeName(;$){  $#_ ? setNodeName(shift, shift)  : getNodeName(shift) }

sub selectSingleNode($){
    my $self = shift; my $res = $self->xql( shift );
    return $res ? $res->[0] : undef;
}

sub selectNodes($){
    my $self = shift; my $res = $self->xql( shift );
    return wantarray ? @$res : $res;
}


package XML::Sablotron::DOM::Element;
*tagName = \&getNodeName;


package XML::Sablotron::DOM::Document;

sub documentElement(;$)
{
    my ($self, $replace) = @_;
    
    my $elem = $self->firstChild();
    while( $elem ){
        last if $elem->nodeType == XML::Sablotron::DOM::ELEMENT_NODE;
        $elem = $elem->nextSibling();
    }

    if( $replace ){
        die unless $replace->nodeType == XML::Sablotron::DOM::ELEMENT_NODE;
        $self->replaceChild( $replace, $elem );
        $elem = $replace;
    }

    return $elem;
}


__________________________________________________________________________
Alles Gutes,
 Albert                            mailto:[EMAIL PROTECTED]


Reply via email to