Qucs-S S-parameter Viewer & RF Synthesis Tools
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Static Public Attributes | Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
bs4.builder._lxml.LXMLTreeBuilderForXML Class Reference
Inheritance diagram for bs4.builder._lxml.LXMLTreeBuilderForXML:
Inheritance graph
[legend]
Collaboration diagram for bs4.builder._lxml.LXMLTreeBuilderForXML:
Collaboration graph
[legend]

Public Member Functions

None initialize_soup (self, BeautifulSoup soup)
 
_ParserOrParserClass default_parser (self, Optional[_Encoding] encoding)
 
_LXMLParser parser_for (self, Optional[_Encoding] encoding)
 
 __init__ (self, Optional[etree.XMLParser] parser=None, Optional[Set[str]] empty_element_tags=None, bool huge_tree=False, **Any kwargs)
 
Iterable[ Tuple[Union[str, bytes], Optional[_Encoding], Optional[_Encoding], bool]] prepare_markup (self, _RawMarkup markup, Optional[_Encoding] user_specified_encoding=None, Optional[_Encoding] document_declared_encoding=None, Optional[_Encodings] exclude_encodings=None)
 
None feed (self, _RawMarkup markup)
 
None close (self)
 
None start (self, str|bytes tag, Dict[str|bytes, str|bytes] attrib, _NamespaceMapping nsmap={})
 
None end (self, str|bytes tag)
 
None pi (self, str target, str data)
 
None data (self, str|bytes data)
 
None doctype (self, str name, str pubid, str system)
 
None comment (self, str|bytes text)
 
str test_fragment_to_document (self, str fragment)
 
- Public Member Functions inherited from bs4.builder.TreeBuilder
None reset (self)
 
bool can_be_empty_element (self, str tag_name)
 
bool set_up_substitutions (self, Tag tag)
 

Public Attributes

 DEFAULT_NSMAPS
 
 soup
 
 nsmaps
 
 active_namespace_prefixes
 
 processing_instruction_class
 
 huge_tree
 
 parser
 
- Public Attributes inherited from bs4.builder.TreeBuilder
 soup
 
 cdata_list_attributes
 
 preserve_whitespace_tags
 
 empty_element_tags
 
 store_line_numbers
 
 string_containers
 
 attribute_dict_class
 
 attribute_value_list_class
 

Static Public Attributes

Type DEFAULT_PARSER_CLASS = etree.XMLParser
 
bool is_xml = True
 
bool huge_tree
 
Type processing_instruction_class [ProcessingInstruction]
 
str NAME = "lxml-xml"
 
list ALTERNATE_NAMES = ["xml"]
 
list features = [NAME, LXML, XML, FAST, PERMISSIVE]
 
int CHUNK_SIZE = 512
 
_NamespaceMapping DEFAULT_NSMAPS = dict(xml="http://www.w3.org/XML/1998/namespace")
 
_InvertedNamespaceMapping DEFAULT_NSMAPS_INVERTED = _invert(DEFAULT_NSMAPS)
 
List nsmaps [Optional[_InvertedNamespaceMapping]]
 
Optional empty_element_tags [Set[str]]
 
Any parser
 
- Static Public Attributes inherited from bs4.builder.TreeBuilder
Any USE_DEFAULT = object()
 
str NAME = "[Unknown tree builder]"
 
list ALTERNATE_NAMES = []
 
list features = []
 
bool is_xml = False
 
bool picklable = False
 
Optional soup [BeautifulSoup]
 
Optional empty_element_tags = None
 
Dict cdata_list_attributes [str, Set[str]]
 
Set preserve_whitespace_tags [str]
 
Dict string_containers [str, Type[NavigableString]]
 
bool tracks_line_numbers
 
Dict DEFAULT_CDATA_LIST_ATTRIBUTES = defaultdict(set)
 
Set DEFAULT_PRESERVE_WHITESPACE_TAGS = set()
 
dict DEFAULT_STRING_CONTAINERS = {}
 
Optional DEFAULT_EMPTY_ELEMENT_TAGS = None
 
bool TRACKS_LINE_NUMBERS = False
 

Protected Member Functions

None _register_namespaces (self, Dict[str, str] mapping)
 
Tuple[Optional[str], str] _getNsTag (self, str tag)
 
Optional[_NamespacePrefix] _prefix_for_namespace (self, Optional[_NamespaceURL] namespace)
 
- Protected Member Functions inherited from bs4.builder.TreeBuilder
_AttributeValues _replace_cdata_list_attribute_values (self, str tag_name, _RawOrProcessedAttributeValues attrs)
 

Protected Attributes

 _default_parser
 

Static Protected Attributes

Optional _default_parser [etree.XMLParser]
 

Constructor & Destructor Documentation

◆ __init__()

bs4.builder._lxml.LXMLTreeBuilderForXML.__init__ (   self,
Optional[etree.XMLParser]   parser = None,
Optional[Set[str]]   empty_element_tags = None,
bool   huge_tree = False,
**Any  kwargs 
)

Reimplemented from bs4.builder.TreeBuilder.

Member Function Documentation

◆ _prefix_for_namespace()

Optional[_NamespacePrefix] bs4.builder._lxml.LXMLTreeBuilderForXML._prefix_for_namespace (   self,
Optional[_NamespaceURL]   namespace 
)
protected
Find the currently active prefix for the given namespace.

◆ _register_namespaces()

None bs4.builder._lxml.LXMLTreeBuilderForXML._register_namespaces (   self,
Dict[str, str]  mapping 
)
protected
Let the BeautifulSoup object know about namespaces encountered
while parsing the document.

This might be useful later on when creating CSS selectors.

This will track (almost) all namespaces, even ones that were
only in scope for part of the document. If two namespaces have
the same prefix, only the first one encountered will be
tracked. Un-prefixed namespaces are not tracked.

:param mapping: A dictionary mapping namespace prefixes to URIs.

◆ default_parser()

_ParserOrParserClass bs4.builder._lxml.LXMLTreeBuilderForXML.default_parser (   self,
Optional[_Encoding]  encoding 
)
Find the default parser for the given encoding.

:return: Either a parser object or a class, which
  will be instantiated with default arguments.

Reimplemented in bs4.builder._lxml.LXMLTreeBuilder.

◆ feed()

None bs4.builder._lxml.LXMLTreeBuilderForXML.feed (   self,
_RawMarkup  markup 
)
Run incoming markup through some parsing process.

Reimplemented from bs4.builder.TreeBuilder.

Reimplemented in bs4.builder._lxml.LXMLTreeBuilder.

◆ initialize_soup()

None bs4.builder._lxml.LXMLTreeBuilderForXML.initialize_soup (   self,
BeautifulSoup  soup 
)
Let the BeautifulSoup object know about the standard namespace
mapping.

:param soup: A `BeautifulSoup`.

Reimplemented from bs4.builder.TreeBuilder.

◆ parser_for()

_LXMLParser bs4.builder._lxml.LXMLTreeBuilderForXML.parser_for (   self,
Optional[_Encoding]  encoding 
)
Instantiate an appropriate parser for the given encoding.

:param encoding: A string.
:return: A parser object such as an `etree.XMLParser`.

◆ prepare_markup()

Iterable[ Tuple[Union[str, bytes], Optional[_Encoding], Optional[_Encoding], bool] ] bs4.builder._lxml.LXMLTreeBuilderForXML.prepare_markup (   self,
_RawMarkup  markup,
Optional[_Encoding]   user_specified_encoding = None,
Optional[_Encoding]   document_declared_encoding = None,
Optional[_Encodings]   exclude_encodings = None 
)
Run any preliminary steps necessary to make incoming markup
acceptable to the parser.

lxml really wants to get a bytestring and convert it to
Unicode itself. So instead of using UnicodeDammit to convert
the bytestring to Unicode using different encodings, this
implementation uses EncodingDetector to iterate over the
encodings, and tell lxml to try to parse the document as each
one in turn.

:param markup: Some markup -- hopefully a bytestring.
:param user_specified_encoding: The user asked to try this encoding.
:param document_declared_encoding: The markup itself claims to be
    in this encoding.
:param exclude_encodings: The user asked _not_ to try any of
    these encodings.

:yield: A series of 4-tuples: (markup, encoding, declared encoding,
    has undergone character replacement)

    Each 4-tuple represents a strategy for converting the
    document to Unicode and parsing it. Each strategy will be tried
    in turn.

Reimplemented from bs4.builder.TreeBuilder.

◆ test_fragment_to_document()

str bs4.builder._lxml.LXMLTreeBuilderForXML.test_fragment_to_document (   self,
str  fragment 
)
See `TreeBuilder`.

Reimplemented from bs4.builder.TreeBuilder.

Reimplemented in bs4.builder._lxml.LXMLTreeBuilder.


The documentation for this class was generated from the following file: