Hi all,
i am stack on this:
i am parsing a dom document, i reach a text node, but i can't get the
text out of the text node.
Hope some one can help.
this is the code:

childs is a nsIDOMNodeList.

        PRUint32 len, i;
        childs->GetLength( &len );
        nsCOMPtr<nsIDOMNode> child;
        nsEmbedString name;
        nsEmbedString value;
        PRUint16 type;
        for( i = 0; i < len; i++ ) {
            childs->Item( i, getter_AddRefs( child ) );
            child->GetNodeType( &type );
            child->GetLocalName( name );

            // TEXT_NOTE here
            if( type == nsIDOMNode::TEXT_NODE ) {
                httpsec_log( stderr, "%s\n", "TEXT_NODE" );
                nsCOMPtr<nsIDOMText> data = do_QueryInterface( child );
                NS_ENSURE_TRUE( data, NS_ERROR_UNEXPECTED );

                data->GetData( value );
                // there is nothing in value, when i print it
                httpsec_log( stderr, "%s\n", NS_ConvertUTF16toUTF8(
value ).get() );
                data->GetNodeValue( value );
                // again nothing here
                httpsec_log( stderr, "%s\n", NS_ConvertUTF16toUTF8(
value ).get() );
            }
_______________________________________________
dev-tech-xpcom mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-xpcom

Reply via email to