Search Unity

WP8 and WS XmlDocument problems

Discussion in 'Windows' started by phime-studio, Jun 20, 2014.

  1. phime-studio

    phime-studio

    Joined:
    Nov 16, 2009
    Posts:
    49
    Hi to all! I'm going crazy with this XmlDocument loading problems.
    In WPA builds i managed to get it working via Filestream and not the filename String

    Code (CSharp):
    1. public static void LoadLevel( string levelName )
    2.     {
    3.        
    4.         string path = Application.streamingAssetsPath + "/Levels/" + levelName;
    5.         FileStream fs = File.OpenRead(path);          
    6.         XmlDocument xmlDoc = new XmlDocument();
    7.                
    8.             xmlDoc.Load(fs);
    9.             XmlNodeList transformList = xmlDoc.GetElementsByTagName("tile");
    but with WSA Filestream is not supported but according to Unity docs XmlDocument should load with

    Code (CSharp):
    1. public static void LoadLevel( string levelName )
    2.     {
    3.        
    4.         string path = Application.streamingAssetsPath + "/Levels/" + levelName;
    5. XmlDocument xmlDoc = new XmlDocument();
    6.             xmlDoc.Load(path);
    7.             XmlNodeList transformList = xmlDoc.GetElementsByTagName("tile");
    but I'm getting an error URI must be absolute etc. I've tried everything absolute, relative URI but none of this is working.
    Any solutions ?
     
  2. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    3,732
    The problem is that we provide out own implementation for XmlDocument on WSA/WP8 and it has some limitations.
    Try using URIs like isostore:/ on WP8 or ms-appx:/// on WSA with proper path appended (subdirectory in your applications install folder).