Migrating OpenLaszlo application to 5.0: The tag xxx cannot be used as a child of view

224 Views Asked by At

I want to know has anyone across a defect like this when upgrading open laszlo.

The tag xxx cannot be used as a child of view
The tag xxx cannot be used as a child of class

Why this error happens? Any Idea?

1

There are 1 best solutions below

1
On

The error message xxx cannot be used as a child yyy of view simply means that you are using a tag inside a tag, and the child tag is not known. Simple example:

<canvas debug="true">

  <view width="100" height="100" bgcolor="red">
    <unknown_tag />
  </view>

</canvas>

Compiler error message: class_tag_error.lzx:4:48: The tag 'unknown_tag' cannot be used as a child of view class_tag_error.lzx:5:20: Unknown tag

I remember that some people had a similar problem when upgrading from 4.0 to 4.2, here is the discussion in the laszlo-dev mailing list. Is the problem caused by a standard OpenLaszlo tag in your code, or by a custom class or tag you have added?

There is a schema file for all classes and tags the OpenLaszlo compiler knows, which can be found in

$LPS_HOME/WEB-INF/lps/schema/build/lfc.xml

If the compiler complains about a built-in LZX tag, you could - as a last resort - check that file if the class definition for that specific tag still exists in the OpenLaszlo version you are using. Here is - for example - the beginning of the class/interface definition for the <view> tag:

  <interface extends="node" jsname="LzView" name="view">
    <method args="who, self, prop, refView" name="$lzc$getAttributeRelative_dependencies"/>
    <method args="who, self" name="$lzc$getBounds_dependencies"/>
    <method args="who, self" name="$lzc$getCurrentTime_dependencies"/>
    <method args="ignore" name="$lzc$getMouse_dependencies"/>
    <method args="who, self" name="$lzc$getTotalTime_dependencies"/>
    <method args="ignore" name="$lzc$isMouseOver_dependencies"/>
  ... (continued)

Although that's definitely not a comfortable way of finding out if a tag still exists.