Hm... I am not familiar with the document.implementation object, so I will
not be much of a help here, but, first, clean up your code a little by
removing unrealistic checks, like window.ActiveXObject.
And why are you not using XMLHttpRequest to get the data from the XML
instead of that document.implementation object?

☆PhistucK


On Wed, Dec 30, 2009 at 23:06, Arnaud Delante <[email protected]> wrote:

> Hi, I'm building my first extension and I've a little problem. I've an
> XML file such like this :
>
> <?xml version='1.0' encoding='utf8'?>
> <objects>
>    <url>
>        <domain>...</domain>
>        <nb_clics>...</nb_clics>
>        <alias>...</alias>
>        <title>...</title>
>        <source>...</source>
>        <description />
>    </url>
> </objects>
>
> Ans I like to get the value of the alias tag for exemple. I've tried
> this :
>
> <html>
>    <head>
>        <style>
>            body {
>                width:160px;
>                background-color:#eeeeee;
>            }
>            p {
>                font-weight:bold;
>                margin-bottom:0;
>            }
>        </style>
>    </head>
>    <script type="text/javascript">
>        function DOMImplementation(sUrl, fCallback) {
>            var dom;
>            if(window.ActiveXObject) {
>                dom = new ActiveXObject("Microsoft.XMLDOM");
>                dom.onreadystatechange = function() {
>                    if(dom.readyState == 4) {
>                        fCallback(dom);
>                    }
>                };
>            }
>            else if(document.implementation &&
> document.implementation.createDocument) {
>                dom = document.implementation.createDocument("", "",
> null);
>                dom.onload = function() {
>                    fCallback(dom);
>                }
>            }
>            else {
>                alert("Error");
>                return;
>            }
>            dom.load(sUrl);
>        }
>
>        function shrimit() {
>            var nicknick = localStorage["nick_name"];
>            var apiapi = localStorage["api_key"];
>            var yourc = document.getElementById("your");
>
>            chrome.tabs.getSelected(null,function(tab) {
>                var tablink = tab.url;
>                if(!nicknick || !apiapi){
>                    yourc.setAttribute("value","Set the options");
>                } else {
>                    DOMImplementation("post.xml", getData);
>                    function getData(oData) {
>                        var tablink2 = oData.getElementsByTagName
> ("alias")[0].firstChild.data;
>                        yourc.setAttribute("value",tablink2);
>                    }
>                }
>            });
>        }
>    </script>
>    <body onload="shrimit()">
>        <input id="your" name="your" type="text" value="" />
>    </body>
> </html>
>
> But nothing in my input ... Anybody have a solution for me ?
>
> --
>
> You received this message because you are subscribed to the Google Groups
> "Chromium-extensions" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<chromium-extensions%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/chromium-extensions?hl=en.
>
>
>

--

You received this message because you are subscribed to the Google Groups 
"Chromium-extensions" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/chromium-extensions?hl=en.


Reply via email to