Parser.parse() error

2892
9
Jump to solution
09-30-2013 08:31 AM
GaneshSolai_Sambandam
New Contributor III
I created dgrid application in a separate html file and all of my code worked fine. when I try to integrate this code to my main application, it start to have problem and it says parser.parse() error. Can anyone tell me, what would be the exact problem.
0 Kudos
1 Solution

Accepted Solutions
JonathanUihlein
Esri Regular Contributor
Ganesh, you still haven't corrected your require block. The modules and their namespace declarations need to be invoked in the same order.

If you line up your module names and namespace declarations, you will notice you have an extra declaration for array.

You *really* need to read the tutorials on DOJO's site.
This type of error is covered very early on.

Please read this:
http://dojotoolkit.org/documentation/tutorials/1.9/modern_dojo/

"dojo/ready", "dgrid/OnDemandGrid",  "dgrid/Selection",  "dojo/store/Memory", "esri/map",  "esri/config",  "esri/dijit/Geocoder",  "esri/geometry/screenUtils",  "esri/geometry/Extent",  "esri/geometry/Point",  "esri/geometry/webMercatorUtils",  "esri/tasks/locator",  "esri/graphic",  "esri/SpatialReference", "esri/layers/FeatureLayer",  "esri/layers/KMLLayer",  "esri/tasks/QueryTask", "esri/tasks/query",  "esri/tasks/RelationParameters",  "esri/tasks/GeometryService",  "esri/tasks/BufferParameters", "esri/symbols/SimpleMarkerSymbol",  "esri/symbols/SimpleLineSymbol",  "esri/symbols/PictureMarkerSymbol",  "esri/symbols/Font",  "esri/symbols/TextSymbol", "esri/InfoTemplate", "esri/dijit/BasemapGallery",  "esri/arcgis/utils", "dojo/_base/array",  "dojo/_base/Color",  "dojo/_base/declare",  "dojo/dom-style",  "dojo/on", "dojo/number",  "dojo/dom",  "dojo/dom-construct",  "dojo/query",  "dijit/registry",  "dojo/parser", "dijit/form/Button",  "dijit/form/TextBox",  "dijit/layout/BorderContainer",  "dijit/layout/ContentPane",  "dijit/layout/AccordionContainer",  "dijit/layout/TabContainer",  "dijit/Menu",  "dijit/TitlePane", "dojo/domReady!"


ready,  Grid,  Selection,  Memory,  Map,  esriConfig,  Geocoder,  screenUtils,  Extent,  Point,  webMercatorUtils,  Locator,  Graphic,  SpatialReference,  FeatureLayer,  KMLLayer,  QueryTask,  Query,  RelationshipParameters,  GeometryService,  BufferParameters,  SimpleMarkerSymbol,  SimpleLineSymbol,  PictureMarkerSymbol,  Font,  TextSymbol,  InfoTemplate,  BasemapGallery, arcgisUtils,  array,  arrayUtils,  Color,  declare,  domStyle,  on,  number,  dom, domConstruct,  query, registry,  parser, Button,  TextBox,  BorderContainer,  ContentPane,  AccordionContainer,  TabContainer,  Menu,  TitlePane,  domReady


Make sure you mark the thread as 'answered' when you find the answer you seek.

View solution in original post

0 Kudos
9 Replies
JonathanUihlein
Esri Regular Contributor
Sounds like you're running the parser twice.

Double check your code to make sure you aren't invoking the parser multiple times.
0 Kudos
JeffPace
MVP Alum
the parser.parse error doesnt always mean what you think it means.

it can be misleading, its just what is catching the error.

Unfortunately, without posting code, not much to go on.  But if you are loading an html file, try running it through a validator.
0 Kudos
JonathanUihlein
Esri Regular Contributor
Jeff is correct!

Look for multiple instances of the parser or incorrectly formatted HTML if you are using BorderContainers and ContentPanes.

Some users end up having the parser run twice after migrating from an older version of the API to a newer one.

For example, having both of the following in your application will throw a parser error:
<script type="text/javascript" src="dojo/dojo.js" data-dojo-config="parseOnLoad: true"></script>

require(["dojo/parser", "dojo/ready"], function(parser, ready){
  ready(function(){
    parser.parse();
  });
});
0 Kudos
GaneshSolai_Sambandam
New Contributor III
Hi Guys,
Thanks for your comments and here is my code attached on the word document.
0 Kudos
JeffPace
MVP Alum
your classes in the require and then in the function declaration dont line up.  For example,

your function ends in require, but in the declare you have about 10 more classes after that including button, etc..
0 Kudos
GaneshSolai_Sambandam
New Contributor III
Hi Jeff,
Just included all the classess as per your suggestion, but still dont work.
require(["dojo/ready","dgrid/OnDemandGrid", "dgrid/Selection", "dojo/store/Memory",
    "esri/map", "esri/config", "esri/dijit/Geocoder", "esri/geometry/screenUtils", "esri/geometry/Extent", "esri/geometry/Point", "esri/geometry/webMercatorUtils", "esri/tasks/locator", "esri/graphic", "esri/SpatialReference",
    "esri/layers/FeatureLayer", "esri/layers/KMLLayer", "esri/tasks/QueryTask", "esri/tasks/query", "esri/tasks/RelationParameters", "esri/tasks/GeometryService", "esri/tasks/BufferParameters",
    "esri/symbols/SimpleMarkerSymbol", "esri/symbols/SimpleLineSymbol", "esri/symbols/PictureMarkerSymbol", "esri/symbols/Font", "esri/symbols/TextSymbol", "esri/InfoTemplate",

    "esri/dijit/BasemapGallery", "esri/arcgis/utils",
     "dojo/_base/array", "dojo/_base/Color", "dojo/_base/declare", "dojo/dom-style", "dojo/on",
    "dojo/number", "dojo/dom", "dojo/dom-construct", "dojo/query", "dijit/registry", "dojo/parser",
     "dijit/form/Button", "dijit/form/TextBox", "dijit/layout/BorderContainer", "dijit/layout/ContentPane", "dijit/layout/AccordionContainer", "dijit/layout/TabContainer", "dijit/Menu", "dijit/TitlePane",
      "dojo/domReady!"


], function (ready, Grid, Selection, Memory, Map, esriConfig, Geocoder, screenUtils, Extent, Point, webMercatorUtils, Locator, Graphic, SpatialReference,
    FeatureLayer, KMLLayer, QueryTask, Query, RelationshipParameters, GeometryService, BufferParameters, SimpleMarkerSymbol, SimpleLineSymbol, PictureMarkerSymbol, Font, TextSymbol, InfoTemplate, BasemapGallery,
    arcgisUtils, array, arrayUtils, Color, declare, domStyle, on, number, dom, domConstruct, query, registry, parser,
    Button, TextBox, BorderContainer, ContentPane, AccordionContainer, TabContainer, Menu, TitlePane, domReady) 
0 Kudos
JonathanUihlein
Esri Regular Contributor
Ganesh, you still haven't corrected your require block. The modules and their namespace declarations need to be invoked in the same order.

If you line up your module names and namespace declarations, you will notice you have an extra declaration for array.

You *really* need to read the tutorials on DOJO's site.
This type of error is covered very early on.

Please read this:
http://dojotoolkit.org/documentation/tutorials/1.9/modern_dojo/

"dojo/ready", "dgrid/OnDemandGrid",  "dgrid/Selection",  "dojo/store/Memory", "esri/map",  "esri/config",  "esri/dijit/Geocoder",  "esri/geometry/screenUtils",  "esri/geometry/Extent",  "esri/geometry/Point",  "esri/geometry/webMercatorUtils",  "esri/tasks/locator",  "esri/graphic",  "esri/SpatialReference", "esri/layers/FeatureLayer",  "esri/layers/KMLLayer",  "esri/tasks/QueryTask", "esri/tasks/query",  "esri/tasks/RelationParameters",  "esri/tasks/GeometryService",  "esri/tasks/BufferParameters", "esri/symbols/SimpleMarkerSymbol",  "esri/symbols/SimpleLineSymbol",  "esri/symbols/PictureMarkerSymbol",  "esri/symbols/Font",  "esri/symbols/TextSymbol", "esri/InfoTemplate", "esri/dijit/BasemapGallery",  "esri/arcgis/utils", "dojo/_base/array",  "dojo/_base/Color",  "dojo/_base/declare",  "dojo/dom-style",  "dojo/on", "dojo/number",  "dojo/dom",  "dojo/dom-construct",  "dojo/query",  "dijit/registry",  "dojo/parser", "dijit/form/Button",  "dijit/form/TextBox",  "dijit/layout/BorderContainer",  "dijit/layout/ContentPane",  "dijit/layout/AccordionContainer",  "dijit/layout/TabContainer",  "dijit/Menu",  "dijit/TitlePane", "dojo/domReady!"


ready,  Grid,  Selection,  Memory,  Map,  esriConfig,  Geocoder,  screenUtils,  Extent,  Point,  webMercatorUtils,  Locator,  Graphic,  SpatialReference,  FeatureLayer,  KMLLayer,  QueryTask,  Query,  RelationshipParameters,  GeometryService,  BufferParameters,  SimpleMarkerSymbol,  SimpleLineSymbol,  PictureMarkerSymbol,  Font,  TextSymbol,  InfoTemplate,  BasemapGallery, arcgisUtils,  array,  arrayUtils,  Color,  declare,  domStyle,  on,  number,  dom, domConstruct,  query, registry,  parser, Button,  TextBox,  BorderContainer,  ContentPane,  AccordionContainer,  TabContainer,  Menu,  TitlePane,  domReady


Make sure you mark the thread as 'answered' when you find the answer you seek.
0 Kudos
GaneshSolai_Sambandam
New Contributor III
It worked fine. thanks for your help, Jon and Jeff.
0 Kudos
JeffPace
MVP Alum
glad we got you working
0 Kudos