Functions
xmlgen.h File Reference

Go to the source code of this file.

Functions

void generateXML ()
 

Function Documentation

void generateXML ( )

Definition at line 1839 of file xmlgen.cpp.

1840 {
1841  // + classes
1842  // + namespaces
1843  // + files
1844  // + groups
1845  // + related pages
1846  // - examples
1847 
1848  QCString outputDirectory = Config_getString("XML_OUTPUT");
1849  QDir xmlDir(outputDirectory);
1850  createSubDirs(xmlDir);
1851 
1852  ResourceMgr::instance().copyResource("index.xsd",outputDirectory);
1853 
1854  QCString fileName=outputDirectory+"/compound.xsd";
1855  QFile f(fileName);
1856  if (!f.open(IO_WriteOnly))
1857  {
1858  err("Cannot open file %s for writing!\n",fileName.data());
1859  return;
1860  }
1861 
1862  // write compound.xsd, but replace special marker with the entities
1863  QCString compound_xsd = ResourceMgr::instance().getAsString("compound.xsd");
1864  const char *startLine = compound_xsd.data();
1865  while (*startLine)
1866  {
1867  // find end of the line
1868  const char *endLine = startLine+1;
1869  while (*endLine && *(endLine-1)!='\n') endLine++; // skip to end of the line including \n
1870  int len=endLine-startLine;
1871  if (len>0)
1872  {
1873  QCString s(len+1);
1874  qstrncpy(s.rawData(),startLine,len);
1875  s[len]='\0';
1876  if (s.find("<!-- Automatically insert here the HTML entities -->")!=-1)
1877  {
1878  FTextStream t(&f);
1880  }
1881  else
1882  {
1883  f.writeBlock(startLine,len);
1884  }
1885  }
1886  startLine=endLine;
1887  }
1888  f.close();
1889 
1890  fileName=outputDirectory+"/index.xml";
1891  f.setName(fileName);
1892  if (!f.open(IO_WriteOnly))
1893  {
1894  err("Cannot open file %s for writing!\n",fileName.data());
1895  return;
1896  }
1897  FTextStream t(&f);
1898  //t.setEncoding(FTextStream::UnicodeUTF8);
1899 
1900  // write index header
1901  t << "<?xml version='1.0' encoding='UTF-8' standalone='no'?>" << endl;;
1902  t << "<doxygenindex xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" ";
1903  t << "xsi:noNamespaceSchemaLocation=\"index.xsd\" ";
1904  t << "version=\"" << versionString << "\">" << endl;
1905 
1906  {
1908  ClassDef *cd;
1909  for (cli.toFirst();(cd=cli.current());++cli)
1910  {
1911  generateXMLForClass(cd,t);
1912  }
1913  }
1914  //{
1915  // ClassSDict::Iterator cli(Doxygen::hiddenClasses);
1916  // ClassDef *cd;
1917  // for (cli.toFirst();(cd=cli.current());++cli)
1918  // {
1919  // msg("Generating XML output for class %s\n",cd->name().data());
1920  // generateXMLForClass(cd,t);
1921  // }
1922  //}
1924  NamespaceDef *nd;
1925  for (nli.toFirst();(nd=nli.current());++nli)
1926  {
1927  msg("Generating XML output for namespace %s\n",nd->name().data());
1929  }
1931  FileName *fn;
1932  for (;(fn=fnli.current());++fnli)
1933  {
1934  FileNameIterator fni(*fn);
1935  FileDef *fd;
1936  for (;(fd=fni.current());++fni)
1937  {
1938  msg("Generating XML output for file %s\n",fd->name().data());
1939  generateXMLForFile(fd,t);
1940  }
1941  }
1943  GroupDef *gd;
1944  for (;(gd=gli.current());++gli)
1945  {
1946  msg("Generating XML output for group %s\n",gd->name().data());
1947  generateXMLForGroup(gd,t);
1948  }
1949  {
1951  PageDef *pd=0;
1952  for (pdi.toFirst();(pd=pdi.current());++pdi)
1953  {
1954  msg("Generating XML output for page %s\n",pd->name().data());
1956  }
1957  }
1958  {
1959  DirDef *dir;
1961  for (sdi.toFirst();(dir=sdi.current());++sdi)
1962  {
1963  msg("Generate XML output for dir %s\n",dir->name().data());
1964  generateXMLForDir(dir,t);
1965  }
1966  }
1967  {
1969  PageDef *pd=0;
1970  for (pdi.toFirst();(pd=pdi.current());++pdi)
1971  {
1972  msg("Generating XML output for example %s\n",pd->name().data());
1974  }
1975  }
1976  if (Doxygen::mainPage)
1977  {
1978  msg("Generating XML output for the main page\n");
1980  }
1981 
1982  //t << " </compoundlist>" << endl;
1983  t << "</doxygenindex>" << endl;
1984 
1986 }
Traverses directory structures and contents in a platform-independent way.
Definition: qdir.h:52
static GroupSDict * groupSDict
Definition: doxygen.h:119
char * rawData() const
Definition: qcstring.h:216
QCString getAsString(const char *name) const
char * qstrncpy(char *dst, const char *src, uint len)
Definition: qcstring.cpp:557
void writeXMLSchema(FTextStream &t)
Definition: htmlentity.cpp:477
static PageSDict * exampleSDict
Definition: doxygen.h:101
void msg(const char *fmt,...)
Definition: message.cpp:107
#define IO_WriteOnly
Definition: qiodevice.h:62
const bool FALSE
Definition: qglobal.h:370
static FileNameList * inputNameList
Definition: doxygen.h:109
bool copyResource(const char *name, const char *targetDir) const
static ResourceMgr & instance()
Definition: resourcemgr.cpp:35
static HtmlEntityMapper * instance()
Definition: htmlentity.cpp:341
Simplified and optimized version of QTextStream.
Definition: ftextstream.h:11
string dir
static void generateXMLForGroup(GroupDef *gd, FTextStream &ti)
Definition: xmlgen.cpp:1644
static void generateXMLForDir(DirDef *dd, FTextStream &ti)
Definition: xmlgen.cpp:1719
static NamespaceSDict * namespaceSDict
Definition: doxygen.h:120
def cli(ctx)
Definition: main.py:7
QAsciiDict< Entry > fn
const QCString & name() const
Definition: definition.h:114
fileName
Definition: dumpTree.py:9
QCString name() const
Definition: filedef.cpp:1193
static DirSDict * directories
Definition: doxygen.h:139
char versionString[]
Definition: version.cpp:1
static PageSDict * pageSDict
Definition: doxygen.h:102
const char * data() const
Definition: qcstring.h:207
Definition: dirdef.h:44
#define Config_getString(val)
Definition: config.cpp:660
void err(const char *fmt,...)
Definition: message.cpp:226
static void generateXMLForNamespace(NamespaceDef *nd, FTextStream &ti)
Definition: xmlgen.cpp:1428
static void generateXMLForClass(ClassDef *cd, FTextStream &ti)
Definition: xmlgen.cpp:1215
The QFile class is an I/O device that operates on files.
Definition: qfile.h:50
static void generateXMLForPage(PageDef *pd, FTextStream &ti, bool isExample)
Definition: xmlgen.cpp:1758
static void generateXMLForFile(FileDef *fd, FTextStream &ti)
Definition: xmlgen.cpp:1504
A model of a page symbol.
Definition: pagedef.h:29
void createSubDirs(QDir &d)
Definition: util.cpp:5458
friend class Iterator
Definition: sortdict.h:289
static ClassSDict * classSDict
Definition: doxygen.h:99
static PageDef * mainPage
Definition: doxygen.h:103
static void writeCombineScript()
Definition: xmlgen.cpp:154
static QCString * s
Definition: config.cpp:1042
const bool TRUE
Definition: qglobal.h:371
QTextStream & endl(QTextStream &s)