Esempio n. 1
0
void XMLWriter::writeStartElement(const XMLString& namespaceURI, const XMLString& localName, const XMLString& qname, const Attributes& attributes)
{
	if (!_nsContextPushed)
		_namespaces.pushContext();
	_nsContextPushed = false;
	++_elementCount;
	writeMarkup(MARKUP_LT);
	if (!localName.empty() && (qname.empty() || localName == qname))
	{
		XMLString prefix;
		if (!namespaceURI.empty() && !_namespaces.isMapped(namespaceURI))
		{
			prefix = newPrefix();
			_namespaces.declarePrefix(prefix, namespaceURI);
		}
		else prefix = _namespaces.getPrefix(namespaceURI);
		writeName(prefix, localName);
	}
	else if (namespaceURI.empty() && localName.empty() && !qname.empty())
	{
		writeXML(qname);
	}
	else if (!localName.empty() && !qname.empty())
	{
		XMLString local;
		XMLString prefix;
		Name::split(qname, prefix, local);
		if (prefix.empty()) prefix = _namespaces.getPrefix(namespaceURI);
		const XMLString& uri = _namespaces.getURI(prefix);
		if ((uri.empty() || uri != namespaceURI) && !namespaceURI.empty())
		{
			_namespaces.declarePrefix(prefix, namespaceURI);
		}
		writeName(prefix, localName);
	}
	else throw XMLException("Tag mismatch", nameToString(localName, qname));

	declareAttributeNamespaces(attributes);
	AttributeMap attributeMap;
	addNamespaceAttributes(attributeMap);
	addAttributes(attributeMap, attributes, namespaceURI);
	writeAttributes(attributeMap);
	_unclosedStartTag = true;
}
Esempio n. 2
0
void NamespaceDef::writeDocumentation(OutputList &ol)
{
    static bool generateTreeView = Config_getBool("GENERATE_TREEVIEW");
    //static bool outputJava = Config_getBool("OPTIMIZE_OUTPUT_JAVA");
    //static bool fortranOpt = Config_getBool("OPTIMIZE_FOR_FORTRAN");

    QCString pageTitle = title();
    startFile(ol,getOutputFileBase(),name(),pageTitle,HLI_NamespaceVisible,!generateTreeView);

    if (!generateTreeView)
    {
        if (getOuterScope()!=Doxygen::globalScope)
        {
            writeNavigationPath(ol);
        }
        ol.endQuickIndices();
    }

    startTitle(ol,getOutputFileBase(),this);
    ol.parseText(pageTitle);
    addGroupListToTitle(ol,this);
    addNamespaceAttributes(ol);
    endTitle(ol,getOutputFileBase(),displayName());
    ol.startContents();

    if (Doxygen::searchIndex)
    {
        Doxygen::searchIndex->setCurrentDoc(this,anchor(),FALSE);
        Doxygen::searchIndex->addWord(localName(),TRUE);
    }

    Doxygen::indexList->addIndexItem(this,0);

    //---------------------------------------- start flexible part -------------------------------

    SrcLangExt lang = getLanguage();
    QListIterator<LayoutDocEntry> eli(
        LayoutDocManager::instance().docEntries(LayoutDocManager::Namespace));
    LayoutDocEntry *lde;
    for (eli.toFirst(); (lde=eli.current()); ++eli)
    {
        switch (lde->kind())
        {
        case LayoutDocEntry::BriefDesc:
            writeBriefDescription(ol);
            break;
        case LayoutDocEntry::MemberDeclStart:
            startMemberDeclarations(ol);
            break;
        case LayoutDocEntry::NamespaceClasses:
        {
            LayoutDocEntrySection *ls = (LayoutDocEntrySection*)lde;
            writeClassDeclarations(ol,ls->title(lang));
        }
        break;
        case LayoutDocEntry::NamespaceNestedNamespaces:
        {
            LayoutDocEntrySection *ls = (LayoutDocEntrySection*)lde;
            writeNamespaceDeclarations(ol,ls->title(lang),false);
        }
        break;
        case LayoutDocEntry::NamespaceNestedConstantGroups:
        {
            LayoutDocEntrySection *ls = (LayoutDocEntrySection*)lde;
            writeNamespaceDeclarations(ol,ls->title(lang),true);
        }
        break;
        case LayoutDocEntry::MemberGroups:
            writeMemberGroups(ol);
            break;
        case LayoutDocEntry::MemberDecl:
        {
            LayoutDocEntryMemberDecl *lmd = (LayoutDocEntryMemberDecl*)lde;
            writeMemberDeclarations(ol,lmd->type,lmd->title(lang));
        }
        break;
        case LayoutDocEntry::MemberDeclEnd:
            endMemberDeclarations(ol);
            break;
        case LayoutDocEntry::DetailedDesc:
        {
            LayoutDocEntrySection *ls = (LayoutDocEntrySection*)lde;
            writeDetailedDescription(ol,ls->title(lang));
        }
        break;
        case LayoutDocEntry::MemberDefStart:
            startMemberDocumentation(ol);
            break;
        case LayoutDocEntry::NamespaceInlineClasses:
            writeInlineClasses(ol);
            break;
        case LayoutDocEntry::MemberDef:
        {
            LayoutDocEntryMemberDef *lmd = (LayoutDocEntryMemberDef*)lde;
            writeMemberDocumentation(ol,lmd->type,lmd->title(lang));
        }
        break;
        case LayoutDocEntry::MemberDefEnd:
            endMemberDocumentation(ol);
            break;
        case LayoutDocEntry::AuthorSection:
            writeAuthorSection(ol);
            break;
        case LayoutDocEntry::ClassIncludes:
        case LayoutDocEntry::ClassInheritanceGraph:
        case LayoutDocEntry::ClassNestedClasses:
        case LayoutDocEntry::ClassCollaborationGraph:
        case LayoutDocEntry::ClassAllMembersLink:
        case LayoutDocEntry::ClassUsedFiles:
        case LayoutDocEntry::ClassInlineClasses:
        case LayoutDocEntry::FileClasses:
        case LayoutDocEntry::FileNamespaces:
        case LayoutDocEntry::FileConstantGroups:
        case LayoutDocEntry::FileIncludes:
        case LayoutDocEntry::FileIncludeGraph:
        case LayoutDocEntry::FileIncludedByGraph:
        case LayoutDocEntry::FileSourceLink:
        case LayoutDocEntry::FileInlineClasses:
        case LayoutDocEntry::GroupClasses:
        case LayoutDocEntry::GroupInlineClasses:
        case LayoutDocEntry::GroupNamespaces:
        case LayoutDocEntry::GroupDirs:
        case LayoutDocEntry::GroupNestedGroups:
        case LayoutDocEntry::GroupFiles:
        case LayoutDocEntry::GroupGraph:
        case LayoutDocEntry::GroupPageDocs:
        case LayoutDocEntry::DirSubDirs:
        case LayoutDocEntry::DirFiles:
        case LayoutDocEntry::DirGraph:
            err("Internal inconsistency: member %d should not be part of "
                "LayoutDocManager::Namespace entry list\n",lde->kind());
            break;
        }
    }

    //---------------------------------------- end flexible part -------------------------------

    ol.endContents();

    endFileWithNavPath(this,ol);

    if (Config_getBool("SEPARATE_MEMBER_PAGES"))
    {
        MemberList *allMemberList = getMemberList(MemberListType_allMembersList);
        if (allMemberList) allMemberList->sort();
        writeMemberPages(ol);
    }
}