Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.11/site-packages/defusedxml/pulldom.py: 67%

Shortcuts on this page

r m x   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

21 statements  

1# defusedxml 

2# 

3# Copyright (c) 2013 by Christian Heimes <christian@python.org> 

4# Licensed to PSF under a Contributor Agreement. 

5# See https://www.python.org/psf/license for licensing details. 

6"""Defused xml.dom.pulldom 

7""" 

8from __future__ import print_function, absolute_import 

9 

10from xml.dom.pulldom import parse as _parse 

11from xml.dom.pulldom import parseString as _parseString 

12from .sax import make_parser 

13 

14__origin__ = "xml.dom.pulldom" 

15 

16 

17def parse( 

18 stream_or_string, 

19 parser=None, 

20 bufsize=None, 

21 forbid_dtd=False, 

22 forbid_entities=True, 

23 forbid_external=True, 

24): 

25 if parser is None: 

26 parser = make_parser() 

27 parser.forbid_dtd = forbid_dtd 

28 parser.forbid_entities = forbid_entities 

29 parser.forbid_external = forbid_external 

30 return _parse(stream_or_string, parser, bufsize) 

31 

32 

33def parseString( 

34 string, parser=None, forbid_dtd=False, forbid_entities=True, forbid_external=True 

35): 

36 if parser is None: 

37 parser = make_parser() 

38 parser.forbid_dtd = forbid_dtd 

39 parser.forbid_entities = forbid_entities 

40 parser.forbid_external = forbid_external 

41 return _parseString(string, parser)