Package org.w3c.dom

Examples of org.w3c.dom.CDATASection


            NodeList descriptionList = ((Element)parent).getElementsByTagName("description");
            if (descriptionList != null && descriptionList.getLength() != 0)
            {
                fullDesc = descriptionList.item(0).getTextContent();
                Element apiDesc = outputObject.createElement("apiDesc");
                CDATASection cdata = outputObject.createCDATASection(asDocUtil.validateText(fullDesc, "description", fullName));
                apiDesc.appendChild(cdata);
                apiValueDetail.appendChild(apiDesc);
                asDocUtil.convertDescToDITA(apiDesc, oldNewNamesMap);
                shortdesc.setTextContent(asDocUtil.descToShortDesc(fullDesc));
            }

            children = ((Element)parent).getElementsByTagName("example");
            if (children != null)
            {
                for (int ix = 0; ix < children.getLength(); ix++)
                {
                    Element inputExampleElement = (Element)children.item(ix);

                    Element example = outputObject.createElement("example");

                    CDATASection cdata = outputObject.createCDATASection(asDocUtil.validateText(inputExampleElement.getTextContent(), "example", fullName));
                    example.appendChild(cdata);
                    apiValueDetail.appendChild(example);
                    asDocUtil.convertDescToDITA(example, oldNewNamesMap);
                }
            }
View Full Code Here


            errorClassStr = fullThrows.substring(0, nextSpaceIndex);
            throwComment = fullThrows.substring(nextSpaceIndex + 1);
        }
        Element apiException = outputObject.createElement("apiException");
        Element apiDesc = outputObject.createElement("apiDesc");
        CDATASection cdata = outputObject.createCDATASection(asDocUtil.validateText(throwComment, "throws", qualifiedFullName.getFullClassName()));
        apiDesc.appendChild(cdata);
        apiException.appendChild(apiDesc);
        asDocUtil.convertDescToDITA(apiDesc, oldNewNamesMap);

        AsClass errorClass = classTable.get(errorClassStr);
View Full Code Here

                NodeList descriptionList = ((Element)parent).getElementsByTagName("description");
                if (descriptionList != null && descriptionList.getLength() != 0)
                {
                    getterSetterFullDesc = descriptionList.item(0).getTextContent();
                    Element apiDesc = outputObject.createElement("apiDesc");
                    CDATASection cdata = outputObject.createCDATASection(asDocUtil.validateText(getterSetterFullDesc, "description", fullName));
                    apiDesc.appendChild(cdata);
                    apiValueDetail.appendChild(apiDesc);
                    asDocUtil.convertDescToDITA(apiDesc, oldNewNamesMap);
                    shortdesc.setTextContent(asDocUtil.descToShortDesc(getterSetterFullDesc));
                }

                if (isBindable)
                {
                    apiProperty.setAttribute("isBindable", "true");
                }

                processVersions((Element)parent, apiValue);

                if (myClass.getFieldGetSet().get(name) == null)
                {
                    myClass.getFieldGetSet().put(name, 0);
                }

                // skip method tagged with @private, even if they are public
                NodeList privateChilds = ((Element)parent).getElementsByTagName("private");
                if ((privateChilds != null && privateChilds.getLength() != 0) && !includePrivate)
                {
                    if (myClass.getPrivateGetSet().get(name) == null)
                    {
                        myClass.getPrivateGetSet().put(name, 0);
                    }

                    if (qualifiedFullName.getGetterSetter().equals("Get"))
                    {
                        if (myClass.getPrivateGetSet().get(name) <= 1)
                        {
                            myClass.getPrivateGetSet().put(name, 1);
                            myClass.getFieldGetSet().put(name, 1);
                        }
                        else
                        {
                            myClass.getPrivateGetSet().put(name, myClass.getPrivateGetSet().get(name) + 1);
                            myClass.getFieldGetSet().put(name, myClass.getFieldGetSet().get(name) + 1);
                        }
                    }
                    else
                    {
                        myClass.getPrivateGetSet().put(name, myClass.getPrivateGetSet().get(name) + 2);

                        myClass.getFieldGetSet().put(name, myClass.getFieldGetSet().get(name) + 2);
                    }

                    return;
                }

                AsClass fieldTypeClass = null;
                String type = null;

                if (qualifiedFullName.getGetterSetter().equals("Get"))
                {
                    type = ((Element)parent).getAttribute("result_type");
                    fieldTypeClass = classTable.get(type);

                    if (myClass.getFieldGetSet().get(name) <= 1)
                    {
                        myClass.getFieldGetSet().put(name, 1);
                    }
                    else
                    {
                        myClass.getFieldGetSet().put(name, myClass.getFieldGetSet().get(name) + 1);
                    }
                }
                else
                {
                    type = ((Element)parent).getAttribute("param_types");
                    fieldTypeClass = classTable.get(type);

                    myClass.getFieldGetSet().put(name, myClass.getFieldGetSet().get(name) + 2);
                }

                Element apiValueAccess = outputObject.createElement("apiValueAccess");
                apiValueDef.appendChild(apiValueAccess);

                if (fieldTypeClass != null)
                {
                    Element apiValueClassifier = outputObject.createElement("apiValueClassifier");
                    apiValueClassifier.setTextContent(fieldTypeClass.getFullName());
                    apiValueDef.appendChild(apiValueClassifier);
                }
                else
                {
                    Element apiType = outputObject.createElement("apiType");
                    if (type.equals("*"))
                    {
                        apiType.setAttribute("value", "any");
                    }
                    else
                    {
                        apiType.setAttribute("value", type);
                    }
                    apiValueDef.appendChild(apiType);
                }

                NodeList exampleList = ((Element)parent).getElementsByTagName("example");
                if (exampleList != null)
                {
                    for (int ix = 0; ix < exampleList.getLength(); ix++)
                    {
                        Element inputExampleElement = (Element)exampleList.item(ix);

                        Element example = outputObject.createElement("example");

                        CDATASection cdata = outputObject.createCDATASection(asDocUtil.validateText(inputExampleElement.getTextContent(), "example", fullName));
                        example.appendChild(cdata);
                        apiValueDetail.appendChild(example);
                        asDocUtil.convertDescToDITA(example, oldNewNamesMap);
                    }
                }

                NodeList throwsList = ((Element)parent).getElementsByTagName("throws");
                if (throwsList != null && throwsList.getLength() != 0)
                {
                    for (int ix = 0; ix < throwsList.getLength(); ix++)
                    {
                        Element throwsElement = (Element)throwsList.item(ix);
                        apiValueDef.appendChild(createCanThrow(throwsElement, qualifiedFullName));
                    }
                }

                processCustoms((Element)parent, apiValue, false, "", "", "");

                if (myClass != null)
                {
                    if (myClass.getFieldCount() == 0)
                    {
                        Element fields = outputObject.createElement("fields");
                        fields.appendChild(apiValue);
                        myClass.setFields(fields);

                        myClass.setFieldCount(myClass.getFieldCount() + 1);
                    }
                    else
                    {
                        Element temp = myClass.getFields();
                        NodeList apiValueList = temp.getElementsByTagName("apiValue");
                        int numChildren = apiValueList.getLength();
                        Element foundField = null;

                        for (int ix = 0; ix < numChildren; ix++)
                        {
                            if (((Element)apiValueList.item(ix)).getElementsByTagName("apiName").item(0).getTextContent().equals(apiName.getTextContent()))
                            {
                                foundField = (Element)apiValueList.item(ix);
                                break;
                            }
                        }

                        if (foundField == null)
                        {
                            myClass.getFields().appendChild(apiValue);
                            myClass.setFieldCount(myClass.getFieldCount() + 1);

                        }
                        else
                        {
                            boolean replaceFlag = false;
                            if (getterSetterFullDesc != null && getterSetterFullDesc.trim().length() != 0)
                            {
                                Element foundApiDesc = null;
                                Element foundApiValueDetail = asDocUtil.getElementByTagName(foundField, "apiValueDetail");

                                if (foundApiValueDetail != null)
                                {
                                    foundApiDesc = asDocUtil.getElementByTagName(foundApiValueDetail, "apiDesc");
                                    if (foundApiDesc != null)
                                    {
                                        if (foundApiDesc.getTextContent().trim().length() == 0)
                                        {
                                            replaceFlag = true;
                                        }
                                    }
                                    else
                                    {
                                        replaceFlag = true;
                                    }

                                    if (replaceFlag)
                                    {
                                        temp.replaceChild(apiValue, foundField);
                                    }
                                }
                            }

                            if (!replaceFlag)
                            {
                                Element foundApiValueDef = null;
                                Element foundApiValueDetail = null;

                                Element apiType = asDocUtil.getElementByTagName(apiValueDef, "apiType");
                                if (apiType != null)
                                {
                                    foundApiValueDetail = asDocUtil.getElementByTagName(foundField, "apiValueDetail");
                                    if (foundApiValueDetail != null)
                                    {
                                        foundApiValueDef = asDocUtil.getElementByTagName(foundApiValueDetail, "apiValueDef");
                                        if (foundApiValueDef == null)
                                        {
                                            foundApiValueDef = outputObject.createElement("apiValueDef");
                                            foundApiValueDetail.appendChild(foundApiValueDef);
                                        }
                                    }
                                    else
                                    {
                                        foundApiValueDef = outputObject.createElement("apiValueDef");
                                        foundApiValueDetail = outputObject.createElement("apiValueDetail");
                                        foundApiValueDetail.appendChild(foundApiValueDef);

                                        foundField.appendChild(foundApiValueDetail);
                                    }

                                    if (asDocUtil.getElementByTagName(foundApiValueDef, "apiType") == null)
                                    {
                                        foundApiValueDef.appendChild(apiType);
                                    }
                                }
                                else
                                {
                                    Element apiValueClassifier = asDocUtil.getElementByTagName(apiValueDef, "apiValueClassifier");
                                    if (apiValueClassifier != null)
                                    {
                                        foundApiValueDetail = asDocUtil.getElementByTagName(foundField, "apiValueDetail");
                                        if (foundApiValueDetail != null)
                                        {
                                            foundApiValueDef = asDocUtil.getElementByTagName(foundApiValueDetail, "apiValueDef");
                                            if (foundApiValueDef == null)
                                            {
                                                foundApiValueDef = outputObject.createElement("apiValueDef");
                                                foundApiValueDetail.appendChild(foundApiValueDef);
                                            }
                                        }
                                        else
                                        {
                                            foundApiValueDef = outputObject.createElement("apiValueDef");
                                            foundApiValueDetail = outputObject.createElement("apiValueDetail");
                                            foundApiValueDetail.appendChild(foundApiValueDef);

                                            foundField.appendChild(foundApiValueDetail);
                                        }

                                        if (asDocUtil.getElementByTagName(foundApiValueDef, "apiValueClassifier") == null)
                                        {
                                            foundApiValueDef.appendChild(apiValueClassifier);
                                        }
                                    }
                                    else
                                    {
                                        if (verbose)
                                        {
                                            System.out.println("Error : No type definition for " + name);
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
            else if (myClass != null)
            {
                // skip method tagged with @private, even if they are public
                NodeList privateChilds = ((Element)parent).getElementsByTagName("private");
                if ((privateChilds != null && privateChilds.getLength() != 0) && !includePrivate)
                {
                    return;
                }

                Element apiOperation = null;
                Element detailNode = null;
                Element defNode = null;
                Element shortdesc = null;
                Element prolog = null;
                boolean isConstructor = false;

                if (qualifiedFullName.getClassNames() != null && qualifiedFullName.getClassNames().size() != 0 && name.equals(qualifiedFullName.getClassNames().get(qualifiedFullName.getClassNames().size() - 1)))
                {

                    apiOperation = outputObject.createElement("apiConstructor");
                    apiOperation.setAttribute("id", asDocUtil.formatId(fullName));

                    Element apiName = outputObject.createElement("apiName");
                    apiName.setTextContent(name);
                    apiOperation.appendChild(apiName);

                    shortdesc = outputObject.createElement("shortdesc");
                    apiOperation.appendChild(shortdesc);

                    prolog = outputObject.createElement("prolog");
                    apiOperation.appendChild(prolog);

                    detailNode = outputObject.createElement("apiConstructorDetail");
                    defNode = outputObject.createElement("apiConstructorDef");
                    detailNode.appendChild(defNode);

                    Element apiAccess = outputObject.createElement("apiAccess");
                    apiAccess.setAttribute("value", qualifiedFullName.getMethodNameSpace());
                    defNode.appendChild(apiAccess);

                    apiOperation.appendChild(detailNode);

                    isConstructor = true;
                }
                else
                {
                    boolean isFinal = Boolean.parseBoolean(((Element)parent).getAttribute("isFinal"));
                    boolean isOverride = Boolean.parseBoolean(((Element)parent).getAttribute("isOverride"));
                    boolean isStatic = Boolean.parseBoolean(((Element)parent).getAttribute("isStatic"));

                    if (isOverride)
                    {
                        myClass.getMethodOverrideTable().put(name, "true");
                    }

                    apiOperation = outputObject.createElement("apiOperation");
                    apiOperation.setAttribute("id", asDocUtil.formatId(fullName));

                    Element apiName = outputObject.createElement("apiName");
                    apiName.setTextContent(name);
                    apiOperation.appendChild(apiName);

                    shortdesc = outputObject.createElement("shortdesc");
                    apiOperation.appendChild(shortdesc);

                    prolog = outputObject.createElement("prolog");
                    apiOperation.appendChild(prolog);

                    detailNode = outputObject.createElement("apiOperationDetail");
                    defNode = outputObject.createElement("apiOperationDef");
                    detailNode.appendChild(defNode);

                    Element apiAccess = outputObject.createElement("apiAccess");
                    apiAccess.setAttribute("value", qualifiedFullName.getMethodNameSpace());
                    defNode.appendChild(apiAccess);

                    if (isFinal)
                    {
                        Element apiFinal = outputObject.createElement("apiFinal");
                        defNode.appendChild(apiFinal);
                    }

                    if (isStatic)
                    {
                        Element apiStatic = outputObject.createElement("apiStatic");
                        defNode.appendChild(apiStatic);
                    }

                    if (isOverride)
                    {
                        Element apiIsOverride = outputObject.createElement("apiIsOverride");
                        defNode.appendChild(apiIsOverride);
                    }

                    apiOperation.appendChild(detailNode);
                }

                NodeList descriptionList = ((Element)parent).getElementsByTagName("description");
                if (descriptionList != null && descriptionList.getLength() != 0)
                {
                    String fullDesc = descriptionList.item(0).getTextContent();

                    // if constructor for a mxml file - lets add default description of Constructor
                    if (isConstructor && fullDesc.length() == 0 && myClass.getSourceFile().toLowerCase().endsWith(".mxml"))
                    {
                        fullDesc = "Constructor.";
                    }

                    Element apiDesc = outputObject.createElement("apiDesc");
                    CDATASection cdata = outputObject.createCDATASection(asDocUtil.validateText(fullDesc, "description", fullName));
                    apiDesc.appendChild(cdata);
                    detailNode.appendChild(apiDesc);
                    asDocUtil.convertDescToDITA(apiDesc, oldNewNamesMap);
                    shortdesc.setTextContent(asDocUtil.descToShortDesc(fullDesc));
                }

                NodeList exampleList = ((Element)parent).getElementsByTagName("example");
                if (exampleList != null)
                {
                    for (int ix = 0; ix < exampleList.getLength(); ix++)
                    {
                        Element inputExampleElement = (Element)exampleList.item(ix);

                        Element example = outputObject.createElement("example");

                        CDATASection cdata = outputObject.createCDATASection(asDocUtil.validateText(inputExampleElement.getTextContent(), "example", fullName));
                        example.appendChild(cdata);
                        detailNode.appendChild(example);
                        asDocUtil.convertDescToDITA(example, oldNewNamesMap);
                    }
                }

                NodeList throwsList = ((Element)parent).getElementsByTagName("throws");
                if (throwsList != null && throwsList.getLength() != 0)
                {
                    for (int ix = 0; ix < throwsList.getLength(); ix++)
                    {
                        Element throwsElement = (Element)throwsList.item(ix);
                        defNode.appendChild(createCanThrow(throwsElement, myClass.getDecompName()));
                    }
                }

                NodeList authorList = ((Element)parent).getElementsByTagName("author");
                if (authorList != null && authorList.getLength() != 0)
                {
                    String author = authorList.item(0).getTextContent();
                    if (!author.equals(""))
                    {
                        Element authorElement = outputObject.createElement("author");
                        authorElement.setTextContent(author);
                        prolog.appendChild(authorElement);
                    }
                }

                processVersions((Element)parent, apiOperation);

                if (!isConstructor)
                {
                    NodeList returnList = ((Element)parent).getElementsByTagName("return");
                    Element apiReturn = outputObject.createElement("apiReturn");
                    if (returnList != null && returnList.getLength() != 0)
                    {
                        Element apiDesc = outputObject.createElement("apiDesc");

                        CDATASection cdata = outputObject.createCDATASection(asDocUtil.validateText(returnList.item(0).getTextContent(), "return", fullName));
                        apiDesc.appendChild(cdata);
                        apiReturn.appendChild(apiDesc);

                        defNode.appendChild(apiReturn);
                        asDocUtil.convertDescToDITA(apiDesc, oldNewNamesMap);
                    }
                    else
                    {
                        defNode.appendChild(apiReturn);
                    }

                    String returnType = ((Element)parent).getAttribute("result_type");
                    AsClass returnClass = classTable.get(returnType);
                    if (returnClass != null)
                    {
                        Element apiOperationClassifier = outputObject.createElement("apiOperationClassifier");
                        apiOperationClassifier.setTextContent(returnClass.getFullName());
                        apiReturn.appendChild(apiOperationClassifier);
                    }
                    else if (returnType.equals("*"))
                    {
                        Element apiType = outputObject.createElement("apiType");
                        apiType.setAttribute("value", "any");
                        apiReturn.appendChild(apiType);
                    }
                    else
                    {
                        Element apiType = outputObject.createElement("apiType");
                        apiType.setAttribute("value", returnType);
                        apiReturn.appendChild(apiType);
                    }
                }

                String paramNames = ((Element)parent).getAttribute("param_names");
                String paramTypes = ((Element)parent).getAttribute("param_types");
                String paramDefaults = ((Element)parent).getAttribute("param_defaults");

                processCustoms((Element)parent, apiOperation, true, paramNames, paramTypes, paramDefaults, myClass);

                NodeList eventList = ((Element)parent).getElementsByTagName("event");
                if (eventList != null && eventList.getLength() != 0)
                {
                    for (int ix = 0; ix < eventList.getLength(); ix++)
                    {
                        String fullEventStr = eventList.item(ix).getTextContent();
                        String eventCommentStr = "";
                        int nextSpaceIndex = fullEventStr.indexOf(" ");
                        String eventClassStr = null;
                        if (nextSpaceIndex == -1)
                        {
                            eventClassStr = "Event";
                            eventCommentStr = fullEventStr;
                            nextSpaceIndex = fullEventStr.length() - 1;
                        }
                        String eventName = fullEventStr.substring(0, nextSpaceIndex);
                        /*
                         * var apiEvent = <apiEvent
                         * id={formatId(method.@fullname)} generated="true">
                         * <apiItemName>{eventName}</apiItemName>
                         * <apiEventDetail/> </apiEvent>;
                         */
                        if (eventClassStr == null)
                        {
                            int lastSpaceIndex = nextSpaceIndex + 1;
                            nextSpaceIndex = fullEventStr.indexOf(" ", lastSpaceIndex);
                            if (nextSpaceIndex == -1)
                            {
                                eventClassStr = "Event";
                                eventCommentStr = fullEventStr.substring(lastSpaceIndex);
                            }
                            else
                            {
                                eventClassStr = fullEventStr.substring(lastSpaceIndex, nextSpaceIndex);
                                eventCommentStr = fullEventStr.substring(nextSpaceIndex + 1);
                            }
                        }

                        if (eventClassStr != null && eventClassStr.indexOf(':') == -1 && eventClassStr.indexOf('.') != -1)
                        {
                            int periodIndex = eventClassStr.lastIndexOf('.');
                            eventClassStr = eventClassStr.substring(0, periodIndex) + ':' + eventClassStr.substring(periodIndex + 1);
                        }

                        AsClass eventClass = classTable.get(eventClassStr);

                        if (eventClass == null)
                        {
                            if (verbose)
                            {
                                System.out.println("   Can not resolve event name: " + eventClassStr + " looking in flash.events");
                            }
                            eventClass = classTable.get("flash.events:" + eventClassStr);

                            if (eventClass == null)
                            {
                                if (verbose)
                                {
                                    System.out.println("   Can not resolve event name: " + eventClassStr + " looking in air.update.events");
                                }
                                eventClass = classTable.get("air.update.events:" + eventClassStr);
                            }
                        }

                        String eventId = asDocUtil.formatId(fullName) + "_" + eventName;
                        String eventComment = asDocUtil.validateText(eventCommentStr, "event", fullName);

                        Element adobeApiEvent = outputObject.createElement("adobeApiEvent");
                        adobeApiEvent.setAttribute("id", eventId);
                        Element apiName2 = outputObject.createElement("apiName");
                        apiName2.setTextContent(eventName);
                        adobeApiEvent.appendChild(apiName2);

                        adobeApiEvent.appendChild(outputObject.createElement("prolog"));
                        Element adobeApiEventDetail = outputObject.createElement("adobeApiEventDetail");
                        adobeApiEvent.appendChild(adobeApiEventDetail);

                        Element adobeApiEventDef = outputObject.createElement("adobeApiEventDef");
                        adobeApiEventDetail.appendChild(adobeApiEventDef);

                        Element apiDesc = outputObject.createElement("apiDesc");
                        CDATASection cdata = outputObject.createCDATASection(eventComment);
                        apiDesc.appendChild(cdata);
                        adobeApiEventDetail.appendChild(apiDesc);

                        if (eventClass != null)
                        {
View Full Code Here

                {
                    Element descriptionElement = (Element)descriptionList.item(0);
                    String descriptionText = descriptionElement.getTextContent();

                    Element newDescriptionElement = outputObject.createElement("description");
                    CDATASection cdata = outputObject.createCDATASection(asDocUtil.validateText(descriptionText, "description", fullName));
                    newDescriptionElement.appendChild(cdata);

                    newStyleElement.replaceChild(newDescriptionElement, descriptionElement);
                    asDocUtil.convertDescToDITA(newDescriptionElement, oldNewNamesMap);
                }

                childrenOfStyle = newStyleElement.getElementsByTagName("see");
                if (childrenOfStyle != null && childrenOfStyle.getLength() != 0)
                {
                    Element relatedLinks = outputObject.createElement("related-links");
                    for (int ix = 0; ix < childrenOfStyle.getLength(); ix++)
                    {
                        Element seeElement = (Element)childrenOfStyle.item(ix);
                        relatedLinks.appendChild(processSeeTag(fullName, seeElement.getTextContent()));
                    }
                    newStyleElement.appendChild(relatedLinks);

                    for (int ix = 0; ix < childrenOfStyle.getLength(); ix++)
                    {
                        newStyleElement.removeChild(childrenOfStyle.item(ix));
                    }

                }

                childrenOfStyle = newStyleElement.getElementsByTagName("copy");
                if (childrenOfStyle != null && childrenOfStyle.getLength() != 0)
                {
                    String text = childrenOfStyle.item(0).getTextContent();
                    text = text.replaceAll("\\s+", "");

                    descriptionList = newStyleElement.getElementsByTagName("description");
                    Element descriptionElement = null;
                    if (descriptionList != null && descriptionList.getLength() != 0)
                    {
                        descriptionElement = (Element)descriptionList.item(0);
                    }
                    else
                    {
                        descriptionElement = outputObject.createElement("description");
                        newStyleElement.appendChild(descriptionElement);
                    }
                    descriptionElement.setAttribute("conref", text);

                    newStyleElement.removeChild(childrenOfStyle.item(0));
                }

                childrenOfStyle = newStyleElement.getElementsByTagName("playerversion");
                if (childrenOfStyle != null && childrenOfStyle.getLength() != 0)
                {
                    String playerversion = childrenOfStyle.item(0).getTextContent();
                    playerversion = playerversion.replaceAll("\\s+", "");

                    newStyleElement.setAttribute("playerVersion", playerversion);
                    newStyleElement.removeChild(childrenOfStyle.item(0));
                }

                Element stylesElement = null;
                Element asMetadata = null;

                if (prolog != null)
                {
                    asMetadata = asDocUtil.getElementByTagName(prolog, "asMetadata");

                    if (asMetadata != null)
                    {
                        stylesElement = asDocUtil.getElementByTagName(asMetadata, "styles");

                        if (stylesElement == null)
                        {
                            stylesElement = outputObject.createElement("styles");
                            asMetadata.appendChild(stylesElement);
                        }
                    }
                    else
                    {
                        stylesElement = outputObject.createElement("styles");
                        asMetadata = outputObject.createElement("asMetadata");

                        asMetadata.appendChild(stylesElement);
                        prolog.appendChild(asMetadata);

                    }
                }
                else
                {
                    stylesElement = outputObject.createElement("styles");
                    asMetadata = outputObject.createElement("asMetadata");
                    asMetadata.appendChild(stylesElement);
                    prolog = outputObject.createElement("prolog");
                    prolog.appendChild(asMetadata);
                    myClass.getNode().appendChild(prolog);
                }

                newStyleElement = (Element)outputObject.importNode(newStyleElement, true);
                stylesElement.appendChild(newStyleElement);
            }

            Element effectElement = asDocUtil.getElementByTagName((Element)parent, "Effect");
            if (effectElement != null)
            {
                // skip metadata if private
                NodeList childrenOfEffect = effectElement.getElementsByTagName("private");
                if ((childrenOfEffect != null && childrenOfEffect.getLength() != 0) && !includePrivate)
                {
                    return;
                }

                Element newEffectElement = asDocUtil.renameElementAndImportChild(effectElement, outputObject, "effect");

                String name = newEffectElement.getAttribute("name");
                String fullName = newEffectElement.getAttribute("owner");

                AsClass myClass = classTable.get(fullName);

                if (myClass == null)
                {
                    if (verbose)
                    {
                        System.out.println("   Can not resolve effect class name: " + fullName);
                    }
                    return;
                }

                Element node = myClass.getNode();

                // we need to get to the Exclude Node. it should be under
                // prolog.asMetadata
                Element prolog = asDocUtil.getElementByTagName(node, "prolog");
                if (prolog != null)
                {
                    Element asMetadata = asDocUtil.getElementByTagName(prolog, "asMetadata");

                    if (asMetadata != null)
                    {
                        HashMap<String, String> attributes = new HashMap<String, String>();
                        attributes.put("kind", "effect");
                        attributes.put("name", name);
                       
                        Element excludeElement = asDocUtil.getElementByTagNameAndMatchingAttributes(asMetadata, "Exclude", attributes.entrySet());
                        if (excludeElement != null)
                        {
                            if (verbose)
                            {
                                System.out.println("Excluding effect " + name + " from " + myClass.getName());
                            }
                            return;
                        }
                    }
                }

                asDocUtil.processCustoms(newEffectElement, outputObject);

                childrenOfEffect = newEffectElement.getElementsByTagName("default");
                if (childrenOfEffect != null && childrenOfEffect.getLength() != 0)
                {
                    Element defaultElement = (Element)childrenOfEffect.item(0);
                    String defaultText = defaultElement.getTextContent();

                    Element newDefaultElement = outputObject.createElement("default");
                    newDefaultElement.setTextContent(defaultText);

                    newEffectElement.replaceChild(newDefaultElement, defaultElement);
                }

                NodeList descriptionList = newEffectElement.getElementsByTagName("description");
                if (descriptionList != null && descriptionList.getLength() != 0)
                {
                    Element descriptionElement = (Element)descriptionList.item(0);
                    String descriptionText = descriptionElement.getTextContent();

                    Element newDescriptionElement = outputObject.createElement("description");
                    CDATASection cdata = outputObject.createCDATASection(asDocUtil.validateText(descriptionText, "description", fullName));
                    newDescriptionElement.appendChild(cdata);

                    newEffectElement.replaceChild(newDescriptionElement, descriptionElement);
                    asDocUtil.convertDescToDITA(newDescriptionElement, oldNewNamesMap);
                }

                childrenOfEffect = newEffectElement.getElementsByTagName("copy");
                if (childrenOfEffect != null && childrenOfEffect.getLength() != 0)
                {
                    String text = childrenOfEffect.item(0).getTextContent();
                    text = text.replaceAll("[\\n\\s]", "");

                    descriptionList = newEffectElement.getElementsByTagName("description");
                    Element descriptionElement = null;
                    if (descriptionList != null && descriptionList.getLength() != 0)
                    {
                        descriptionElement = (Element)descriptionList.item(0);
                    }
                    else
                    {
                        descriptionElement = outputObject.createElement("description");
                        newEffectElement.appendChild(descriptionElement);
                    }
                    descriptionElement.setAttribute("conref", text);

                    newEffectElement.removeChild(childrenOfEffect.item(0));
                }

                Element effectsElement = null;
                Element asMetadata = null;

                if (prolog != null)
                {
                    asMetadata = asDocUtil.getElementByTagName(prolog, "asMetadata");

                    if (asMetadata != null)
                    {
                        effectsElement = asDocUtil.getElementByTagName(asMetadata, "effects");

                        if (effectsElement == null)
                        {
                            effectsElement = outputObject.createElement("effects");
                            asMetadata.appendChild(effectsElement);
                        }
                    }
                    else
                    {
                        effectsElement = outputObject.createElement("effects");
                        asMetadata = outputObject.createElement("asMetadata");

                        asMetadata.appendChild(effectsElement);
                        prolog.appendChild(asMetadata);

                    }
                }
                else
                {
                    effectsElement = outputObject.createElement("effects");
                    asMetadata = outputObject.createElement("asMetadata");
                    asMetadata.appendChild(effectsElement);
                    prolog = outputObject.createElement("prolog");
                    prolog.appendChild(asMetadata);
                    myClass.getNode().appendChild(prolog);
                }

                newEffectElement = (Element)outputObject.importNode(newEffectElement, true);
                effectsElement.appendChild(newEffectElement);
            }

            Element eventElement = asDocUtil.getElementByTagName((Element)parent, "Event");
            if (eventElement != null)
            {
                // skip metadata if private
                NodeList childrenOfEvent = eventElement.getElementsByTagName("private");
                if ((childrenOfEvent != null && childrenOfEvent.getLength() != 0) && !includePrivate)
                {
                    return;
                }

                String name = eventElement.getAttribute("name");
                String fullName = eventElement.getAttribute("owner");

                AsClass myClass = classTable.get(fullName);

                if (myClass == null)
                {
                    if (verbose)
                    {
                        System.out.println("   Can not resolve event  class name: " + fullName);
                    }
                    return;
                }

                Element node = myClass.getNode();

                // we need to get to the Exclude Node. it should be under
                // prolog.asMetadata
                Element prolog = asDocUtil.getElementByTagName(node, "prolog");
                if (prolog != null)
                {
                    Element asMetadata = asDocUtil.getElementByTagName(prolog, "asMetadata");

                    if (asMetadata != null)
                    {
                        HashMap<String, String> attributes = new HashMap<String, String>();
                        attributes.put("kind", "event");
                        attributes.put("name", name);
                       
                        Element excludeElement = asDocUtil.getElementByTagNameAndMatchingAttributes(asMetadata, "Exclude", attributes.entrySet());
                        if (excludeElement != null)
                        {
                            if (verbose)
                            {
                                System.out.println("Excluding event " + name + " from " + myClass.getName());
                            }
                            return;
                        }
                    }
                }

                String eventType = null;
                childrenOfEvent = ((Element)parent).getElementsByTagName("eventType");
                if (childrenOfEvent != null && childrenOfEvent.getLength() != 0)
                {
                    eventType = childrenOfEvent.item(0).getTextContent().replaceAll("\\s+", "");
                }

                String eventObjectType = eventElement.getAttribute("type");
                String fullDesc = "";

                childrenOfEvent = eventElement.getElementsByTagName("description");
                if (childrenOfEvent != null && childrenOfEvent.getLength() != 0)
                {
                    Element descriptionElement = (Element)childrenOfEvent.item(0);
                    descriptionElement.normalize();

                    fullDesc = descriptionElement.getTextContent();
                }

                String eventId = null;

                if (eventType != null)
                {
                    eventId = asDocUtil.formatId(myClass.getFullName()) + "_" + asDocUtil.formatId(eventType) + "_" + name;
                }
                else
                {
                    eventId = asDocUtil.formatId(myClass.getFullName()) + "_" + asDocUtil.formatId(eventObjectType) + "_" + name;
                }

                Element adobeApiEvent = outputObject.createElement("adobeApiEvent");
                adobeApiEvent.setAttribute("id", eventId);
                Element apiName = outputObject.createElement("apiName");
                apiName.setTextContent(name);
                adobeApiEvent.appendChild(apiName);

                Element shortdesc = outputObject.createElement("shortdesc");
                adobeApiEvent.appendChild(shortdesc);
                adobeApiEvent.appendChild(outputObject.createElement("prolog"));
                Element adobeApiEventDetail = outputObject.createElement("adobeApiEventDetail");
                adobeApiEvent.appendChild(adobeApiEventDetail);

                Element adobeApiEventDef = outputObject.createElement("adobeApiEventDef");
                adobeApiEventDetail.appendChild(adobeApiEventDef);

                if (eventType != null)
                {
                    Element apiEventType = outputObject.createElement("apiEventType");
                    apiEventType.setTextContent(eventType);
                    adobeApiEventDef.appendChild(apiEventType);
                }

                if (eventObjectType != null)
                {
                    Element adobeApiEventClassifier = outputObject.createElement("adobeApiEventClassifier");
                    adobeApiEventClassifier.setTextContent(eventObjectType);
                    adobeApiEventDef.appendChild(adobeApiEventClassifier);
                }

                Element apiGeneratedEvent = outputObject.createElement("apiGeneratedEvent");
                adobeApiEventDef.appendChild(apiGeneratedEvent);

                Element apiDesc = outputObject.createElement("apiDesc");
                CDATASection cdata = outputObject.createCDATASection(asDocUtil.validateText(fullDesc, "description", fullName));
                apiDesc.appendChild(cdata);
                adobeApiEventDetail.appendChild(apiDesc);

                asDocUtil.convertDescToDITA(apiDesc, oldNewNamesMap);
                shortdesc.setTextContent(asDocUtil.descToShortDesc(fullDesc));

                eventElement.setAttribute("fullname", fullName);

                processVersions(eventElement, adobeApiEvent);

                processCustoms(eventElement, adobeApiEvent, false, "", "", "");

                Element deprecatedNode = null;

                if (!eventElement.getAttribute("deprecatedMessage").equals(""))
                {
                    deprecatedNode = outputObject.createElement("apiDeprecated");
                    Element apiDesc2 = outputObject.createElement("apiDesc");
                    CDATASection cdata2 = outputObject.createCDATASection(eventElement.getAttribute("deprecatedMessage"));
                    apiDesc2.appendChild(cdata2);
                    deprecatedNode.appendChild(apiDesc2);
                    asDocUtil.convertDescToDITA(apiDesc2, oldNewNamesMap);
                }
                else if (!eventElement.getAttribute("deprecatedReplacement").equals(""))
                {
                    deprecatedNode = outputObject.createElement("apiDeprecated");
                    deprecatedNode.setAttribute("replacement", eventElement.getAttribute("deprecatedReplacement"));
                }

                if (deprecatedNode != null)
                {
                    if (!eventElement.getAttribute("deprecatedSince").equals(""))
                    {
                        deprecatedNode.setAttribute("sinceVersion", eventElement.getAttribute("deprecatedSince"));
                    }
                    adobeApiEventDef.appendChild(deprecatedNode);
                }

                childrenOfEvent = eventElement.getElementsByTagName("example");
                if (childrenOfEvent != null)
                {
                    for (int ix = 0; ix < childrenOfEvent.getLength(); ix++)
                    {
                        Element inputExampleElement = (Element)childrenOfEvent.item(ix);

                        Element example = outputObject.createElement("example");

                        CDATASection cdata2 = outputObject.createCDATASection(asDocUtil.validateText(inputExampleElement.getTextContent(), "example", fullName));
                        example.appendChild(cdata2);
                        adobeApiEvent.appendChild(example);
                        asDocUtil.convertDescToDITA(example, oldNewNamesMap);
                    }
                }

                if (myClass != null && eventElement != null)
                {
                    myClass.getNode().appendChild(adobeApiEvent);
                    if (verbose)
                    {
                        System.out.println("event handling for metadata added event " + name + " to class " + fullName);
                    }
                }
                else
                {
                    if (verbose)
                    {
                        System.out.println("*** Internal error: can't find class for event: " + fullName);
                    }
                }
            }

            Element bindableElement = asDocUtil.getElementByTagName((Element)parent, "Bindable");
            if (bindableElement != null)
            {
                // skip metadata if private
                NodeList childrenOfBindable = bindableElement.getElementsByTagName("private");
                if ((childrenOfBindable != null && childrenOfBindable.getLength() != 0) && !includePrivate)
                {
                    return;
                }

                String fullName = bindableElement.getAttribute("owner");
                if (verbose)
                {
                    System.out.println(" processing bindable " + fullName);
                }
               
                String bindableEventName = bindableElement.getAttribute("name");

                AsClass myClass = classTable.get(fullName);

                if (myClass == null)
                {
                    QualifiedNameInfo qualifiedFullName = decomposeFullMethodOrFieldName(fullName);
                    myClass = classTable.get(qualifiedFullName.getFullClassName());
                    boolean found = false;
                    if (myClass != null && myClass.getFields() != null)
                    {
                        NodeList apiValueList = myClass.getFields().getChildNodes();

                        for (int ix = 0; ix < apiValueList.getLength(); ix++)
                        {
                            Element apiValueElement = (Element)apiValueList.item(ix);
                            if (apiValueElement.getAttribute("id").equals(asDocUtil.formatId(fullName)))
                            {

                                Element apiValueDetail = null;
                                Element apiValueDef = null;
                                Element apiProperty = null;

                                NodeList apiValueDetailList = apiValueElement.getElementsByTagName("apiValueDetail");
                                if (apiValueDetailList != null && apiValueDetailList.getLength() != 0)
                                {
                                    apiValueDetail = (Element)apiValueDetailList.item(0);

                                    NodeList apiValueDefList = apiValueDetail.getElementsByTagName("apiValueDef");
                                    if (apiValueDefList != null && apiValueDefList.getLength() != 0)
                                    {
                                        apiValueDef = (Element)apiValueDefList.item(0);

                                        NodeList apiPropertyList = apiValueDef.getElementsByTagName("apiProperty");
                                        if (apiPropertyList != null && apiPropertyList.getLength() != 0)
                                        {
                                            apiProperty = (Element)apiPropertyList.item(0);
                                            if (apiProperty.getAttribute("isBindable").equals("") || !apiProperty.getAttribute("isBindable").equals("true"))
                                            {
                                                apiProperty.setAttribute("isBindable", "true");
                                               
                                                if (!bindableEventName.equals(""))
                                                {
                                                    apiProperty.setAttribute("name", bindableEventName)
                                                }
                                               
                                                found = true;
                                                break;
                                            }
                                        }
                                        else
                                        {
                                            apiProperty = outputObject.createElement("apiProperty");
                                            apiProperty.setAttribute("isBindable", "true");
                                           
                                            if (!bindableEventName.equals(""))
                                            {
                                                apiProperty.setAttribute("name", bindableEventName)
                                            }

                                            apiValueDef.appendChild(apiProperty);
                                            found = true;
                                            break;
                                        }
                                    }
                                    else
                                    {
                                        apiProperty = outputObject.createElement("apiProperty");
                                        apiProperty.setAttribute("isBindable", "true");
                                       
                                        if (!bindableEventName.equals(""))
                                        {
                                            apiProperty.setAttribute("name", bindableEventName)
                                        }
                                       
                                        apiValueDef = outputObject.createElement("apiValueDef");
                                        apiValueDef.appendChild(apiProperty);

                                        apiValueDetail.appendChild(apiValueDef);
                                        found = true;
                                        break;
                                    }
                                }
                                else
                                {
                                    apiProperty = outputObject.createElement("apiProperty");
                                    apiProperty.setAttribute("isBindable", "true");
                                   
                                    if (!bindableEventName.equals(""))
                                    {
                                        apiProperty.setAttribute("name", bindableEventName)
                                    }

                                    apiValueDef = outputObject.createElement("apiValueDef");
                                    apiValueDetail = outputObject.createElement("apiValueDetail");

                                    apiValueDetail.appendChild(apiValueDef);
                                    apiValueDef.appendChild(apiProperty);
                                    apiValueElement.appendChild(apiValueDetail);
                                    found = true;
                                    break;
                                }

                            }
                        }

                    }

                    if (!found)
                    {
                        bindableTable.put(fullName, "isBindable");
                    }
                }
                else
                {
                    bindableTable.put(fullName, "isBindable");
                }
            }

            Element defaultPropertyElement = asDocUtil.getElementByTagName((Element)parent, "DefaultProperty");
            if (defaultPropertyElement != null)
            {
                String fullName = defaultPropertyElement.getAttribute("owner");

                AsClass myClass = classTable.get(fullName);

                if (myClass != null)
                {

                    Element node = myClass.getNode();
                    Element asMetadata = null;

                    Element defaultProperty = outputObject.createElement("DefaultProperty");
                    defaultProperty.setAttribute("name", defaultPropertyElement.getAttribute("name"));
                    Element prolog = asDocUtil.getElementByTagName(node, "prolog");
                    if (prolog != null)
                    {
                        asMetadata = asDocUtil.getElementByTagName(prolog, "asMetadata");

                        if (asMetadata != null)
                        {
                            asMetadata.appendChild(defaultProperty);
                        }
                        else
                        {
                            asMetadata = outputObject.createElement("asMetadata");
                            asMetadata.appendChild(defaultProperty);
                            prolog.appendChild(asMetadata);
                        }
                    }
                    else
                    {
                        asMetadata = outputObject.createElement("asMetadata");
                        asMetadata.appendChild(defaultProperty);

                        prolog = outputObject.createElement("prolog");
                        prolog.appendChild(asMetadata);

                        myClass.getNode().appendChild(prolog);
                    }
                }
            }

            Element deprecatedElement = asDocUtil.getElementByTagName((Element)parent, "Deprecated");
            if (deprecatedElement != null)
            {
                String fullName = deprecatedElement.getAttribute("owner");

                if (verbose)
                {
                    System.out.println(" processing deprecated " + fullName);
                }

                AsClass myClass = classTable.get(fullName);
                Node node = null;

                if (myClass != null)
                {
                    node = myClass.getNode();
                }
                else
                {
                    QualifiedNameInfo qualifiedFullName = decomposeFullMethodOrFieldName(fullName);
                    myClass = classTable.get(qualifiedFullName.getFullClassName());
                    if (myClass != null)
                    {
                        if (myClass.getFields() != null)
                        {
                            NodeList childNodeList = myClass.getFields().getElementsByTagName("apiValue");
                            for (int ix = 0; ix < childNodeList.getLength(); ix++)
                            {
                                Element childElement = (Element)childNodeList.item(ix);
                                if (childElement.getAttribute("id").equals(asDocUtil.formatId(fullName)))
                                {
                                    node = childElement;
                                    break;
                                }
                            }
                        }

                        if (node == null && myClass.getMethods() != null)
                        {
                            NodeList childNodeList = myClass.getMethods().getElementsByTagName("apiOperation");
                            for (int ix = 0; ix < childNodeList.getLength(); ix++)
                            {
                                Element childElement = (Element)childNodeList.item(ix);
                                if (childElement.getAttribute("id").equals(asDocUtil.formatId(fullName)))
                                {
                                    node = childElement;
                                    break;
                                }
                            }
                        }
                    }
                    else
                    {
                        if (verbose)
                        {
                            System.out.println("   did not find my class for : " + qualifiedFullName.getFullClassName());
                        }
                    }
                }

                if (node == null)
                {
                    return;
                }

                Element defNode = asDocUtil.getDefNode((Element)node);

                Element apiDeprecated = outputObject.createElement("apiDeprecated");

                if (!deprecatedElement.getAttribute("replacement").equals(""))
                {
                    apiDeprecated.setAttribute("replacement", deprecatedElement.getAttribute("replacement"));
                }
                else if (!deprecatedElement.getAttribute("message").equals(""))
                {
                    Element apiDesc = outputObject.createElement("apiDesc");
                    CDATASection cdata = outputObject.createCDATASection(deprecatedElement.getAttribute("message"));
                    apiDesc.appendChild(cdata);
                    apiDeprecated.appendChild(apiDesc);
                    asDocUtil.convertDescToDITA(apiDesc, oldNewNamesMap);
                }
                else if (!deprecatedElement.getAttribute("name").equals(""))
                {
                    Element apiDesc = outputObject.createElement("apiDesc");
                    CDATASection cdata = outputObject.createCDATASection(deprecatedElement.getAttribute("name"));
                    apiDesc.appendChild(cdata);
                    apiDeprecated.appendChild(apiDesc);
                    asDocUtil.convertDescToDITA(apiDesc, oldNewNamesMap);
                }

                if (!deprecatedElement.getAttribute("since").equals(""))
                {
                    apiDeprecated.setAttribute("sinceVersion", deprecatedElement.getAttribute("since"));
                }

                defNode.appendChild(apiDeprecated);
            }

            Element skinStateElement = asDocUtil.getElementByTagName((Element)parent, "SkinState");
            if (skinStateElement != null)
            {
                // skip metadata if private
                NodeList childrenOfSkinState = skinStateElement.getElementsByTagName("private");
                if ((childrenOfSkinState != null && childrenOfSkinState.getLength() != 0) && !includePrivate)
                {
                    return;
                }

                String fullName = skinStateElement.getAttribute("owner");
                String name = skinStateElement.getAttribute("name");

                AsClass myClass = classTable.get(fullName);

                if (myClass != null)
                {
                    Element node = myClass.getNode();

                    Element skinStatesElement = null;
                    Element asMetadata = null;
                    Element prolog = asDocUtil.getElementByTagName(node, "prolog");
                    if (prolog != null)
                    {
                        asMetadata = asDocUtil.getElementByTagName(prolog, "asMetadata");
                        if (asMetadata != null)
                        {
                            HashMap<String, String> attributes = new HashMap<String, String>();
                            attributes.put("kind", "SkinState");
                            attributes.put("name", name);
                           
                            Element excludeElement = asDocUtil.getElementByTagNameAndMatchingAttributes(asMetadata, "Exclude", attributes.entrySet());
                            if (excludeElement != null)
                            {
                                if (verbose)
                                {
                                    System.out.println("Excluding SkinState " + name + " from " + myClass.getName());
                                }
                                return;
                            }

                            skinStatesElement = asDocUtil.getElementByTagName(asMetadata, "skinStates");
                            if (skinStatesElement == null)
                            {
                                skinStatesElement = outputObject.createElement("skinStates");
                                asMetadata.appendChild(skinStatesElement);
                            }
                        }
                        else
                        {
                            skinStatesElement = outputObject.createElement("skinStates");
                            asMetadata = outputObject.createElement("asMetadata");
                            asMetadata.appendChild(skinStatesElement);
                            prolog.appendChild(asMetadata);
                        }
                    }
                    else
                    {
                        skinStatesElement = outputObject.createElement("skinStates");
                        asMetadata = outputObject.createElement("asMetadata");
                        asMetadata.appendChild(skinStatesElement);

                        prolog = outputObject.createElement("prolog");
                        prolog.appendChild(asMetadata);

                        myClass.getNode().appendChild(prolog);
                    }

                    Element newSkinStateElement = (Element)outputObject.importNode(skinStateElement, true);

                    asDocUtil.processCustoms(newSkinStateElement, outputObject);

                    childrenOfSkinState = newSkinStateElement.getElementsByTagName("default");
                    if (childrenOfSkinState != null && childrenOfSkinState.getLength() != 0)
                    {
                        Element defaultElement = (Element)childrenOfSkinState.item(0);
                        String defaultText = defaultElement.getTextContent();

                        Element newDefaultElement = outputObject.createElement("default");
                        newDefaultElement.setTextContent(defaultText);

                        newSkinStateElement.replaceChild(newDefaultElement, defaultElement);
                    }

                    NodeList descriptionList = newSkinStateElement.getElementsByTagName("description");
                    if (descriptionList != null && descriptionList.getLength() != 0)
                    {
                        Element descriptionElement = (Element)descriptionList.item(0);
                        String descriptionText = descriptionElement.getTextContent();

                        Element newDescriptionElement = outputObject.createElement("description");
                        CDATASection cdata = outputObject.createCDATASection(asDocUtil.validateText(descriptionText, "description", fullName));
                        newDescriptionElement.appendChild(cdata);

                        newSkinStateElement.replaceChild(newDescriptionElement, descriptionElement);
                        asDocUtil.convertDescToDITA(newDescriptionElement, oldNewNamesMap);
                    }

                    childrenOfSkinState = newSkinStateElement.getElementsByTagName("see");
                    if (childrenOfSkinState != null && childrenOfSkinState.getLength() != 0)
                    {
                        Element relatedLinks = outputObject.createElement("related-links");
                        for (int ix = 0; ix < childrenOfSkinState.getLength(); ix++)
                        {
                            Element seeElement = (Element)childrenOfSkinState.item(ix);
                            relatedLinks.appendChild(processSeeTag(fullName, seeElement.getTextContent()));
                        }
                        newSkinStateElement.appendChild(relatedLinks);

                        for (int ix = 0; ix < childrenOfSkinState.getLength(); ix++)
                        {
                            newSkinStateElement.removeChild(childrenOfSkinState.item(ix));
                        }

                    }

                    childrenOfSkinState = newSkinStateElement.getElementsByTagName("copy");
                    if (childrenOfSkinState != null && childrenOfSkinState.getLength() != 0)
                    {
                        String text = childrenOfSkinState.item(0).getTextContent();
                        text = text.replaceAll("\\s+", "");

                        descriptionList = newSkinStateElement.getElementsByTagName("description");
                        Element descriptionElement = null;
                        if (descriptionList != null && descriptionList.getLength() != 0)
                        {
                            descriptionElement = (Element)descriptionList.item(0);
                        }
                        else
                        {
                            descriptionElement = outputObject.createElement("description");
                            newSkinStateElement.appendChild(descriptionElement);
                        }
                        descriptionElement.setAttribute("conref", text);

                        newSkinStateElement.removeChild(childrenOfSkinState.item(0));
                    }

                    childrenOfSkinState = newSkinStateElement.getElementsByTagName("playerversion");
                    if (childrenOfSkinState != null && childrenOfSkinState.getLength() != 0)
                    {
                        String playerversion = childrenOfSkinState.item(0).getTextContent();
                        playerversion = playerversion.replaceAll("\\s+", "");

                        newSkinStateElement.setAttribute("playerVersion", playerversion);
                        newSkinStateElement.removeChild(childrenOfSkinState.item(0));
                    }

                    skinStatesElement.appendChild(newSkinStateElement);
                }
            }

            Element skinPartElement = asDocUtil.getElementByTagName((Element)parent, "SkinPart");
            if (skinPartElement != null)
            {
                // skip metadata if private
                NodeList childrenOfSkinPart = skinPartElement.getElementsByTagName("private");
                if ((childrenOfSkinPart != null && childrenOfSkinPart.getLength() != 0) && !includePrivate)
                {
                    return;
                }

                String fullName = skinPartElement.getAttribute("owner");
                String name = skinPartElement.getAttribute("name");

                AsClass myClass = classTable.get(fullName);

                if (myClass != null)
                {
                    Element node = myClass.getNode();

                    Element skinPartsElement = null;
                    Element asMetadata = null;
                    Element prolog = asDocUtil.getElementByTagName(node, "prolog");
                    if (prolog != null)
                    {
                        asMetadata = asDocUtil.getElementByTagName(prolog, "asMetadata");
                        if (asMetadata != null)
                        {
                            HashMap<String, String> attributes = new HashMap<String, String>();
                            attributes.put("kind", "SkinPart");
                            attributes.put("name", name);
                           
                            Element excludeElement = asDocUtil.getElementByTagNameAndMatchingAttributes(asMetadata, "Exclude", attributes.entrySet());
                            if (excludeElement != null)
                            {
                                if (verbose)
                                {
                                    System.out.println("Excluding SkinPart " + name + " from " + myClass.getName());
                                }
                                return;
                            }

                            skinPartsElement = asDocUtil.getElementByTagName(asMetadata, "skinParts");
                            if (skinPartsElement == null)
                            {
                                skinPartsElement = outputObject.createElement("skinParts");
                                asMetadata.appendChild(skinPartsElement);
                            }
                        }
                        else
                        {
                            skinPartsElement = outputObject.createElement("skinParts");
                            asMetadata = outputObject.createElement("asMetadata");
                            asMetadata.appendChild(skinPartsElement);
                            prolog.appendChild(asMetadata);
                        }
                    }
                    else
                    {
                        skinPartsElement = outputObject.createElement("skinParts");
                        asMetadata = outputObject.createElement("asMetadata");
                        asMetadata.appendChild(skinPartsElement);

                        prolog = outputObject.createElement("prolog");
                        prolog.appendChild(asMetadata);

                        myClass.getNode().appendChild(prolog);
                    }

                    Element newSkinPartElement = (Element)outputObject.importNode(skinPartElement, true);

                    asDocUtil.processCustoms(newSkinPartElement, outputObject);

                    childrenOfSkinPart = newSkinPartElement.getElementsByTagName("default");
                    if (childrenOfSkinPart != null && childrenOfSkinPart.getLength() != 0)
                    {
                        Element defaultElement = (Element)childrenOfSkinPart.item(0);
                        String defaultText = defaultElement.getTextContent();

                        Element newDefaultElement = outputObject.createElement("default");
                        newDefaultElement.setTextContent(defaultText);

                        newSkinPartElement.replaceChild(newDefaultElement, defaultElement);
                    }

                    NodeList descriptionList = newSkinPartElement.getElementsByTagName("description");
                    if (descriptionList != null && descriptionList.getLength() != 0)
                    {
                        Element descriptionElement = (Element)descriptionList.item(0);
                        String descriptionText = descriptionElement.getTextContent();

                        Element shortdesc = outputObject.createElement("shortdesc");
                        newSkinPartElement.appendChild(shortdesc);
                        shortdesc.setTextContent(asDocUtil.descToShortDesc(descriptionText));
                       
                        Element newDescriptionElement = outputObject.createElement("description");
                        CDATASection cdata = outputObject.createCDATASection(asDocUtil.validateText(descriptionText, "description", fullName));
                        newDescriptionElement.appendChild(cdata);

                        newSkinPartElement.replaceChild(newDescriptionElement, descriptionElement);
                        asDocUtil.convertDescToDITA(newDescriptionElement, oldNewNamesMap);
                    }

                    childrenOfSkinPart = newSkinPartElement.getElementsByTagName("see");
                    if (childrenOfSkinPart != null && childrenOfSkinPart.getLength() != 0)
                    {
                        Element relatedLinks = outputObject.createElement("related-links");
                        for (int ix = 0; ix < childrenOfSkinPart.getLength(); ix++)
                        {
                            Element seeElement = (Element)childrenOfSkinPart.item(ix);
                            relatedLinks.appendChild(processSeeTag(fullName, seeElement.getTextContent()));
                        }
                        newSkinPartElement.appendChild(relatedLinks);

                        for (int ix = 0; ix < childrenOfSkinPart.getLength(); ix++)
                        {
                            newSkinPartElement.removeChild(childrenOfSkinPart.item(ix));
                        }

                    }

                    childrenOfSkinPart = newSkinPartElement.getElementsByTagName("copy");
                    if (childrenOfSkinPart != null && childrenOfSkinPart.getLength() != 0)
                    {
                        String text = childrenOfSkinPart.item(0).getTextContent();
                        text = text.replaceAll("\\s+", "");

                        descriptionList = newSkinPartElement.getElementsByTagName("description");
                        Element descriptionElement = null;
                        if (descriptionList != null && descriptionList.getLength() != 0)
                        {
                            descriptionElement = (Element)descriptionList.item(0);
                        }
                        else
                        {
                            descriptionElement = outputObject.createElement("description");
                            newSkinPartElement.appendChild(descriptionElement);
                        }
                        descriptionElement.setAttribute("conref", text);

                        newSkinPartElement.removeChild(childrenOfSkinPart.item(0));
                    }

                    childrenOfSkinPart = newSkinPartElement.getElementsByTagName("playerversion");
                    if (childrenOfSkinPart != null && childrenOfSkinPart.getLength() != 0)
                    {
                        String playerversion = childrenOfSkinPart.item(0).getTextContent();
                        playerversion = playerversion.replaceAll("\\s+", "");

                        newSkinPartElement.setAttribute("playerVersion", playerversion);
                        newSkinPartElement.removeChild(childrenOfSkinPart.item(0));
                    }

                    skinPartsElement.appendChild(newSkinPartElement);
                }
            }

            Element alternativeElement = asDocUtil.getElementByTagName((Element)parent, "Alternative");
            if (alternativeElement != null)
            {
                String fullName = alternativeElement.getAttribute("owner");

                AsClass myClass = classTable.get(fullName);

                if (myClass != null)
                {
                    Element node = myClass.getNode();
                    Element asMetadata = null;

                    Element prolog = asDocUtil.getElementByTagName(node, "prolog");
                    if (prolog != null)
                    {
                        asMetadata = asDocUtil.getElementByTagName(prolog, "asMetadata");

                        if (asMetadata == null)
                        {
                            asMetadata = outputObject.createElement("asMetadata");
                            prolog.appendChild(asMetadata);
                        }
                    }
                    else
                    {
                        asMetadata = outputObject.createElement("asMetadata");

                        prolog = outputObject.createElement("prolog");
                        prolog.appendChild(asMetadata);

                        myClass.getNode().appendChild(prolog);
                    }

                    Element alternative = (Element)outputObject.importNode(alternativeElement, true);

                    asDocUtil.processCustoms(alternative, outputObject);

                    NodeList descriptionList = alternative.getElementsByTagName("description");
                    if (descriptionList != null && descriptionList.getLength() != 0)
                    {
                        Element descriptionElement = (Element)descriptionList.item(0);
                        String descriptionText = descriptionElement.getTextContent();

                        Element newDescriptionElement = outputObject.createElement("description");
                        CDATASection cdata = outputObject.createCDATASection(asDocUtil.validateText(descriptionText, "description", fullName));
                        newDescriptionElement.appendChild(cdata);

                        alternative.replaceChild(newDescriptionElement, descriptionElement);
                        asDocUtil.convertDescToDITA(newDescriptionElement, oldNewNamesMap);
                    }

                    NodeList childrenOfAlternative = alternative.getElementsByTagName("see");
                    if (childrenOfAlternative != null && childrenOfAlternative.getLength() != 0)
                    {
                        Element relatedLinks = outputObject.createElement("related-links");
                        for (int ix = 0; ix < childrenOfAlternative.getLength(); ix++)
                        {
                            Element seeElement = (Element)childrenOfAlternative.item(ix);
                            relatedLinks.appendChild(processSeeTag(fullName, seeElement.getTextContent()));
                        }
                        alternative.appendChild(relatedLinks);

                        for (int ix = 0; ix < childrenOfAlternative.getLength(); ix++)
                        {
                            alternative.removeChild(childrenOfAlternative.item(ix));
                        }

                    }

                    childrenOfAlternative = alternative.getElementsByTagName("copy");
                    if (childrenOfAlternative != null && childrenOfAlternative.getLength() != 0)
                    {
                        String text = childrenOfAlternative.item(0).getTextContent();
                        text = text.replaceAll("\\s+", "");

                        descriptionList = alternative.getElementsByTagName("description");
                        Element descriptionElement = null;
                        if (descriptionList != null && descriptionList.getLength() != 0)
                        {
                            descriptionElement = (Element)descriptionList.item(0);
                        }
                        else
                        {
                            descriptionElement = outputObject.createElement("description");
                            alternative.appendChild(descriptionElement);
                        }
                        descriptionElement.setAttribute("conref", text);

                        alternative.removeChild(childrenOfAlternative.item(0));
                    }

                    asMetadata.appendChild(alternative);
                }
            }
           
            Element discouragedForProfileElement = asDocUtil.getElementByTagName((Element)parent, "DiscouragedForProfile");
            if (discouragedForProfileElement != null)
            {
                // skip metadata if private
                NodeList childrenOfDiscouragedForProfile = discouragedForProfileElement.getElementsByTagName("private");
                if ((childrenOfDiscouragedForProfile != null && childrenOfDiscouragedForProfile.getLength() != 0) && !includePrivate)
                {
                    return;
                }

                String fullName = discouragedForProfileElement.getAttribute("owner");
                String name = discouragedForProfileElement.getAttribute("name");

                AsClass myClass = classTable.get(fullName);

                if (myClass != null)
                {
                    Element node = myClass.getNode();

                    Element profilesElement = null;
                    Element asMetadata = null;
                    Element prolog = asDocUtil.getElementByTagName(node, "prolog");
                    if (prolog != null)
                    {
                        asMetadata = asDocUtil.getElementByTagName(prolog, "asMetadata");
                        if (asMetadata != null)
                        {
                            HashMap<String, String> attributes = new HashMap<String, String>();
                            attributes.put("kind", "DiscouragedForProfile");
                            attributes.put("name", name);
                           
                            Element excludeElement = asDocUtil.getElementByTagNameAndMatchingAttributes(asMetadata, "Exclude", attributes.entrySet());
                            if (excludeElement != null)
                            {
                                if (verbose)
                                {
                                    System.out.println("Excluding DiscouragedForProfile " + name + " from " + myClass.getName());
                                }
                                return;
                            }

                            profilesElement = asDocUtil.getElementByTagName(asMetadata, "discouragedForProfiles");
                            if (profilesElement == null)
                            {
                                profilesElement = outputObject.createElement("discouragedForProfiles");
                                asMetadata.appendChild(profilesElement);
                            }
                        }
                        else
                        {
                            profilesElement = outputObject.createElement("discouragedForProfiles");
                            asMetadata = outputObject.createElement("asMetadata");
                            asMetadata.appendChild(profilesElement);
                            prolog.appendChild(asMetadata);
                        }
                    }
                    else
                    {
                        profilesElement = outputObject.createElement("discouragedForProfiles");
                        asMetadata = outputObject.createElement("asMetadata");
                        asMetadata.appendChild(profilesElement);

                        prolog = outputObject.createElement("prolog");
                        prolog.appendChild(asMetadata);

                        myClass.getNode().appendChild(prolog);
                    }

                    Element discouragedForProfile = (Element)outputObject.importNode(discouragedForProfileElement, true);

                    asDocUtil.processCustoms(discouragedForProfile, outputObject);

                    NodeList descriptionList = discouragedForProfile.getElementsByTagName("description");
                    if (descriptionList != null && descriptionList.getLength() != 0)
                    {
                        Element descriptionElement = (Element)descriptionList.item(0);
                        String descriptionText = descriptionElement.getTextContent();

                        Element newDescriptionElement = outputObject.createElement("description");
                        CDATASection cdata = outputObject.createCDATASection(asDocUtil.validateText(descriptionText, "description", fullName));
                        newDescriptionElement.appendChild(cdata);

                        discouragedForProfile.replaceChild(newDescriptionElement, descriptionElement);
                        asDocUtil.convertDescToDITA(newDescriptionElement, oldNewNamesMap);
                    }
View Full Code Here

     * @throws XNIException Thrown by handler to signal an error.
     */
    public void characters(XMLString text) throws XNIException {

        if (fInCDATASection) {
            CDATASection cdataSection = (CDATASection)fCurrentNode;
            cdataSection.appendData(text.toString());
        }
        else if (!fInDTD) {
            Node child = fCurrentNode.getLastChild();
            if (child != null && child.getNodeType() == Node.TEXT_NODE) {
                Text textNode = (Text)child;
View Full Code Here

        if (!fIncludeIgnorableWhitespace) {
            return;
        }

        if (fInCDATASection) {
            CDATASection cdataSection = (CDATASection)fCurrentNode;
            cdataSection.appendData(text.toString());
            return;
        }
       
        Node child = fCurrentNode.getLastChild();
        if (child != null && child.getNodeType() == Node.TEXT_NODE) {
View Full Code Here

     * @throws XNIException Thrown by handler to signal an error.
     */
    public void startCDATA() throws XNIException {

        fInCDATASection = true;
        CDATASection cdataSection = fDocument.createCDATASection("");
        fCurrentNode.appendChild(cdataSection);
        fCurrentNode = cdataSection;

    } // startCDATA()
View Full Code Here

       && org.apache.xml.utils.XMLCharacterRecognizer.isWhiteSpace(ch, start, length))
      return// avoid DOM006 Hierarchy request error

    String s = new String(ch, start, length);

    CDATASection section  =(CDATASection) m_currentNode.getLastChild();
    section.appendData(s);
  }
View Full Code Here

        throws XNIException {

        if (fInCDATASection) {
            Node node = fCurrentNode.getLastChild();
            if (node != null && node.getNodeType() == Node.CDATA_SECTION_NODE) {
                CDATASection cdata = (CDATASection)node;
                cdata.appendData(text.toString());
            }
            else {
                CDATASection cdata = fDocument.createCDATASection(text.toString());
                fCurrentNode.appendChild(cdata);
            }
        }
        else {
            Node node = fCurrentNode.getLastChild();
View Full Code Here

                case Node.TEXT_NODE:
                    Text t = doc.createTextNode(n.getNodeValue());
                    documentationEl.appendChild(t);
                    break;
                case Node.CDATA_SECTION_NODE:
                    CDATASection s = doc.createCDATASection(n.getNodeValue());
                    documentationEl.appendChild(s);
                    break;
                case Node.COMMENT_NODE:
                    Comment c = doc.createComment(n.getNodeValue());
                    documentationEl.appendChild(c);
View Full Code Here

TOP

Related Classes of org.w3c.dom.CDATASection

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.