[prev in list] [next in list] [prev in thread] [next in thread] 

List:       xerces-p-dev
Subject:    A Handy Function
From:       Fredrick Paul Eisele <phreed () netarx ! com>
Date:       2001-12-07 16:51:45
[Download RAW message or body]

This is not to replace "element_text" even though it is similar.
While doing things in Xalan I noticed that XSL does not 
recognize CDATA sections as distinct from text nodes.
Jason could you add this (or something like it).
Thanks.

# Say I want to stringify (not serialize) an element like xslt
sub stringify {
  my $this_node = shift;

  my $node_type = $this_node->getNodeType;
  if ($node_type eq $XML::Xerces::DOM_Node::ELEMENT_NODE) {
    my $value = undef;
    for( my $node = $this_node->getFirstChild;
        ! $node->isNull;
          $node = $node->getNextSibling ) {
      $value .= stringify( $node );
    }
return $value;
  }
return $this_node->getNodeValue;
}


-- 
Fredrick Paul Eisele
30910 Telegraph Rd.
Bingham Farms, MI
1.248.341.2580

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-p-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-p-dev-help@xml.apache.org

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic