Package org.apache.flex.compiler.mxml

Examples of org.apache.flex.compiler.mxml.IMXMLTagData


        {
            sw.write('>');
        }
        sw.write(childrenSW.toString());

        IMXMLTagData endTag = tag.findMatchingEndTag();
        if (endTag != null)
        {
            processNode(endTag, sw);
        }
    }
View Full Code Here


     * Get the index of a tag. Grabs the parent tag, and iterates it's children
     * to find out what the index of the tag passed in should be
     */
    private int getIndexOfTag(IMXMLTagData tag)
    {
        IMXMLTagData parent = tag.getParentTag();

        int index = 0;
        for (IMXMLTagData d = parent.getFirstChild(true); d != null; d = d.getNextSibling(true))
        {
            if (d == tag)
                break;
            else if (d.getName().equals(tag.getName()))
                ++index;
View Full Code Here

     */
    private int getIndexOfText(IMXMLTextData text)
    {
        IMXMLUnitData parent = text.getParentUnitData();

        IMXMLTagData parentTag = parent instanceof IMXMLTagData ? (IMXMLTagData)parent : null;
        int index = 0;

        if (parentTag != null)
        {
            for (IMXMLUnitData d = parentTag.getFirstChildUnit(); d != null; d = d.getNextSiblingUnit())
            {
                if (d == text)
                    break;
                else if (d instanceof IMXMLTextData && ((IMXMLTextData)d).getTextType() == TextType.CDATA)
                    ++index;
View Full Code Here

    private boolean isOnlyTextChild(IMXMLUnitData child)
    {
        if (child instanceof IMXMLTextData && ((IMXMLTextData)child).getTextType() == TextType.TEXT)
        {
            IMXMLUnitData p = child.getParentUnitData();
            IMXMLTagData parent = p instanceof IMXMLTagData ? (IMXMLTagData)p : null;
            if (parent != null)
            {
                return parent.getFirstChildUnit() == child && child.getNextSiblingUnit() == null;
            }
        }
        return false;
    }
View Full Code Here

        List<IMXMLNode> children = new ArrayList<IMXMLNode>();
        for (IMXMLUnitData unit : contentUnits)
        {
            if (unit instanceof IMXMLTagData)
            {
                IMXMLTagData tag = (IMXMLTagData)unit;
                // While it is normally illegal to put
                // script tags in an array, a default property
                // tag sequence can contain script nodes which need
                // to be children of the implicit array node to
                // keep the tree in file offset order.
View Full Code Here

        String sourcePath = unit.getSourcePath();
        int start = unit.getAbsoluteStart();
        int end;
        if (unit instanceof IMXMLTagData)
        {
            IMXMLTagData startTag = (IMXMLTagData)unit;
            IMXMLTagData endTag = startTag.findMatchingEndTag();
            end = endTag != null ? endTag.getAbsoluteEnd() : startTag.getAbsoluteEnd();
        }
        else
        {
            end = unit.getAbsoluteEnd();
        }
View Full Code Here

    @Override
    public PrefixMap getCompositePrefixMap()
    {
        MutablePrefixMap compMap = new MutablePrefixMap();
        IMXMLTagData lookingAt = this;
        while (lookingAt != null)
        {
            PrefixMap depth = getParent().getPrefixMapForData(lookingAt);
            if (depth != null)
            {
                compMap.addAll(depth, true);
            }
            lookingAt = lookingAt.getParentTag();
        }
        return compMap;
    }
View Full Code Here

    {
        if (uri == null)
        {
            //walk up our chain to find the correct uri for our namespace.  first one wins
            String prefix = getPrefix();
            IMXMLTagData lookingAt = this;
            while (lookingAt != null)
            {
                PrefixMap depth = getParent().getPrefixMapForData(lookingAt);
                if (depth != null && depth.containsPrefix(prefix))
                {
                    uri = depth.getNamespaceForPrefix(prefix);
                    break;
                }
                lookingAt = lookingAt.getParentTag();
            }
        }
        return uri;
    }
View Full Code Here

    {
        if (isCloseTag() || isEmptyTag())
            return null;
        // Back up to the first surrounding tag that has a different name, and ensure
        // that *it* is balanced, saving our expected return value along the way.
        IMXMLTagData startTag = this;
        while (true)
        {
            IMXMLTagData parentTag = startTag.getContainingTag(startTag.getAbsoluteStart());
            if (parentTag == null)
                break;
            startTag = parentTag;
            if (!parentTag.getName().equals(this.getName()))
            {
                break;
            }
        }
        // Now walk through the tags starting at startTag.  Once we pop ourselves
        // off the tagStack, we've found our candidate result -- but keep going
        // until the stack is null, to ensure that we're balanced out to the
        // surrounding tag.
        IMXMLUnitData[] list = getParent().getUnits();
        FastStack<IMXMLTagData> tagStack = new FastStack<IMXMLTagData>();
        IMXMLTagData result = null;
        for (int i = startTag.getIndex(); i < list.length; i++)
        {
            IMXMLUnitData curUnit = list[i];
            if (curUnit.isTag())
            {
                IMXMLTagData curTag = (IMXMLTagData)curUnit;
                if (curTag.isEmptyTag())
                {
                    // do nothing for empty tags.
                }
                else if (curTag.isOpenTag())
                {
                    tagStack.push(curTag);
                }
                else if (curTag.isCloseTag())
                {
                    if (tagStack.isEmpty())
                    {
                        // document is unbalanced.
                        return null;
                    }
                    IMXMLTagData pop = tagStack.pop();

                    //check the short name in case the namespace is not spelled properly
                    if (!pop.getName().equals(curTag.getName()) && !pop.getShortName().equals(curTag.getShortName()))
                    {
                        // document is unbalanced.
                        return null;
                    }
                    if (pop == this)
View Full Code Here

     */
    public boolean hasEndTag()
    {
        if (isCloseTag() || isEmptyTag())
            return explicitCloseToken;
        IMXMLTagData tagData = findMatchingEndTag();
        return tagData != null && !tagData.isImplicit();
    }
View Full Code Here

TOP

Related Classes of org.apache.flex.compiler.mxml.IMXMLTagData

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.