[Laszlo-dev] Re: should this be type="text"?

Henry Minsky henry.minsky at gmail.com
Mon Nov 14 20:33:03 PST 2005


Never mind, if I call

value.detach();

before trying to add it to some other element, it is happy.



On 11/14/05, Henry Minsky <henry.minsky at gmail.com> wrote:
>
> I'm trying out the new JDOM 1.0 patch, and I get this error thrown when I
> try to compile
> demo/contacts/contacts.lzx:
>
> $ lzc demos/contacts/contacts.lzx
> Exception in thread "main" org.jdom.IllegalAddException: The element
> "menubar" could not be added as the root of the document: The Content
> already has an existing parent document
> at org.jdom.ContentList.add(ContentList.java:214)
> at org.jdom.ContentList.add(ContentList.java:140)
> at org.jdom.ContentList.set(ContentList.java:497)
> at org.openlaszlo.compiler.Parser.expandIncludes(Parser.java:474)
> at org.openlaszlo.compiler.Parser.expandIncludes(Parser.java:463)
> at org.openlaszlo.compiler.Parser.readExpanded(Parser.java:389)
> at org.openlaszlo.compiler.Parser.parse(Parser.java:485)
> at org.openlaszlo.compiler.Compiler.compile(Compiler.java:286)
>
> The error is caused when the parser tries to do a reparenting of the
> menubar.lzx content for the <include>
> in contacts.lzx:
>
>
> <!-- MAIN WINDOW FOR CONTACTS DEMO -->
> <window title="Laszlo Contacts" id="mainwindow" x="10" y="10" width="510"
> height="300" resizable="true">
>
> <!-- VIEWS of mainwindow-->
> <view placement="icon" resource="main_icon.png"/>
>
> <include href="menubar.lzx" />
>
>
> The problem is the element <menubar> is marked as a root element, and JDOM
> doesn't like to put
> such a thing as a child of another element. I think I can fix this by
> bashing the <menubar> element
> to not be marked as a root element somehow. Any ideas how to make an
> Element not a root element in JDOM 1.0?
> I was going to try detaching the element's from it's children and making a
> new one that is not a root element, and
> then attaching the children to it. Need to copy over the attributes as
> well.
>
>
>
> --
> Henry Minsky
> Software Architect
> hminsky at laszlosystems.com
>
>


--
Henry Minsky
Software Architect
hminsky at laszlosystems.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://openlaszlo.org/pipermail/laszlo-dev/attachments/20051114/236e1fb6/attachment-0001.html


More information about the Laszlo-dev mailing list