diff options
author | Dimitri van Heesch <dimitri@stack.nl> | 2014-02-10 19:34:18 (GMT) |
---|---|---|
committer | Dimitri van Heesch <dimitri@stack.nl> | 2014-02-10 19:53:35 (GMT) |
commit | dfa20277697fe904a0846b60a01cc388fc13c933 (patch) | |
tree | 011aa3c33d114404d7508756117e993b90e01799 /src/xmlgen.cpp | |
parent | 69665ef2ad0779f9255242929fb6028c8c3ec518 (diff) | |
download | Doxygen-dfa20277697fe904a0846b60a01cc388fc13c933.zip Doxygen-dfa20277697fe904a0846b60a01cc388fc13c933.tar.gz Doxygen-dfa20277697fe904a0846b60a01cc388fc13c933.tar.bz2 |
Restructered html entity handling
Diffstat (limited to 'src/xmlgen.cpp')
-rw-r--r-- | src/xmlgen.cpp | 61 |
1 files changed, 23 insertions, 38 deletions
diff --git a/src/xmlgen.cpp b/src/xmlgen.cpp index 084c2d7..bb0925e 100644 --- a/src/xmlgen.cpp +++ b/src/xmlgen.cpp @@ -45,6 +45,7 @@ #include "membergroup.h" #include "dirdef.h" #include "section.h" +#include "htmlentity.h" // no debug info #define XML_DB(x) do {} while(0) @@ -1897,47 +1898,31 @@ void generateXML() err("Cannot open file %s for writing!\n",fileName.data()); return; } - /* - * If the compound_xsd contyains the special string - * write part till special string - * for each html entity - * write xsd entry with xml element name without enclosing < and /> - * write part after special string - * otherwise - * write original compound_xsd - */ - QCString cmp_org(compound_xsd); - QCString ins("<!-- Automatically insert here the HTML entities -->"); - if (cmp_org.contains(QRegExp(ins))) - { - QCString xsd_txt; - QCString xsd_tmp; - QCString cmp_tmp1; - QCString cmp_tmp2; - QRegExp beg("^<"); - QRegExp end("/>$"); - cmp_tmp1 = cmp_org; - cmp_tmp1 = cmp_tmp1.replace(QRegExp(" *"+ins+".*"),""); - f.writeBlock(cmp_tmp1,qstrlen(cmp_tmp1)); - int num_std = get_num_standard_symbols(); - for (int i = 0; i < num_std; i++) - { - xsd_tmp = QCString(get_symbol_xml((DocSymbol::SymType)i)); - if (xsd_tmp.contains(beg)) + + // write compound.xsd, but replace special marker with the entities + const char *startLine = compound_xsd; + while (*startLine) + { + // find end of the line + const char *endLine = startLine+1; + while (*(endLine-1) && *(endLine-1)!='\n') endLine++; // skip to end of the line + int len=endLine-startLine; + if (len>0) + { + QCString s(len+1); + strlcpy(s.data(),startLine,len); + s[len]='\0'; + if (s.find("<!-- Automatically insert here the HTML entities -->")!=-1) { - xsd_txt = " <xsd:element name=\""; - xsd_txt += xsd_tmp.replace(beg,"").replace(end,""); - xsd_txt += "\" type=\"docEmptyType\" />\n"; - f.writeBlock(xsd_txt,qstrlen(xsd_txt)); + FTextStream t(&f); + HtmlEntityMapper::instance()->writeXMLSchema(t); + } + else + { + f.writeBlock(startLine,len); } } - cmp_tmp2 = cmp_org; - cmp_tmp2 = cmp_tmp2.replace(QRegExp(".*"+ins),""); - f.writeBlock(cmp_tmp2,qstrlen(cmp_tmp2)); - } - else - { - f.writeBlock(compound_xsd,qstrlen(compound_xsd)); + startLine=endLine; } f.close(); |