I intend to get the node with flash object by parsing the dom tree.
When I use the dom.GetElementsByTagName() to put all the node of the
dom into a node list, I can find a node with nodeName="OBJECT".
<code>
         // get the node list with tag = "object"
         nsCOMPtr<nsIDOMNodeList> objNodeList;
         PRUint32 length = 0;
         res = domDocument->GetElementsByTagName(NS_LITERAL_STRING("*"),
getter_AddRefs(objNodeList));
         if (NS_FAILED(res))
             return NS_ERROR_FAILURE;
         else if (objNodeList){
             objNodeList->GetLength(&length);
             printf("================>node list length:%d\n", length);
         }
         for (PRUint32 index = 0; index < length; index++) {
             nsCOMPtr<nsIDOMNode> childNode;
             objNodeList->Item(index, getter_AddRefs(childNode));
             if (!childNode)
                 continue;
             nsAutoString nodeName;
             childNode->GetNodeName(nodeName);
             if
(strcasecmp(NS_LossyConvertUTF16toASCII(nodeName).get(), "OBJECT") ==
0)
                 printf("%d node name is %s\n", index,
NS_LossyConvertUTF16toASCII(nodeName).get());
         }
</code>

But when i want to get the flash node by the tag name "OBJECT", the
length of nodeList is 0.
<code>
res = domDocument->GetElementsByTagName(NS_LITERAL_STRING("OBJECT"),
getter_AddRefs(objNodeList));
</code>

Why can't get the node with nodeName="OBJECT" directly?
Please give me some advices. Thanks in advance.

-- Havvy
_______________________________________________
dev-embedding mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-embedding

Reply via email to