public bool TryParse(string xml, string basePath, out Poml poml) { try { poml = ParseXml(xml, basePath); return(true); } catch (XmlException) { try { var modifiedXml = $"<root>{xml}</root>"; poml = ParseXml(modifiedXml, basePath); return(true); } catch (Exception e) { Debug.LogWarning(e); } } catch (Exception e) { Debug.LogWarning(e); } poml = null; return(false); }
private Poml ParseXml(string xml, string basePath) { var parseXml = xml; var xmlDocument = new XmlDocument(); xmlDocument.LoadXml(parseXml); var scene = xmlDocument.SelectSingleNode("//scene"); var pomlScene = ParseScene(scene, basePath); var resource = xmlDocument.SelectSingleNode("//resource"); var pomlResource = ParseResource(resource, basePath); var poml = new Poml() { Scene = pomlScene, Resource = pomlResource }; return(poml); }