Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions pydantic_xml/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -517,16 +517,19 @@ def from_xml_tree(cls: Type[ModelT], root: etree.Element, context: Optional[Dict
)

@classmethod
def from_xml(cls: Type[ModelT], source: Union[str, bytes], context: Optional[Dict[str, Any]] = None) -> ModelT:
def from_xml(
cls: Type[ModelT], source: Union[str, bytes], context: Optional[Dict[str, Any]] = None, **kwargs: Any,
) -> ModelT:
"""
Deserializes an xml string to an object of `cls` type.

:param source: xml string
:param context: pydantic validation context
:param kwargs: additional xml deserialization arguments
:return: deserialized object
"""

return cls.from_xml_tree(etree.fromstring(source), context=context)
return cls.from_xml_tree(etree.fromstring(source, **kwargs), context=context)

def to_xml_tree(
self, *, skip_empty: bool = False, exclude_none: bool = False, exclude_unset: bool = False,
Expand Down