Examples of FXGInvalidRootNodeProblem


Examples of org.apache.flex.compiler.problems.FXGInvalidRootNodeProblem

                        problems.add(new FXGUnknownElementInVersionProblem(documentPath, startLine, startColumn, localName, root.getFileVersion().asDouble()));                  
                    }
                }
                else
                {
                    problems.add(new FXGInvalidRootNodeProblem(documentPath, startLine, startColumn));
                }

                return;
            }

            // Provide access to the root document node used for querying version
            // for non-root elements
            if (root != null)
            {
                node.setDocumentNode(root);
            }

            // Set node name if it is a delegate node. This allows proper error
            // message to be reported.
            if (node instanceof DelegateNode)
            {
                DelegateNode propertyNode = (DelegateNode)node;
                propertyNode.setName(localName);
            }

            // Set attributes on the current node
            for (int i = 0; i < attributes.getLength(); i++)
            {
                String attributeURI = attributes.getURI(i);
                if (attributeURI == null || attributeURI == "" || isFXGNamespace(attributeURI))
                {
                    String attributeName = attributes.getLocalName(i);
                    String attributeValue = attributes.getValue(i);
                    node.setAttribute(attributeName, attributeValue, problems);
                }
            }

            // Associate child with parent node (and handle any special
            // relationships)
            if (parent != null)
            {
                if (node instanceof DelegateNode)
                {
                    DelegateNode propertyNode = (DelegateNode)node;
                    propertyNode.setDelegate(parent, problems);
                }
                else
                {
                    parent.addChild(node, problems);
                }
            }
            else if (node instanceof GraphicNode)
            {
                root = (GraphicNode)node;
                // Provide access to the root document node
                node.setDocumentNode(root);
                if (root.getVersion() == null)
                {
                    for(ICompilerProblem problem : problems)
                    {
                        if(problem instanceof FXGInvalidVersionProblem)
                        {
                            // There was a version attribute but it was invalid.
                            return;
                        }
                    }

                    //<Graphic> doesn't have the required attribute "version".
                    problems.add(new FXGMissingAttributeProblem(documentPath, startLine, startColumn, FXG_VERSION_ATTRIBUTE, root.getNodeName()));
                    return;
                }
                else
                {
                    if (!isMajorVersionMatch(root))
                    {
                        IFXGVersionHandler newVHandler = FXGVersionHandlerRegistry.getVersionHandler(root.getVersion());

                        if (newVHandler == null)
                        {
                            if  (REJECT_MAJOR_VERSION_MISMATCH)
                            {
                                // Major version of this FXG file is greater than
                                // major version supported by this compiler. Cannot process
                                // the file.
                                problems.add(new FXGInvalidVersionProblem(documentPath, startLine, startColumn, root.getVersion().asString()));
                                return;
                            }
                            else
                            {
                                // Warning: Major version of this FXG file is greater than
                                // major version supported by this compiler.

                                //TODO FXGLOG
                                //FXGLog.getLogger().log(IFXGLogger.WARN, "MajorVersionMismatch", null, getDocumentName(), startLine, startColumn);

                                //use the latest version handler
                                versionHandler = FXGVersionHandlerRegistry.getLatestVersionHandler();
                                if (versionHandler == null)
                                {  
                                    problems.add(new FXGVersionHandlerNotRegisteredProblem(root.getVersion().asDouble()));  
                                    return;
                                }                          
                            }
                        }
                        else
                        {
                            versionHandler = newVHandler;
                        }
                    }
                }
                // Provide reference to the handler for querying version of the
                // current document processed.
                root.setDocumentPath(documentPath);
                root.setVersionGreaterThanCompiler(root.getVersion().greaterThan(versionHandler.getVersion()));
                root.setReservedNodes(versionHandler.getElementNodes(uri));
            }
            else if(root == null)
            {
                // Exception:<Graphic> must be the root node of an FXG document.
                problems.add(new FXGInvalidRootNodeProblem(documentPath, startLine, startColumn));
            }
        }
        finally
        {
            stack.push(node);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.