XmlParser#
- class pyedb.xml_parser.xml_parser.XmlParser(/, **data: Any)#
Bases:
pydantic.BaseModelMain parser for EDB XML configuration files.
This class provides methods to load, parse, and export XML configuration files used in EDB designs. It supports stackup definitions, import options, and net configurations.
- Parameters:
- stackup
XmlStackup,optional Stackup configuration object. The default is
None.- import_options
XmlImportOptions,optional Import options configuration. The default is
None.- nets
dict,optional Dictionary of net configurations. The default is
None.- schema_version
str,optional Version of the XML schema. The default is
None.
- stackup
Examples
>>> from pyedb.xml_parser.xml_parser import XmlParser >>> parser = XmlParser.load_xml_file("config.xml") >>> parser.to_xml_file("output.xml")
Overview#
Load and parse an XML configuration file. |
Add a stackup configuration to the parser. |
|
Convert the parser configuration to XML string. |
|
Write the parser configuration to an XML file. |
|
Convert the parser configuration to a dictionary. |
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict]. |
Import detail#
from pyedb.xml_parser.xml_parser import XmlParser
Attribute detail#
- XmlParser.stackup: pyedb.xml_parser.xml_stackup.XmlStackup | None = None#
- XmlParser.import_options: XmlImportOptions | None = None#
- XmlParser.model_config#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
Method detail#
- XmlParser.add_stackup() pyedb.xml_parser.xml_stackup.XmlStackup#
Add a stackup configuration to the parser.
- Returns:
XmlStackupThe newly created stackup object.
Examples
>>> from pyedb.xml_parser.xml_parser import XmlParser >>> parser = XmlParser() >>> stackup = parser.add_stackup()
- classmethod XmlParser.load_xml_file(path: str | pathlib.Path) XmlParser#
Load and parse an XML configuration file.
- Parameters:
- path
strorpathlib.Path Path to the XML file to load.
- path
- Returns:
XmlParserThe parsed XML configuration as an XmlParser instance.
Examples
>>> from pyedb.xml_parser.xml_parser import XmlParser >>> parser = XmlParser.load_xml_file("config.xml") >>> print(parser.stackup)
- XmlParser.to_xml(root_name: str = 'c:Control', pretty: bool = True) str#
Convert the parser configuration to XML string.
- Parameters:
- Returns:
strXML string representation of the configuration.
Examples
>>> from pyedb.xml_parser.xml_parser import XmlParser >>> parser = XmlParser() >>> xml_string = parser.to_xml()
- XmlParser.to_xml_file(file_path: str | pathlib.Path) str#
Write the parser configuration to an XML file.
- Parameters:
- file_path
strorpathlib.Path Path to the output XML file.
- file_path
- Returns:
strPath to the written XML file.
Examples
>>> from pyedb.xml_parser.xml_parser import XmlParser >>> parser = XmlParser() >>> output_path = parser.to_xml_file("output.xml")