/search.css" rel="stylesheet" type="text/css"/> /search.js">
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

Public Member Functions | Public Attributes
XmlDetDescGen::util::XmlFile Class Reference

List of all members.

Public Member Functions

def __init__
def xml
def write

Public Attributes

 dtd
 objects
 external_entities

Detailed Description

Definition at line 28 of file util.py.


Constructor & Destructor Documentation

def XmlDetDescGen::util::XmlFile::__init__ (   self,
  dtd = None,
  objects = [],
  external_entities = [] 
)

Definition at line 29 of file util.py.

00030                                                                :
00031         "XmlFile. external entities are (name,file) tuples"
00032         self.dtd = dtd
00033         self.objects = objects
00034         self.external_entities = external_entities
00035         #print "Starting XML file with %d objects and %d ee"%(len(objects),len(external_entities))
00036         return


Member Function Documentation

def XmlDetDescGen::util::XmlFile::xml (   self,
  fo,
  pre = '' 
)

Definition at line 37 of file util.py.

00038                            :
00039         fo.write('<?xml version="1.0" encoding="UTF-8"?>\n')
00040         Comment("Warning: this is a generated file.  Any modifications may be lost.").xml(fo,pre)
00041         if self.dtd:
00042             fo.write('<!DOCTYPE DDDB SYSTEM "%s"'%self.dtd)
00043             if self.external_entities:
00044                 fo.write(' [\n')
00045                 for ee in self.external_entities:
00046                     if isinstance(ee,str):
00047                         fo.write('%s\n'%ee)
00048                     else:
00049                         fo.write('  <!ENTITY %s SYSTEM "%s">\n'%(ee[0],ee[1]))
00050                 fo.write(' ]>\n')
00051             else:
00052                 fo.write(' >\n')
00053             fo.write('<DDDB>\n')
00054         for obj in self.objects:
00055             if isinstance(obj, str):
00056                 fo.write('%s%s\n'%(pre,obj))
00057             else:
00058                 obj.xml(fo,pre)
00059         if self.dtd:
00060             fo.write('</DDDB>\n')                
00061         return

def XmlDetDescGen::util::XmlFile::write (   self,
  filename 
)

Definition at line 62 of file util.py.

00063                             :
00064         import os
00065         try:
00066             os.remove(filename)
00067         except OSError:
00068             pass
00069         file = open(filename,"w")
00070         self.xml(file,'')
00071         file.close()
00072         os.chmod(filename,0444)
00073         print 'Wrote "%s"'%filename
00074         return
00075 
00076     
00077         

Member Data Documentation

Definition at line 29 of file util.py.

Definition at line 29 of file util.py.

Definition at line 29 of file util.py.


The documentation for this class was generated from the following file:
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Fri May 16 2014 09:56:07 for XmlDetDesc by doxygen 1.7.4