public static SstDocument Parse(XmlDocument xml, XmlNamespaceManager namespaceManager) { try { SstDocument sstDoc = new SstDocument(); sstDoc.AddNewSst(); CT_Sst sst = sstDoc.GetSst(); sst.count = XmlHelper.ReadInt(xml.DocumentElement.Attributes["count"]); sst.uniqueCount = XmlHelper.ReadInt(xml.DocumentElement.Attributes["uniqueCount"]); XmlNodeList nl = xml.SelectNodes("//d:sst/d:si", namespaceManager); if (nl != null) { foreach (XmlNode node in nl) { CT_Rst rst = CT_Rst.Parse(node, namespaceManager); sstDoc.sst.si.Add(rst); } } return(sstDoc); } catch (XmlException e) { throw new IOException(e.Message); } }
public static CommentsDocument Parse(XmlDocument xmlDoc, XmlNamespaceManager NameSpaceManager) { CommentsDocument commentsDoc = new CommentsDocument(); commentsDoc.comments = new CT_Comments(); foreach (XmlElement node in xmlDoc.SelectNodes("//d:authors/d:author", NameSpaceManager)) { commentsDoc.comments.authors.AddAuthor(node.InnerText); } foreach (XmlElement node in xmlDoc.SelectNodes("//d:commentList/d:comment", NameSpaceManager)) { CT_Comment comment = commentsDoc.comments.commentList.AddNewComment(); comment.authorId = uint.Parse(node.GetAttribute("authorId")); comment.@ref = node.GetAttribute("ref"); comment.text = CT_Rst.Parse(node.ChildNodes[0], NameSpaceManager); } return(commentsDoc); }
public static CT_Cell Parse(XmlNode node, XmlNamespaceManager namespaceManager) { if (node == null) { return(null); } CT_Cell ctObj = new CT_Cell(); ctObj.r = XmlHelper.ReadString(node.Attributes["r"]); ctObj.s = XmlHelper.ReadUInt(node.Attributes["s"]); if (node.Attributes["t"] != null) { ctObj.t = (ST_CellType)Enum.Parse(typeof(ST_CellType), node.Attributes["t"].Value); } ctObj.cm = XmlHelper.ReadUInt(node.Attributes["cm"]); ctObj.vm = XmlHelper.ReadUInt(node.Attributes["vm"]); ctObj.ph = XmlHelper.ReadBool(node.Attributes["ph"]); foreach (XmlNode childNode in node.ChildNodes) { if (childNode.LocalName == "f") { ctObj.f = CT_CellFormula.Parse(childNode, namespaceManager); } else if (childNode.LocalName == "v") { ctObj.v = childNode.InnerText; } else if (childNode.LocalName == "is") { ctObj.@is = CT_Rst.Parse(childNode, namespaceManager); } else if (childNode.LocalName == "extLst") { ctObj.extLst = CT_ExtensionList.Parse(childNode, namespaceManager); } } return(ctObj); }
private string guidField = null; // optional attribute //public CT_Comment() //{ // this.textField = new CT_Rst(); //} public static CT_Comment Parse(XmlNode node, XmlNamespaceManager namespaceManager) { if (node == null) { return(null); } CT_Comment ctObj = new CT_Comment(); ctObj.@ref = XmlHelper.ReadString(node.Attributes["ref"]); if (node.Attributes["authorId"] != null) { ctObj.authorId = XmlHelper.ReadUInt(node.Attributes["authorId"]); } ctObj.guid = XmlHelper.ReadString(node.Attributes["guid"]); foreach (XmlNode childNode in node.ChildNodes) { if (childNode.LocalName == "text") { ctObj.text = CT_Rst.Parse(childNode, namespaceManager); } } return(ctObj); }