FileXml Module

Inheritance diagram of FileXml

Handles loading and saving ERACS data to and from XML file formats. Other XML-related formats such as SVG depend on this module. The lxml Python library is a dependency.

class TEracsFileXml(ADataConverter=None)

Class for reading and writing ERACS XML data files.

Inherits

File.TEracsFile.

LoadFromStrings(ANetworkDataString, ALibraryDataString)

This method converts the given string argument into an XML element and stores it into the NetTree instance variable (Network data) and LibTree instance variable (Library data).

Parameters
  • ANetworkDataString (str) – Network data as a string.

  • ALibraryDataString (str) – Library data as a string.

Load(AFilePathAndName, ATrySameName)

Loads data from the specified file. Clears previous data to make space for the next set of data.

Parameters

AFilePathAndName (str) – The file to load, must have the appropriate extension.

Returns

True if successful

Raises

TEracsArgumentError – If the file doesn’t exist or has the incorrect extension.

Save(AFilePathAndName)
Uses an XML object to write contents to a file (creates a directory if

it doesn’t already exist).

Required

lxml Python library.

Parameters

AFilePathAndName – The file directory (and name) to save the XML contents to.

Returns

True if successfully saved.

Raises