Cannot populate a xul tree from XML

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Cannot populate a xul tree from XML

Luca Fagioli
Hello,
I am trying to populate a xul tree from an XML document.

I am using the "@mozilla.org/inspector/dom-view;1" component.

The xul tree load the XML document structure correctly: I can see the
"+" in the right place, but the problem is that no label is displayed at
all.

I just have a correct but completely anonymous XML structure.

Here is my code:

*****************

var domView =
Components.classes["@mozilla.org/inspector/dom-view;1"].createInstance(Components.interfaces.inIDOMView);

var domDocument = document.implementation.createDocument("", "", null);
domDocument.load('chrome://crawlermodelgen/content/morningstar.xml');

domView.rootNode = domDocument;
domView.showWhitespaceNodes = true;
domView.showAnonymousContent = true;
domView.showSubDocuments = true;
domView.whatToShow &= (NodeFilter.SHOW_ALL);

var sidebarTree = sidebar.document.getElementById("cmgDOMTree");
sidebarTreeBox.view = domView;

*****************

What do I do wrong? Is this the right way to face this issue?

Luca
_______________________________________________
dev-tech-xml mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-xml
Reply | Threaded
Open this post in threaded view
|

Re: Cannot populate a xul tree from XML

Boris Zbarsky
Luca Fagioli wrote:
> I am using the "@mozilla.org/inspector/dom-view;1" component.

That's designed to show trees that are in windows, and to show them in DOM
Inspector; it may well not work for random in-memory trees shown somewhere else....

-Boris
_______________________________________________
dev-tech-xml mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-xml
Reply | Threaded
Open this post in threaded view
|

Re: Cannot populate a xul tree from XML

Luca Fagioli
Boris Zbarsky ha scritto:
> Luca Fagioli wrote:
>> I am using the "@mozilla.org/inspector/dom-view;1" component.
>
> That's designed to show trees that are in windows, and to show them in
> DOM Inspector; it may well not work for random in-memory trees shown
> somewhere else....
>
> -Boris

It works.

That component can handle generic DOM documents.

The only restriction is to use a XUL tree (and its internal tags) with
the same id of the ones used in the DOM inspector.

Luca
_______________________________________________
dev-tech-xml mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-xml