def processXMLElementByDerivation(derivation, xmlElement): 'Process the xml element by derivation.' if derivation == None: derivation = ImportDerivation(xmlElement) if derivation.fileName == None: return parserFileName = xmlElement.getParser().fileName absoluteFileName = archive.getAbsoluteFolderPath(parserFileName, derivation.fileName) if 'models/' not in absoluteFileName: print( 'Warning, models/ was not in the absolute file path, so for security nothing will be done for:' ) print(xmlElement) print('For which the absolute file path is:') print(absoluteFileName) print( 'The import tool can only read a file which has models/ in the file path.' ) print( 'To import the file, move the file into a folder called model/ or a subfolder which is inside the model folder tree.' ) return xmlText = '' if derivation.fileName.endswith('.xml'): xmlText = archive.getFileText(absoluteFileName) else: xmlText = getXMLFromCarvingFileName(absoluteFileName) print('The import tool is opening the file:') print(absoluteFileName) if xmlText == '': print( 'The file %s could not be found by processXMLElement in import.' % derivation.fileName) return if derivation.importName == None: xmlElement.importName = archive.getUntilDot(derivation.fileName) if derivation.basename: xmlElement.importName = os.path.basename(xmlElement.importName) xmlElement.attributeDictionary['_importName'] = xmlElement.importName else: xmlElement.importName = derivation.importName importXMLElement = xml_simple_reader.XMLElement() xml_simple_reader.XMLSimpleReader(parserFileName, importXMLElement, xmlText) for child in importXMLElement.children: child.copyXMLChildren('', xmlElement) evaluate.removeIdentifiersFromDictionary(child.attributeDictionary) xmlElement.attributeDictionary.update(child.attributeDictionary) if derivation.overwriteRoot: xmlElement.getRoot().attributeDictionary.update( child.attributeDictionary) xmlElement.className = 'group' evaluate.processArchivable(group.Group, xmlElement)
def processXMLElementByDerivation(derivation, xmlElement): """Process the xml element by derivation.""" if derivation is None: derivation = ImportDerivation(xmlElement) if derivation.fileName is None: return parserFileName = xmlElement.getParser().fileName absoluteFileName = archive.getAbsoluteFolderPath(parserFileName, derivation.fileName) if 'models/' not in absoluteFileName: print( 'Warning, models/ was not in the absolute file path, so for security nothing will be done for:' ) print(xmlElement) print('For which the absolute file path is:') print(absoluteFileName) print( 'The import tool can only read a file which has models/ in the file path.' ) print( 'To import the file, move the file into a folder called model/ or a subfolder which is inside the model folder tree.' ) return xmlText = '' if derivation.fileName.endswith('.xml'): xmlText = archive.getFileText(absoluteFileName) else: xmlText = getXMLFromCarvingFileName(absoluteFileName) print('The import tool is opening the file:') print(absoluteFileName) if xmlText == '': print('The file %s could not be found by processXMLElement in import.' % derivation.fileName) return if derivation.importName is None: xmlElement.importName = archive.getUntilDot(derivation.fileName) if derivation.basename: xmlElement.importName = os.path.basename(xmlElement.importName) xmlElement.attributeDictionary['_importName'] = xmlElement.importName else: xmlElement.importName = derivation.importName importXMLElement = xml_simple_reader.XMLElement() xml_simple_reader.XMLSimpleReader(parserFileName, importXMLElement, xmlText) for child in importXMLElement.children: child.copyXMLChildren('', xmlElement) evaluate.removeIdentifiersFromDictionary(child.attributeDictionary) xmlElement.attributeDictionary.update(child.attributeDictionary) if derivation.overwriteRoot: xmlElement.getRoot().attributeDictionary.update( child.attributeDictionary) xmlElement.className = 'group' evaluate.processArchivable(group.Group, xmlElement)
def processElementNodeByDerivation(derivation, elementNode): 'Process the xml element by derivation.' if derivation == None: derivation = ImportDerivation(elementNode) if derivation.fileName == None: return parserFileName = elementNode.getOwnerDocument().fileName absoluteFileName = archive.getAbsoluteFolderPath(parserFileName, derivation.fileName) if 'models/' not in absoluteFileName: print( 'Warning, models/ was not in the absolute file path, so for security nothing will be done for:' ) print(elementNode) print('For which the absolute file path is:') print(absoluteFileName) print( 'The import tool can only read a file which has models/ in the file path.' ) print( 'To import the file, move the file into a folder called model/ or a subfolder which is inside the model folder tree.' ) return xmlText = '' if derivation.fileName.endswith('.xml'): xmlText = archive.getFileText(absoluteFileName) else: xmlText = getXMLFromCarvingFileName(absoluteFileName) print('The import tool is opening the file:') print(absoluteFileName) if xmlText == '': print( 'The file %s could not be found by processElementNode in import.' % derivation.fileName) return if derivation.importName == None: elementNode.attributes['_importName'] = archive.getUntilDot( derivation.fileName) if derivation.basename: elementNode.attributes['_importName'] = os.path.basename( elementNode.attributes['_importName']) xml_simple_reader.createAppendByText(elementNode, xmlText) if derivation.appendDocumentElement: appendAttributes(elementNode, elementNode.getDocumentElement()) if derivation.appendElement: appendAttributes(elementNode, elementNode) elementNode.localName = 'group' evaluate.processArchivable(group.Group, elementNode)
def processElementNodeByDerivation(derivation, elementNode): "Process the xml element by derivation." if derivation == None: derivation = ImportDerivation(elementNode) if derivation.fileName == None: return parserFileName = elementNode.getOwnerDocument().fileName absoluteFileName = archive.getAbsoluteFolderPath(parserFileName, derivation.fileName) if "models/" not in absoluteFileName: print("Warning, models/ was not in the absolute file path, so for security nothing will be done for:") print(elementNode) print("For which the absolute file path is:") print(absoluteFileName) print("The import tool can only read a file which has models/ in the file path.") print( "To import the file, move the file into a folder called model/ or a subfolder which is inside the model folder tree." ) return xmlText = "" if derivation.fileName.endswith(".xml"): xmlText = archive.getFileText(absoluteFileName) else: xmlText = getXMLFromCarvingFileName(absoluteFileName) print("The import tool is opening the file:") print(absoluteFileName) if xmlText == "": print("The file %s could not be found by processElementNode in import." % derivation.fileName) return if derivation.importName == None: elementNode.attributes["_importName"] = archive.getUntilDot(derivation.fileName) if derivation.basename: elementNode.attributes["_importName"] = os.path.basename(elementNode.attributes["_importName"]) xml_simple_reader.createAppendByText(elementNode, xmlText) if derivation.appendDocumentElement: appendAttributes(elementNode, elementNode.getDocumentElement()) if derivation.appendElement: appendAttributes(elementNode, elementNode) elementNode.localName = "group" evaluate.processArchivable(group.Group, elementNode)
def processElementNode(elementNode): 'Process the xml element.' evaluate.processArchivable(Cylinder, elementNode)
def processXMLElement(xmlElement): "Process the xml element." evaluate.processArchivable(Path, xmlElement)
def processElementNode(elementNode): "Process the xml element." evaluate.processArchivable(Intersection, elementNode)
def processXMLElement(xmlElement): "Process the xml element." evaluate.processArchivable(Difference, xmlElement)
def processElementNode(elementNode): 'Process the xml element.' evaluate.processArchivable(Cube, elementNode)
def processElementNode(elementNode): 'Process the xml element.' evaluate.processArchivable(TriangleMesh, elementNode)
def processElementNode(elementNode): "Process the xml element." evaluate.processArchivable(Group, elementNode)
def processElementNode(elementNode): "Process the xml element." evaluate.processArchivable(Difference, elementNode)
def processXMLElement(xmlElement): """Process the xml element.""" evaluate.processArchivable(Intersection, xmlElement)
def processXMLElement(xmlElement, xmlProcessor): "Process the xml element." evaluate.processArchivable(Path, xmlElement, xmlProcessor)
def processElementNode(elementNode): 'Process the xml element.' evaluate.processArchivable(Dictionary, elementNode)
def processXMLElement(xmlElement): 'Process the xml element.' evaluate.processArchivable(Cylinder, xmlElement)
def processElementNode(elementNode): 'Process the xml element.' evaluate.processArchivable( Dictionary, elementNode)
def processXMLElement(xmlElement): 'Process the xml element.' evaluate.processArchivable(TriangleMesh, xmlElement)
def processElementNode(elementNode): "Process the xml element." evaluate.processArchivable(group.Group, elementNode)
def processXMLElement(xmlElement): "Process the xml element." evaluate.processArchivable(_Comment, xmlElement)
def processXMLElement(xmlElement): 'Process the xml element.' evaluate.processArchivable(Sphere, xmlElement)
def processXMLElement(xmlElement): 'Process the xml element.' evaluate.processArchivable( Dictionary, xmlElement)
def processXMLElement(xmlElement): """Process the xml element.""" evaluate.processArchivable(Cube, xmlElement)
def processXMLElement(xmlElement): "Process the xml element." evaluate.processArchivable(TriangleMesh, xmlElement)
def processXMLElement(xmlElement, xmlProcessor): "Process the xml element." evaluate.processArchivable(Dictionary, xmlElement, xmlProcessor)
def processXMLElement(xmlElement): "Process the xml element." evaluate.processArchivable( Dictionary, xmlElement)
def processXMLElement(xmlElement): 'Process the xml element.' evaluate.processArchivable(Path, xmlElement)
def processXMLElement(xmlElement): "Process the xml element." evaluate.processArchivable(Intersection, xmlElement)
def processElementNode(elementNode): 'Process the xml element.' evaluate.processArchivable(Path, elementNode)
def processXMLElement( xmlElement, xmlProcessor ): "Process the xml element." evaluate.processArchivable( _Comment, xmlElement, xmlProcessor )