Changeset 21023

Show
Ignore:
Timestamp:
10/09/08 08:48:31 (3 months ago)
Author:
tokuhirom
Message:

added node.getAttributeNode()

Location:
lang/cplusplus/llv8call/trunk
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • lang/cplusplus/llv8call/trunk/ext/libxml/element.cc

    r21008 r21023  
    4747        xmlFree(ret); 
    4848        return s; 
     49    } else { 
     50        return Undefined(); 
     51    } 
     52END 
     53 
     54FUNCTION(getAttributeNode) 
     55    ARG_COUNT(1); 
     56    ARG_str(name, 0); 
     57    EXTERNAL_NODE(); 
     58    EXTERNAL_DOC(); 
     59    xmlAttrPtr attr = domGetAttrNode(node, (const xmlChar*)*name); 
     60    if (attr) { 
     61        return CREATE_ATTR(doc, attr); 
    4962    } else { 
    5063        return Undefined(); 
     
    108121    BIND_IM("appendTextNode",   appendText); // alias 
    109122    BIND_IM("getAttribute",     getAttribute); 
     123    BIND_IM("getAttributeNode", getAttributeNode); 
    110124    BIND_IM("hasAttribute",     hasAttribute); 
    111125    BIND_IM("removeAttribute",  removeAttribute); 
  • lang/cplusplus/llv8call/trunk/ext/libxml/libxml.h

    r20986 r21023  
    3535} 
    3636 
    37 #define CREATE_NODE(doc, node) createObject("Node",      doc, node) 
    38 #define CREATE_ATTR(doc, node) createObject("Attribute", doc, node) 
     37#define CREATE_NODE(doc, node) createObject("Node", doc, node) 
     38#define CREATE_ATTR(doc, node) createObject("Attr", doc, (xmlNodePtr)node) 
    3939 
    4040#define ARG_node(name, n) EXTERNAL(xmlNodePtr, name, args[n]->ToObject(), 0) 
  • lang/cplusplus/llv8call/trunk/t/070_libxml/02_dom.js

    r21020 r21023  
    11require('t/util.js'); 
    22 
    3 plan({tests:42}); 
     3plan({tests:44}); 
    44 
    55check_lib("org.coderepos.libxml"); 
     
    162162}); 
    163163 
     164test(function () { 
     165    root.setAttributeNode(doc.createAttribute("foo", "bar")); 
     166    is(root.getAttributeNode('foo').getValue(),  'bar',               'node.getAttributeNode()'); 
     167    is(root.getAttributeNode('noo'),             undefined,           'node.getAttributeNode()'); 
     168}); 
     169 
    164170doc.close(); 
    165171