apache-flexactionscript-3blackberry-simulator

mxml file erroring with `element type "components" must be followed by either attribute specifications`


I am getting problem like

Element type "components" must be followed by either attribute specifications, ">"

and my mxml file is

<?xml version="1.0" encoding="utf-8"?>

<components:View xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:components="spark.components.*" title="Home" creationComplete="srv.send()">
    
    <fx:Declarations>
        <s:HTTPService id="srv" url="assets/employees.xml"/>
    </fx:Declarations>
    
    <s:List id="list" top="0" bottom="0" left="0" right="0"
            dataProvider="{srv.lastResult.list.employee}" 
            labelField="lastName"/>
</components:View>

<components:View xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:components="spark.components.*" title="Home" creationComplete="srv.send()">

this line gives me error like following line Element type "components" must be followed by either attribute specifications, ">"

Why am I getting this error?


Solution

  • Here are a few things to consider:

    1) You aren't using a Mobile Component project, and therefore do not have mobile components added to the library path. View is a Mobile Component. IF this is the case you can add it to the class path manually.

    2) It is odd to define the spark components as a namespace separate of the default 's' namespace:. This approach would be more common:

    <s:View xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" title="Home" creationComplete="srv.send()">
    </s:View>