Class: Converter

Converter()

Class for parsing a XML file and extracting a schematic. This static class contains many helper functions to extract information from the file. The extracted node of the schematic view can than be passed to Schematic.fromXML.

Constructor

new Converter()

Source:

Methods

(static) assertTagFound(variable, tagname)

Internal helper function for checking if a variable is correctly set.

The message of the thrown error depends on the data type. If an variable is falsy (null, undefined, etc.) a error with the message "XML-Tag not found: <tagname>" is thrown. If the variable is an empty array, the message is instead "Filtered list of tags is empty: <tagname>".

Parameters:
Name Type Description
variable *

the variable to check

tagname string

the name of the variable for the error message

Source:
Throws:

the Error if variable is falsy or an empty array

Type
Error

(static) findCell(cellArray, cellname) → {Element}

Filters a list of cell nodes by name.

Parameters:
Name Type Description
cellArray Array.<Element>

the array of cells obtained from parseFile

cellname string

the name of the cell to parse or "" to use the first one

Source:
Throws:
  • if cell was not found
Type
Error
Returns:

the wanted cell node

Type
Element

(static) findSchematicView(schematicViewArray, schematicViewName) → {Element}

Find a specific schematic in a list.

Parameters:
Name Type Description
schematicViewArray Array.<Element>

the list of nodes to search in

schematicViewName string

the name of the schematic or "" to use the first one

Source:
Throws:
  • if the desired schematic can not be found
Type
Error
Returns:

the found node

Type
Element

(static) getSchematicViews(cell) → {Array.<Element>}

Finds the schematicviews of a cell.

Parameters:
Name Type Description
cell Element

the cell node to find the schematics in

Source:
Returns:

an array of schematicviews

Type
Array.<Element>

(async, static) parseFile(inFileDescriptor, cellName, scaleopt) → {Array.<Element>}

Parses a file using its file handle. The file will be completely read and a list of cells will be returned.

The file won't be closed.

Parameters:
Name Type Attributes Default Description
inFileDescriptor number

the file descriptor for the file to parse, e.g. 0 for stdin

cellName string

the name of the cell to parse

scale number <optional>
2.54

factor for scaling; ADS uses inch, TikZ uses cm, thus scale=2.54 is recommended

Source:
Throws:

if an expected xml-tag does not exist

Type
Error
Returns:

an array of cells

Type
Array.<Element>

(static) printNodeList(schematicViewArray, headingopt)

Prints the names of found cells or schematics.

Parameters:
Name Type Attributes Description
schematicViewArray Array.<Element>

the list of nodes to search in

heading string <optional>

heading to print

Source: