Guest User

Untitled

a guest
Apr 24th, 2018
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.98 KB | None | 0 0
  1. //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  2. // Copyright (c) <year> <copyright holders>
  3. //
  4. // Permission is hereby granted, free of charge, to any person obtaining a copy of this software
  5. // and associated documentation files (the "Software"), to deal in the Software without restriction,
  6. // including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
  7. // and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
  8. // subject to the following conditions:
  9. //
  10. // The above copyright notice and this permission notice shall be included in all copies or substantial
  11. // portions of the Software.
  12. //
  13. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
  14. // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
  15. // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
  16. // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
  17. // OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  18. //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  19. package cc.varga.utils
  20. {
  21. import flash.filesystem.FileStream;
  22. import flash.xml.XMLDocument;
  23.  
  24. import mx.rpc.xml.SimpleXMLDecoder;
  25.  
  26. public class FileStreamToXMLConverter
  27. {
  28. public function FileStreamToXMLConverter()
  29. {
  30. }
  31.  
  32. public static function convertFileStreamToObj(fileStrem:FileStream):*{
  33.  
  34. var xmlString : String = String(fileStrem.readUTFBytes(fileStrem.bytesAvailable));
  35. var xmlDocument : XMLDocument = new XMLDocument(xmlString);
  36. var decoder : SimpleXMLDecoder = new SimpleXMLDecoder(true);
  37.  
  38. var xmlObj : Object = decoder.decodeXML(xmlDocument);
  39.  
  40. return xmlObj;
  41.  
  42. xmlDocument = null;
  43. xmlString = null;
  44. decoder = null;
  45. xmlObj = null;
  46.  
  47. }
  48.  
  49. }
  50. }
Add Comment
Please, Sign In to add comment