{"action":"closed","issue":{"number":179,"created_at":"2011-10-09T15:37:27Z","pull_request":{"diff_url":null,"patch_url":null,"html_url":null},"body":"Scope of Change\n====\nThe xml.parser.XMLParser class will support parsing streams.\n\n\nRationale\n====\nNot having to load file contents into memory completely before being\nablt to parse them.\n\n\nFunctionality\n====\nThe `xml.parser.XMLParser::parse()` method will be changed to accept \neither strings (as it does now) or `xml.parser.InputSource` objects.\n\nCurrent API\n----\nThis shows that before parsing XML, it needs to be loaded into a string.\nThis may be best for small files but will create memory problems when\nthe file size increases:\n\n\n```php\n<?php\n  $xml= FileUtil::getContents(new File('example.xml'));\n  \n  $parser= new XMLParser();\n  $parser->parse($xml);\n?>\n```\n\n\nNew API\n----\nHere, the parsing is done while loading the file from the stream. Also,\nbecause FileInputStream can easily be substituted for any other input\nstream, it's more flexible.\n\n\n```php\n<?php\n  $parser= new XMLParser();\n  $parser->parse(new FileInputSource(new File('example.xml')));\n?>\n```\n\nMore examples:\n\n```php\n<?php\n  $parser->parse(new StringInputSource($xml));\n  $parser->parse(new FileInputSource(new File('example.xml')));\n  $parser->parse(new StreamInputSource(new FileInputStream(new File('example.xml'))));\n?>\n```\n\n\n\nSecurity considerations\n====\nNone.\n\n\nSpeed impact\n====\nFaster for the stream case.\n\n\nDependencies\n====\nNone, the old behaviour of passing a string to `parse()` will be \nkept.\n\n\nRelated documents\n====\nhttp://xp-framework.net/rfc/contrib/rfc0179.diff\n\nComments\n====\nfriebe, Sun Feb 15 21:45:00     2009\n----\nNot sure whether it wouldn't be more elegant if the InputSource class\nwas an interface, and instead of an if/else on types in the constructor, \ndifferent implementations of it were shipped.\n\nExamples:\n\n```php\n<?php\n  $parser->parse(new StringInputSource($xml));\n  $parser->parse(new FileInputSource(new File('example.xml')));\n  $parser->parse(new StreamInputSource(new FileInputStream(new File('example.xml'))));\n?>\n```\n\nfriebe, Wed May 20 09:50:24     2009\n----\nDecided in favor of the interface approach.\n\n<EOF>\n","comments":0,"title":"RFC 0179: Add stream support to XML parser","updated_at":"2011-10-09T15:37:28Z","url":"https://api.github.com/repos/thekid/rfc/issues/179","id":1856662,"assignee":null,"milestone":null,"closed_at":"2011-10-09T15:37:28Z","user":{"avatar_url":"https://secure.gravatar.com/avatar/26f07e3b262e9a80436f368cb11bd0c2?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","url":"https://api.github.com/users/thekid","id":696742,"login":"thekid"},"html_url":"https://github.com/thekid/rfc/issues/179","labels":[{"name":"implemented","url":"https://api.github.com/repos/thekid/rfc/labels/implemented","color":"e102d8"},{"name":"rfc","url":"https://api.github.com/repos/thekid/rfc/labels/rfc","color":"02e10c"}],"state":"closed"},"legacy":{"number":179,"action":"closed","issue":1856662}}