Changeset 7383

Show
Ignore:
Timestamp:
04/30/08 15:20:33 (5 years ago)
Author:
jgaeddert
Message:

improving generation of all XML files in OWD, including DOCTYPE problems (ticket #173), removing need for xmlBeautfy python module as xml.dom.minidom.writexml() takes care of this

Location:
ossiedev/branches/0.6.x/tools/WaveDev/wavedev
Files:
10 modified

Legend:

Unmodified
Added
Removed
  • ossiedev/branches/0.6.x/tools/WaveDev/wavedev/XML_gen/DevMan/_spd.xml.tpl

    r1132 r7383  
    11<?xml version="1.0" encoding="UTF-8"?> 
     2<!DOCTYPE softpkg SYSTEM '../dtd/softpkg.dtd'> 
    23<softpkg id="DCE:82f6515a-de05-47f0-8e7a-1c9f621c00ee" name="DeviceManager"> 
    34        <descriptor> 
  • ossiedev/branches/0.6.x/tools/WaveDev/wavedev/XML_gen/_DAS.xml.tpl

    r4961 r7383  
    11<?xml version="1.0" encoding="us-ascii"?> 
    2 <!-- 
    3     Generated by Zeligsoft Component Enabler 2.0.2 (Build: 200510131317) 
    4     http://www.zeligsoft.com 
    5 --> 
    62<deploymentenforcement> 
     3<!--  Created with OSSIE Waveform Developer Beta Version 0.6.2 --> 
     4<!--  http://ossie.wireless.vt.edu/                            --> 
     5<!--  Powered by Python                                        --> 
    76    <application id="DCE:438bffd7-cf7d-4f29-b0bc-e66303d25a84" name="Name" /> 
    87    <deviceassignmentsequence> 
  • ossiedev/branches/0.6.x/tools/WaveDev/wavedev/XML_gen/_dcd.xml.tpl

    r7173 r7383  
    11<?xml version="1.0" encoding="us-ascii"?> 
     2<!DOCTYPE deviceconfiguration SYSTEM "../../xml/dtd/deviceconfiguration.dtd"> 
    23<deviceconfiguration id="DCE:320baf2f-d7e3-4482-9e8c-7f23411bd84c" name="DeviceManager"> 
     4<!--  Created with OSSIE Waveform Developer Beta Version 0.6.2 --> 
     5<!--  http://ossie.wireless.vt.edu/                            --> 
     6<!--  Powered by Python                                        --> 
    37    <devicemanagersoftpkg> 
    48        <localfile name="DeviceManager.spd.xml" /> 
  • ossiedev/branches/0.6.x/tools/WaveDev/wavedev/XML_gen/_prf.xml.tpl

    r7209 r7383  
    11<?xml version="1.0" encoding="UTF-8"?> 
     2<!DOCTYPE properties SYSTEM "../dtd/properties.dtd"> 
    23<properties> 
     4<!--  Created with OSSIE Waveform Developer Beta Version 0.6.2 --> 
     5<!--  http://ossie.wireless.vt.edu/                            --> 
     6<!--  Powered by Python                                        --> 
    37</properties> 
  • ossiedev/branches/0.6.x/tools/WaveDev/wavedev/XML_gen/_sad.xml.tpl

    r7173 r7383  
    11<?xml version="1.0" encoding="UTF-8"?> 
     2<!DOCTYPE softwarecomponent SYSTEM '../dtd/softwarecomponent.dtd'> 
    23<softwareassembly id="DCE:Default" name="OSSIE::Default"> 
     4<!--  Created with OSSIE Waveform Developer Beta Version 0.6.2 --> 
     5<!--  http://ossie.wireless.vt.edu/                            --> 
     6<!--  Powered by Python                                        --> 
    37        <componentfiles> 
    48        </componentfiles> 
  • ossiedev/branches/0.6.x/tools/WaveDev/wavedev/XML_gen/_scd.xml.tpl

    r7205 r7383  
    1 <?xml version="1.0" encoding="us-ascii"?> 
    2 <!-- 
    3     Generated by Zeligsoft Component Enabler 2.0.2 (Build: 200510131317) 
    4     http://www.zeligsoft.com 
    5 --> 
     1<?xml version="1.0" encoding="UTF-8"?> 
     2<!DOCTYPE softwarecomponent SYSTEM '../dtd/softwarecomponent.dtd'> 
    63<softwarecomponent> 
     4<!--  Created with OSSIE Waveform Developer Beta Version 0.6.2 --> 
     5<!--  http://ossie.wireless.vt.edu/                            --> 
     6<!--  Powered by Python                                        --> 
    77    <corbaversion>2.2</corbaversion> 
    88    <componentrepid repid="IDL:CF/Resource:1.0" /> 
  • ossiedev/branches/0.6.x/tools/WaveDev/wavedev/XML_gen/_spd.xml.tpl

    r7208 r7383  
    11<?xml version="1.0" encoding="UTF-8"?> 
     2<!DOCTYPE softpkg SYSTEM '../dtd/softpkg.dtd'> 
    23<softpkg id="DCE:Default" name="DefaultResource"> 
     4<!--  Created with OSSIE Waveform Developer Beta Version 0.6.2 --> 
     5<!--  http://ossie.wireless.vt.edu/                            --> 
     6<!--  Powered by Python                                        --> 
    37        <title /> 
    48    <description></description> 
  • ossiedev/branches/0.6.x/tools/WaveDev/wavedev/XML_gen/application_gen.py

    r7130 r7383  
    2424import xml.dom.minidom 
    2525from xml.dom.minidom import Node 
    26 import xmlBeautify 
     26#import xmlBeautify 
    2727import WaveDev.wavedev.ComponentClass as CC 
    2828 
     
    286286            assemblycontrollerNode.getElementsByTagName("componentinstantiationref")[0].setAttribute("refid", assemblycontroller_id) 
    287287         
    288     # Create and beautify the SAD file as a temporary file 
    289     data = doc_sad.toxml('UTF-8') 
    290     xmlBeautify.beautify(data,waveformDir + '.' + outputFilename_sad + '.tmp') 
    291  
    292  
    293     # Post Processing - add some of the header lines 
    294  
    295     preProcessed_sad = open(waveformDir + '.' + outputFilename_sad + '.tmp', 'r') 
    296     postProcessed_sad = open(waveformDir + outputFilename_sad, 'w') 
    297  
    298     # Specify external DTD 
    299     line0 = preProcessed_sad.readline() 
    300     remaining = preProcessed_sad.readlines() 
    301     postProcessed_sad.writelines(line0) 
    302     postProcessed_sad.writelines(u'<!DOCTYPE softwareassembly SYSTEM \"../../xml/dtd/softwareassembly.dtd\">\n') 
    303     postProcessed_sad.writelines(commentLine) 
    304     postProcessed_sad.writelines(remaining) 
    305     postProcessed_sad.close() 
    306    
    307     # Remove temporary files 
    308     os.remove(waveformDir + '.' + outputFilename_sad + '.tmp') 
    309     
     288    # Define <!DOCTYPE> here (overriding template if necessary) 
     289    doc_sad.doctype.name = u'softwareassembly' 
     290    doc_sad.doctype.systemId = u'../../xml/dtd/softwareassembly.dtd' 
     291 
     292    outfile = open(waveformDir + outputFilename_sad, 'w') 
     293    doc_sad.writexml( outfile, encoding='UTF-8' ) 
     294    outfile.close() 
     295 
    310296    ####################### 
    311297    #Generate the DCD file 
     
    320306    path += waveName + '/' 
    321307 
     308    appName = unicode(waveName) 
     309    #namingServicePrefix = u'ossie' 
     310    outputFilename_das = appName + u'_DAS.xml' 
     311 
    322312    try: 
    323313        # try to find the DAS template using a relative path (being called by OWD) 
    324         das = xml.dom.minidom.parse('XML_gen/_DAS.xml.tpl') 
     314        doc_das = xml.dom.minidom.parse('XML_gen/_DAS.xml.tpl') 
    325315    except:  
    326316        # try to find the DAS template using an absolute path  
    327317        # (being called by other application)   
    328318        # if DAS file is still not found, should throw an IO Error 
    329         das = xml.dom.minidom.parse('/sdr/tools/WaveDev/wavedev/XML_gen/_DAS.xml.tpl') 
    330  
    331     deviceassignmentsequenceNode = das.getElementsByTagName("deviceassignmentsequence")[0] 
     319        doc_das = xml.dom.minidom.parse('/sdr/tools/WaveDev/wavedev/XML_gen/_DAS.xml.tpl') 
     320 
     321    deviceassignmentsequenceNode = doc_das.getElementsByTagName("deviceassignmentsequence")[0] 
    332322 
    333323    for n in complist: 
     
    341331        tmpDev = u'DCE:' + unicode(n.device.uuid) 
    342332         
    343         deviceassignmenttypeNode = das.createElement("deviceassignmenttype") 
    344         componentidNode = das.createElement("componentid") 
    345         componentidTextNode = das.createTextNode(tmpName) 
    346         assigndeviceidNode = das.createElement("assigndeviceid") 
    347         assigndeviceidTextNode = das.createTextNode(tmpDev) 
     333        deviceassignmenttypeNode = doc_das.createElement("deviceassignmenttype") 
     334        componentidNode = doc_das.createElement("componentid") 
     335        componentidTextNode = doc_das.createTextNode(tmpName) 
     336        assigndeviceidNode = doc_das.createElement("assigndeviceid") 
     337        assigndeviceidTextNode = doc_das.createTextNode(tmpDev) 
    348338 
    349339        # Append nodes 
     
    354344        deviceassignmentsequenceNode.appendChild(deviceassignmenttypeNode) 
    355345 
    356     data = das.toxml('UTF-8') 
    357     xmlBeautify.beautify(data,path+'.'+waveName+'_DAS.xml.tmp') 
    358      
    359     # Post Processing - add some of the header lines 
    360  
    361     preProcessed_das = open(path+'.'+waveName+'_DAS.xml.tmp', 'r') 
    362     postProcessed_das = open(path+waveName+'_DAS.xml', 'w') 
    363      
    364     # Specify external DTD 
    365     line0 = preProcessed_das.readline() 
    366     remaining = preProcessed_das.readlines() 
    367     postProcessed_das.writelines(line0) 
    368     #postProcessed_das.writelines(u'<!DOCTYPE deploymentenforcement SYSTEM "dtd/deploymentenforcement.dtd\">\n') 
    369     postProcessed_das.writelines(commentLine) 
    370     postProcessed_das.writelines(remaining) 
    371     postProcessed_das.close() 
    372      
    373     # Remove temporary files 
    374     os.remove(path+'.'+waveName+'_DAS.xml.tmp') 
     346    # Define <!DOCTYPE> here (overriding template if necessary) 
     347    #doc_das.doctype.name = u'deploymentenforcement' 
     348    #doc_das.doctype.systemId = u'../../xml/dtd/deploymentenforcement.dtd' 
     349 
     350    outfile = open(path + outputFilename_das, 'w') 
     351    doc_das.writexml( outfile, encoding='UTF-8' ) 
     352    outfile.close() 
    375353 
    376354################################################################################ 
     
    400378    localfileNode.setAttribute("name", unicode(dmName) + u'.scd.xml') 
    401379     
    402     data = doc_spd.toxml('UTF-8') 
    403     xmlBeautify.beautify(data,path + '.' + outputFilename_spd + '.tmp') 
    404  
    405  
    406     # Post Processing - add some of the header lines 
    407  
    408     preProcessed_spd = open(path + '.' + outputFilename_spd + '.tmp', 'r') 
    409     postProcessed_spd = open(path + outputFilename_spd, 'w') 
    410  
    411     # Specify external DTD 
    412     line0 = preProcessed_spd.readline() 
    413     remaining = preProcessed_spd.readlines() 
    414     postProcessed_spd.writelines(line0) 
    415     postProcessed_spd.writelines(u'<!DOCTYPE softpkg SYSTEM \"../../xml/dtd/softpkg.dtd\">\n') 
    416     postProcessed_spd.writelines(commentLine) 
    417     postProcessed_spd.writelines(remaining) 
    418     postProcessed_spd.close() 
    419    
    420     # Remove temporary files 
    421     os.remove(path + '.' + outputFilename_spd + '.tmp') 
    422      
    423     #tempDM = CC.Component(dmName,generate=False) 
    424     #component_gen.gen_scd(tempDM,waveformDir,node.name) 
    425      
     380    # Define <!DOCTYPE> here (overriding template if necessary) 
     381    doc_spd.doctype.name = u'softpkg' 
     382    doc_spd.doctype.systemId = u'../../xml/dtd/softpkg.dtd' 
     383 
     384    outfile = open(path + outputFilename_spd, 'w') 
     385    doc_spd.writexml( outfile, encoding='UTF-8' ) 
     386    outfile.close() 
     387 
    426388    # Copy the scd and prf files to directory - these aren't changed yet 
    427389    print "Performing a copy to: " + path + outputFilename_scd 
     
    486448        partitioningNode.appendChild(componentplacementNode) 
    487449 
    488     # Create and beautify the dcd file as a temporary file 
    489     data = doc_dcd.toxml('UTF-8') 
    490     xmlBeautify.beautify(data,path + '.' + outputFilename_dcd + '.tmp') 
    491  
    492  
    493     # Post Processing - add some of the header lines 
    494  
    495     preProcessed_dcd = open(path + '.' + outputFilename_dcd + '.tmp', 'r') 
    496     postProcessed_dcd = open(path + outputFilename_dcd, 'w') 
    497  
    498     # Specify external DTD 
    499     line0 = preProcessed_dcd.readline() 
    500     remaining = preProcessed_dcd.readlines() 
    501     postProcessed_dcd.writelines(line0) 
    502     postProcessed_dcd.writelines(u'<!DOCTYPE deviceconfiguration SYSTEM \"../../xml/dtd/deviceconfiguration.dtd\">\n') 
    503     postProcessed_dcd.writelines(commentLine) 
    504     postProcessed_dcd.writelines(remaining) 
    505     postProcessed_dcd.close() 
    506    
    507     # Remove temporary files 
    508     os.remove(path + '.' + outputFilename_dcd + '.tmp') 
    509  
     450    # Define <!DOCTYPE> here (overriding template if necessary) 
     451    doc_dcd.doctype.name = u'deviceconfiguration' 
     452    doc_dcd.doctype.systemId = u'../../xml/dtd/deviceconfiguration.dtd' 
     453 
     454    outfile = open(path + outputFilename_dcd, 'w') 
     455    doc_dcd.writexml( outfile, encoding='UTF-8' ) 
     456    outfile.close() 
    510457 
    511458 
  • ossiedev/branches/0.6.x/tools/WaveDev/wavedev/XML_gen/component_gen.py

    r5887 r7383  
    2525from xml.dom.minidom import Node 
    2626 
    27 import xmlBeautify 
     27#import xmlBeautify 
    2828 
    2929# 
     
    115115    compDir = waveformDir + comp.name + '/' 
    116116    outputFileName_scd = comp.name + '.scd.xml' 
    117      
    118     data = doc_scd.toxml('UTF-8') 
    119     xmlBeautify.beautify(data,compDir + '.' + outputFileName_scd + '.tmp') 
    120  
    121     preProcessed_scd = open(compDir + '.' + outputFileName_scd + '.tmp', 'r') 
    122     postProcessed_scd = open(compDir + outputFileName_scd, 'w') 
    123      
    124     # Specify external DTD 
    125     line0 = preProcessed_scd.readline() 
    126     remaining = preProcessed_scd.readlines() 
    127     postProcessed_scd.writelines(line0) 
    128     postProcessed_scd.writelines(u'<!DOCTYPE softwarecomponent SYSTEM \"../dtd/softwarecomponent.dtd\">\n') 
    129     postProcessed_scd.writelines(commentLine) 
    130     postProcessed_scd.writelines(remaining) 
    131     postProcessed_scd.close() 
    132     
    133     # Remove temporary files 
    134     os.remove(compDir + '.' + outputFileName_scd + '.tmp') 
    135     
     117 
     118    # Define <!DOCTYPE> here (overriding template if necessary) 
     119    #doc_scd.doctype.name = u'softwarecomponent' 
     120    #doc_scd.doctype.systemId = u'../dtd/softwarecomponent.dtd' 
     121     
     122    outfile = open(compDir + outputFileName_scd, 'w') 
     123    doc_scd.writexml( outfile, encoding='UTF-8' ) 
     124    outfile.close() 
    136125    
    137126def gen_spd(comp, waveformDir): 
     
    173162    #outputFileName_spd = comp.name + 'Resource' + '.spd.xml' 
    174163     
    175     data = doc_spd.toxml('UTF-8') 
    176     xmlBeautify.beautify(data,compDir + '.' + outputFileName_spd + '.tmp') 
    177  
    178     preProcessed_spd = open(compDir + '.' + outputFileName_spd + '.tmp', 'r') 
    179     postProcessed_spd = open(compDir + outputFileName_spd, 'w') 
    180      
    181     # Specify external DTD 
    182     line0 = preProcessed_spd.readline() 
    183     remaining = preProcessed_spd.readlines() 
    184     postProcessed_spd.writelines(line0) 
    185     postProcessed_spd.writelines(u'<!DOCTYPE softpkg SYSTEM \"../dtd/softpkg.dtd\">\n') 
    186     postProcessed_spd.writelines(commentLine) 
    187     postProcessed_spd.writelines(remaining) 
    188     postProcessed_spd.close() 
    189     
    190     # Remove temporary files 
    191     os.remove(compDir + '.' + outputFileName_spd + '.tmp') 
     164    # Define <!DOCTYPE> here (overriding template if necessary) 
     165    #doc_spd.doctype.name = u'softpkg' 
     166    #doc_spd.doctype.systemId = u'../dtd/softpkg.dtd' 
     167     
     168    outfile = open(compDir + outputFileName_spd, 'w') 
     169    doc_spd.writexml( outfile, encoding='UTF-8' ) 
     170    outfile.close() 
    192171     
    193172def gen_prf(comp, waveformDir): 
     
    283262    #outputFileName_prf = comp.name + 'Resource' + '.prf.xml' 
    284263     
    285     data = doc_prf.toxml('UTF-8') 
    286     xmlBeautify.beautify(data,compDir + '.' + outputFileName_prf + '.tmp') 
    287  
    288     preProcessed_prf = open(compDir + '.' + outputFileName_prf + '.tmp', 'r') 
    289     postProcessed_prf = open(compDir + outputFileName_prf, 'w') 
    290      
    291     # Specify external DTD 
    292     line0 = preProcessed_prf.readline() 
    293     remaining = preProcessed_prf.readlines() 
    294     postProcessed_prf.writelines(line0) 
    295     postProcessed_prf.writelines(u'<!DOCTYPE properties SYSTEM \"../dtd/properties.dtd\">\n') 
    296     postProcessed_prf.writelines(commentLine) 
    297     postProcessed_prf.writelines(remaining) 
    298     postProcessed_prf.close() 
    299     
    300     # Remove temporary files 
    301     os.remove(compDir + '.' + outputFileName_prf + '.tmp') 
     264    # Define <!DOCTYPE> here (overriding template if necessary) 
     265    #doc_prf.doctype.name = u'properties' 
     266    #doc_prf.doctype.systemId = u'../dtd/properties.dtd' 
     267     
     268    outfile = open(compDir + outputFileName_prf, 'w') 
     269    doc_prf.writexml( outfile, encoding='UTF-8' ) 
     270    outfile.close() 
     271 
  • ossiedev/branches/0.6.x/tools/WaveDev/wavedev/importNode.py

    r5886 r7383  
    105105        localfileNode = softpkgNode.getElementsByTagName("localfile")[0] 
    106106        pathSCD = parent.installPath + "/"  + localfileNode.getAttribute("name") 
     107 
     108        if not os.path.exists(pathSCD): 
     109            errorMsg(parent, "Warning! Could not find " + pathSCD + ".\nCannot import node " + Nname) 
     110            return None 
    107111 
    108112        doc_scd = xml.dom.minidom.parse(pathSCD)