Package org.apache.flex.compiler.fxg.dom

Examples of org.apache.flex.compiler.fxg.dom.IFXGNode


        startProfile(Operation.GET_SYNTAX_TREE);
       
        getProject().clearScopeCacheForCompilationUnit(this);
       
        final Collection<ICompilerProblem> problems = new ArrayList<ICompilerProblem>();
        IFXGNode fxgroot = null;
        try
        {
            fxgroot = new FXGSAXParser().parse(getRootFileSpecification().createReader(), qname, problems);              
        }
        catch(Exception ex)
View Full Code Here


        ASProjectScope projectScope = getProject().getScope();
       
        try
        {
            FXGSyntaxTreeRequestResult syntaxTreeResult = (FXGSyntaxTreeRequestResult)getSyntaxTreeRequest().get();
            IFXGNode tree = syntaxTreeResult.getRootNode();

            FlexFXG2SWFTranscoder transcoder = new FlexFXG2SWFTranscoder(getProject());          
            transcoder.setResourceResolver(new FXGFileResolver(FilenameUtils.getFullPath(getRootFileSpecification().getPath())));         

            symbolClass = transcoder.transcode(tree,
View Full Code Here

        // Record starting position
        startLine = locator.getLineNumber();
        startColumn = locator.getColumnNumber();

        // Check the current parent
        IFXGNode parent = null;
        if (stack.size() > 0)
        {
            parent = stack.peek();
            if(parent == null)
            {
                //If the parent is invalid, then there is no need to look into the children
                return;
            }
        }

        // Switch to special GroupDefinitionNode for Definition child
        if (isFXGNamespace(uri))
        {
            if (parent instanceof DefinitionNode && FXG_GROUP_ELEMENT.equals(localName))
                localName = FXG_GROUP_DEFINITION_ELEMENT;
        }
       
        // Create a node for this element
        IFXGNode node = createNode(uri, localName);
       
        try
        {  
            if (node == null)
            {
                if (root != null)
                {
                    if (root.isVersionGreaterThanCompiler())
                    {
                        // Warning: Minor version of this FXG file is greater than minor
                        // version supported by this compiler. Log a warning for an
                        // unknown element.

                        //TODO FXGLOG                   
                        //FXGLog.getLogger().log(IFXGLogger.WARN, "UnknownElement", null, documentName, startLine, startColumn);
                        unknownElement = localName;
                    }
                    else
                    {
                        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)
View Full Code Here

            throws SAXException
    {
        if (stack != null && stack.size() > 0 && stack.peek() != null &&
                !inSkippedElement() && (unknownElement == null))
        {
            IFXGNode node = stack.peek();
            String content = new String(ch, start, length);

            if (!(node instanceof IPreserveWhiteSpaceNode))
            {
                content = content.trim();
            }
           
            if (content.length() > 0)
            {
                CDATANode cdata = new CDATANode();
                cdata.content = content;
                assignNodeLocation(cdata);
                node.addChild(cdata, problems);
            }
        }

        // Reset starting position
        startLine = locator.getLineNumber();
View Full Code Here

     * @param localName - the name of the element
     * @return IFXGNode instance if
     */
    protected IFXGNode createNode(String uri, String localName)
    {
        IFXGNode node = null;

        try
        {
            Map<String, Class<? extends IFXGNode>> elementNodes = getElementNodes(uri);
            if (elementNodes != null)
View Full Code Here

            saxFactory.setNamespaceAware(true);
            SAXParser parser = saxFactory.newSAXParser();
            InputSource is = new InputSource(reader);
            parser.parse(is, scanner);

            IFXGNode node = scanner.getRootNode();
            return node;
        }
        catch (IOException ex)
        {
            problems.add(new FXGParserProblem(documentPath, scanner.getStartLine(),
View Full Code Here

TOP

Related Classes of org.apache.flex.compiler.fxg.dom.IFXGNode

Copyright © 2018 www.massapicom. 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.