def writeXMLElement(fileNames, target, xmlElement):
 object = target.object
 if (object == None):
  print 'Warning, writeTarget in write could not get object for:'
  print xmlElement
  return
 fileNameRoot = evaluate.getEvaluatedStringDefault('', 'name', target)
 fileNameRoot = evaluate.getEvaluatedStringDefault(fileNameRoot, 'id', target)
 fileNameRoot = evaluate.getEvaluatedStringDefault(fileNameRoot, 'file', xmlElement)
 fileNameRoot += evaluate.getEvaluatedStringDefault('', 'suffix', xmlElement)
 extension = evaluate.getEvaluatedStringDefault(object.getFabricationExtension(), 'extension', xmlElement)
 fileName = ('%s.%s' % (fileNameRoot, extension))
 suffixIndex = 1
 while (fileName in fileNames):
  fileName = ('%s_%s.%s' % (fileNameRoot, suffixIndex, extension))
  suffixIndex += 1
 fileNames.append(fileName)
 folderName = evaluate.getEvaluatedStringDefault('', 'folder', xmlElement)
 absoluteFolderDirectory = os.path.join(os.path.dirname(xmlElement.getRoot().parser.fileName), folderName)
 archive.makeDirectory(absoluteFolderDirectory)
 archive.writeFileText(os.path.join(absoluteFolderDirectory, fileName), object.getFabricationText())

def writeXMLElement ( fileNames , target , xmlElement ) : object = target . object if ( object == None ) : print 'Warning, writeTarget in write could not get object for:' print xmlElement return fileNameRoot = evaluate . getEvaluatedStringDefault ( '' , 'name' , target ) fileNameRoot = evaluate . getEvaluatedStringDefault ( fileNameRoot , 'id' , target ) fileNameRoot = evaluate . getEvaluatedStringDefault ( fileNameRoot , 'file' , xmlElement ) fileNameRoot += evaluate . getEvaluatedStringDefault ( '' , 'suffix' , xmlElement ) extension = evaluate . getEvaluatedStringDefault ( object . getFabricationExtension ( ) , 'extension' , xmlElement ) fileName = ( '%s.%s' % ( fileNameRoot , extension ) ) suffixIndex = 1 while ( fileName in fileNames ) : fileName = ( '%s_%s.%s' % ( fileNameRoot , suffixIndex , extension ) ) suffixIndex += 1 fileNames . append ( fileName ) folderName = evaluate . getEvaluatedStringDefault ( '' , 'folder' , xmlElement ) absoluteFolderDirectory = os . path . join ( os . path . dirname ( xmlElement . getRoot ( ) . parser . fileName ) , folderName ) archive . makeDirectory ( absoluteFolderDirectory ) archive . writeFileText ( os . path . join ( absoluteFolderDirectory , fileName ) , object . getFabricationText ( ) )
write target .