Skip to content

Commit 4fd068e

Browse files
authored
Merge pull request #249 from dapper91/feat/deserializer-args
- model deserialization additional arguments added.
2 parents 00f560f + 3590fae commit 4fd068e

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

pydantic_xml/model.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -517,16 +517,19 @@ def from_xml_tree(cls: Type[ModelT], root: etree.Element, context: Optional[Dict
517517
)
518518

519519
@classmethod
520-
def from_xml(cls: Type[ModelT], source: Union[str, bytes], context: Optional[Dict[str, Any]] = None) -> ModelT:
520+
def from_xml(
521+
cls: Type[ModelT], source: Union[str, bytes], context: Optional[Dict[str, Any]] = None, **kwargs: Any,
522+
) -> ModelT:
521523
"""
522524
Deserializes an xml string to an object of `cls` type.
523525
524526
:param source: xml string
525527
:param context: pydantic validation context
528+
:param kwargs: additional xml deserialization arguments
526529
:return: deserialized object
527530
"""
528531

529-
return cls.from_xml_tree(etree.fromstring(source), context=context)
532+
return cls.from_xml_tree(etree.fromstring(source, **kwargs), context=context)
530533

531534
def to_xml_tree(
532535
self, *, skip_empty: bool = False, exclude_none: bool = False, exclude_unset: bool = False,

0 commit comments

Comments
 (0)