[Project_owners] nsIXMLHttpRequest woes

Eric H. Jung grimholtz at yahoo.com
Thu May 18 16:09:33 EDT 2006


Hi Alex,

Thanks for the reply. The file isn't really a XUL file, just XML. It
looks like this:

<?xml-stylesheet href="foxyproxy.css" type="text/css"?>
<!DOCTYPE overlay SYSTEM "chrome://foxyproxy/locale/foxyproxy.dtd">

<root xmlns="http://foxyproxy.mozdev.org/">  
  <i18n id="foxyproxy.proxydns.label"
    value="&foxyproxy.proxydns.label;"/>
  <i18n id="foxyproxy.proxydns.accesskey"
    value="&foxyproxy.proxydns.accesskey;"/>  
...
</root>

So I've renamed it with an .xml extension. Anway, instead of reading
the file directly, what I really want is for the entities to be
processsed by an XML parser into localized strings. Is there a way to
create a DOM from this programmatically (perhaps by creating a
<browser/> and using this as the source?) Once again, this is an XPCOM
JS component.

Any other ideas? I've got a feeling if I use your ChromeFile interface,
I'll just get the entities without translation.

Thanks,
Eric



--- Alex Vincent <ajvincent at gmail.com> wrote:

> > var req =
> Components.classes["@mozilla.org/xmlextras/xmlhttprequest;1"]
> >   .createInstance(Components.interfaces.nsIXMLHttpRequest);
> >
> > req.open("GET", "chrome://foxyproxy/content/strings.xul", false);
> 
> XMLHttpRequest doesn't work for chrome URL's (HTTP and chrome are
> different protocols entirely).  Personally, I recommend you look into
> DOMParser and the ChromeFile interface I wrote for jslib.
> 
> -- 
> "The first step in confirming there is a bug in someone else's work
> is
> confirming there are no bugs in your own."
> -- Alexander J. Vincent, June 30, 2001
> _______________________________________________
> Project_owners mailing list
> Project_owners at mozdev.org
> http://mozdev.org/mailman/listinfo/project_owners
> 



More information about the Project_owners mailing list