public static Story ReadXml(XmlReader reader) { Story s = new Story(); s.Self = reader.GetAttribute("Self"); s.AppliedNamedGrid = reader.GetAttribute("AppliedNamedGrid"); s.AppliedTOCStyle = reader.GetAttribute("AppliedTOCStyle"); s.StoryTitle = reader.GetAttribute("StoryTitle"); s.TrackChanges = Parser.ParseBoolean(reader.GetAttribute("TrackChanges")); if (reader.IsEmptyElement) { return(s); } while (reader.Read()) { switch (reader.Name) { case "ParagraphStyleRange": s.Children.Add(ParagraphStyleRange.ReadXml(reader)); break; case "StoryPreference": s.StoryPreference = StoryPreference.ReadXml(reader); break; case "InCopyExportOption": s.InCopyExportOption = InCopyExportOption.ReadXml(reader); break; case "XMLElement": s.Children.Add(Stories.XmlElement.ReadXml(reader)); break; case "Content": s.Children.Add(new Content(reader.ReadString())); break; case "Br": s.Children.Add(new Br()); break; case "Story": if (reader.NodeType == XmlNodeType.EndElement) { goto exit1; } break; default: Debug.WriteLine("Unrecognized element: {0} in element: {1}", reader.Name, "Story"); break; } } exit1: return(s); }
public static Note ReadNote(XmlReader reader) { Note n = new Note(); n.Collapsed = Parser.ParseBoolean(reader.GetAttribute("Collapsed")); n.CreationDate = Parser.ParseDate(reader.GetAttribute("CreationDate")); n.ModificationDate = Parser.ParseDate(reader.GetAttribute("ModificationDate")); n.UserName = System.Convert.ToString(reader.GetAttribute("UserName")); n.AppliedDocumentUser = System.Convert.ToString(reader.GetAttribute("AppliedDocumentUser")); while (reader.Read()) { if ((string)reader.Name == "Footnote") { n.Children.Add(Footnote.ReadXml(reader)); } else if ((string)reader.Name == "GaijiOwnedItemObject") { n.Children.Add(GaijiOwnedItemObject.ReadXml(reader)); } else if ((string)reader.Name == "TextVariableInstance") { n.Children.Add(TextVariableInstance.ReadXml(reader)); } else if ((string)reader.Name == "Table") { n.Children.Add(Table.ReadXml(reader)); } else if ((string)reader.Name == "ParagraphStyleRange") { n.Children.Add(ParagraphStyleRange.ReadXml(reader)); } else if ((string)reader.Name == "CharacterStyleRange") { n.Children.Add(CharacterStyleRange.ReadXml(reader)); } else if ((string)reader.Name == "HiddenText") { n.Children.Add(HiddenText.ReadXml(reader)); } else if ((string)reader.Name == "Note") { if (reader.NodeType == XmlNodeType.EndElement) { break; } } else { Debug.WriteLine("Unrecognized element: {0} in element: {1}", reader.Name, "Note"); } } return(n); }
public static Footnote ReadXml(XmlReader reader) { Footnote fn = new Footnote(); if (reader.IsEmptyElement) { return(fn); } while (reader.Read()) { switch (reader.Name) { case "GaijiOwnedItemObject": fn.Children.Add(GaijiOwnedItemObject.ReadXml(reader)); break; case "TextVariableInstance": fn.Children.Add(TextVariableInstance.ReadXml(reader)); break; case "Table": fn.Children.Add(Table.ReadXml(reader)); break; case "ParagraphStyleRange": fn.Children.Add(ParagraphStyleRange.ReadXml(reader)); break; case "CharacterStyleRange": fn.Children.Add(CharacterStyleRange.ReadXml(reader)); break; case "HiddenText": fn.Children.Add(HiddenText.ReadXml(reader)); break; case "Note": if (reader.NodeType == XmlNodeType.EndElement) { goto exit1; } break; default: Debug.WriteLine("Unrecognized element: {0} in element: {1}", reader.Name, "Note"); break; } } exit1: return(fn); }
public static XmlElement ReadXml(XmlReader reader) { XmlElement xe = new XmlElement(); if (reader.HasAttributes) { xe.Self = reader.GetAttribute("Self"); xe.MarkupTag = reader.GetAttribute("MarkupTag"); xe.XmlContent = reader.GetAttribute("XMLContent"); xe.NoTextMarker = Parser.ParseBoolean(reader.GetAttribute("NoTextMarker")); } if (reader.IsEmptyElement) { return(xe); } while (reader.Read()) { switch (reader.Name) { case "XMLAttribute": xe.Children.Add(XmlAttribute.ReadXml(reader)); break; case "XMLElement": if (reader.NodeType == XmlNodeType.EndElement) { goto exit1; } else { xe.Children.Add(XmlElement.ReadXml(reader)); } break; case "XMLComment": xe.Children.Add(XmlComment.ReadXml(reader)); break; case "XMLInstruction": xe.Children.Add(XmlInstruction.ReadXml(reader)); break; case "Table": xe.Children.Add(Table.ReadXml(reader)); break; case "Footnote": xe.Children.Add(Footnote.ReadXml(reader)); break; case "Note": xe.Children.Add(Note.ReadNote(reader)); break; case "GaijiOwnedItemObject": xe.Children.Add(GaijiOwnedItemObject.ReadXml(reader)); break; case "TextVariableInstance": xe.Children.Add(TextVariableInstance.ReadXml(reader)); break; //add more cases here case "HiddenText": xe.Children.Add(HiddenText.ReadXml(reader)); break; //add more cases here case "ParagraphStyleRange": xe.Children.Add(ParagraphStyleRange.ReadXml(reader)); break; case "CharacterStyleRange": xe.Children.Add(CharacterStyleRange.ReadXml(reader)); break; case "Content": xe.Children.Add(new Content(reader.ReadString())); break; case "Br": xe.Children.Add(new Br()); break; case "": break; default: break; } } exit1: return(xe); }
public static ParagraphStyleRange ReadXml(XmlReader reader) { ParagraphStyleRange psr = new ParagraphStyleRange(); if (reader.HasAttributes) { psr.AppliedParagraphStyle = reader.GetAttribute("AppliedParagraphStyle"); } if (reader.IsEmptyElement) { return(psr); } while (reader.Read()) { switch (reader.Name) { case "Footnote": psr.Children.Add(Footnote.ReadXml(reader)); break; case "GaijiOwnedItemObject": psr.Children.Add(GaijiOwnedItemObject.ReadXml(reader)); break; case "Note": psr.Children.Add(Note.ReadNote(reader)); break; case "Table": psr.Children.Add(Table.ReadXml(reader)); break; case "TextVariableInstance": psr.Children.Add(TextVariableInstance.ReadXml(reader)); break; case "HiddenText": psr.Children.Add(HiddenText.ReadXml(reader)); break; case "XMLElement": psr.Children.Add(XmlElement.ReadXml(reader)); break; case "HyperlinkTextSource": psr.Children.Add(HyperlinkTextSource.ReadXml(reader)); break; case "CharacterStyleRange": psr.Children.Add(CharacterStyleRange.ReadXml(reader)); break; case "Content": psr.Children.Add(new Content(reader.ReadString())); break; case "Br": psr.Children.Add(new Br()); break; case "ParagraphStyleRange": if (reader.NodeType == XmlNodeType.EndElement) { goto exit1; } break; default: Debug.WriteLine("Unrecognized element: {0} in element: {1}", reader.Name, "ParagraphStyleRange"); break; } } exit1: return(psr); }
public static Cell ReadXml(XmlReader reader) { Cell result = new Cell(); if (reader.HasAttributes) { result.Self = System.Convert.ToString(reader.GetAttribute("Self")); result.Name = System.Convert.ToString(reader.GetAttribute("Name")); result.RowSpan = System.Convert.ToInt32(reader.GetAttribute("RowSpan")); result.ColumnSpan = System.Convert.ToInt32(reader.GetAttribute("RowSpan")); result.CellType = System.Convert.ToString(reader.GetAttribute("CellType")); result.TextTopInset = Parser.ParseDouble(reader.GetAttribute("TextTopInset")); result.TextLeftInset = Parser.ParseDouble(reader.GetAttribute("TextLeftInset")); result.TextBottomInset = Parser.ParseDouble(reader.GetAttribute("TextBottomInset")); result.TextRightInset = Parser.ParseDouble(reader.GetAttribute("TextRightInset")); result.ClipContentToTextCell = Parser.ParseBoolean(reader.GetAttribute("ShowMasterItems")); result.AppliedCellStyle = System.Convert.ToString(reader.GetAttribute("CellType")); result.AppliedCellStylePriority = System.Convert.ToInt32(reader.GetAttribute("AppliedCellStylePriority")); result.TopInset = Parser.ParseDouble(reader.GetAttribute("TopInset")); result.LeftInset = Parser.ParseDouble(reader.GetAttribute("LeftInset")); result.BottomInset = Parser.ParseDouble(reader.GetAttribute("BottomInset")); result.RightInset = Parser.ParseDouble(reader.GetAttribute("RightInset")); result.FillColor = System.Convert.ToString(reader.GetAttribute("FillColor")); result.FillTint = System.Convert.ToInt32(reader.GetAttribute("FillTint")); result.LeftEdgeStrokeWeight = Parser.ParseDouble(reader.GetAttribute("LeftEdgeStrokeWeight")); result.RightEdgeStrokeWeight = Parser.ParseDouble(reader.GetAttribute("RightEdgeStrokeWeight")); result.TopEdgeStrokeWeight = Parser.ParseDouble(reader.GetAttribute("TopEdgeStrokeWeight")); result.BottomEdgeStrokeWeight = Parser.ParseDouble(reader.GetAttribute("BottomEdgeStrokeWeight")); result.LeftEdgeStrokeColor = System.Convert.ToString(reader.GetAttribute("LeftEdgeStrokeColor")); result.TopEdgeStrokeColor = System.Convert.ToString(reader.GetAttribute("TopEdgeStrokeColor")); result.RightEdgeStrokeColor = System.Convert.ToString(reader.GetAttribute("RightEdgeStrokeColor")); result.BottomEdgeStrokeColor = System.Convert.ToString(reader.GetAttribute("BottomEdgeStrokeColor")); result.LeftEdgeStrokeType = System.Convert.ToString(reader.GetAttribute("LeftEdgeStrokeType")); result.RightEdgeStrokeType = System.Convert.ToString(reader.GetAttribute("RightEdgeStrokeType")); result.TopEdgeStrokeType = System.Convert.ToString(reader.GetAttribute("TopEdgeStrokeType")); result.BottomEdgeStrokeType = System.Convert.ToString(reader.GetAttribute("BottomEdgeStrokeType")); result.FirstBaselineOffset = System.Convert.ToString(reader.GetAttribute("FirstBaselineOffset")); result.VerticalJustification = (VerticalJustification?)Parser.ParseEnum <VerticalJustification>(reader.GetAttribute("VerticalJustification")); result.LeftEdgeStrokeTint = System.Convert.ToInt32(reader.GetAttribute("LeftEdgeStrokeTint")); result.RightEdgeStrokeTint = System.Convert.ToInt32(reader.GetAttribute("RightEdgeStrokeTint")); result.TopEdgeStrokeTint = System.Convert.ToInt32(reader.GetAttribute("TopEdgeStrokeTint")); result.BottomEdgeStrokeTint = System.Convert.ToInt32(reader.GetAttribute("BottomEdgeStrokeTint")); result.LeftEdgeStrokeOverprint = Parser.ParseBoolean(reader.GetAttribute("LeftEdgeStrokeOverprint")); result.RightEdgeStrokeOverprint = Parser.ParseBoolean(reader.GetAttribute("RightEdgeStrokeOverprint")); result.TopEdgeStrokeOverprint = Parser.ParseBoolean(reader.GetAttribute("TopEdgeStrokeOverprint")); result.BottomEdgeStrokeOverprint = Parser.ParseBoolean(reader.GetAttribute("BottomEdgeStrokeOverprint")); result.WritingDirection = Parser.ParseBoolean(reader.GetAttribute("WritingDirection")); result.LeftEdgeStrokePriority = Parser.ParseDouble(reader.GetAttribute("LeftEdgeStrokePriority")); result.RightEdgeStrokePriority = Parser.ParseDouble(reader.GetAttribute("RightEdgeStrokePriority")); result.TopEdgeStrokePriority = Parser.ParseDouble(reader.GetAttribute("TopEdgeStrokePriority")); result.BottomEdgeStrokePriority = Parser.ParseDouble(reader.GetAttribute("BottomEdgeStrokePriority")); result.LeftEdgeStrokeGapTint = System.Convert.ToInt32(reader.GetAttribute("LeftEdgeStrokeGapTint")); result.RightEdgeStrokeGapTint = System.Convert.ToInt32(reader.GetAttribute("RightEdgeStrokeGapTint")); result.TopEdgeStrokeGapTint = System.Convert.ToInt32(reader.GetAttribute("TopEdgeStrokeGapTint")); result.BottomEdgeStrokeGapTint = System.Convert.ToInt32(reader.GetAttribute("BottomEdgeStrokeGapTint")); result.LeftEdgeStrokeGapOverprint = Parser.ParseBoolean(reader.GetAttribute("LeftEdgeStrokeGapOverprint")); result.RightEdgeStrokeGapOverprint = Parser.ParseBoolean(reader.GetAttribute("RightEdgeStrokeGapOverprint")); result.TopEdgeStrokeGapOverprint = Parser.ParseBoolean(reader.GetAttribute("TopEdgeStrokeGapOverprint")); result.BottomEdgeStrokeGapOverprint = Parser.ParseBoolean(reader.GetAttribute("BottomEdgeStrokeGapOverprint")); } if (reader.IsEmptyElement) { return(result); } while (reader.Read()) { switch (reader.Name) { case "ParagraphStyleRange": result.Children.Add(ParagraphStyleRange.ReadXml(reader)); break; case "Cell": if (reader.NodeType == XmlNodeType.EndElement) { goto exit1; } break; default: Debug.WriteLine("Unrecognized element: {0} in element: {1}", reader.Name, "Note"); break; } } exit1: return(result); }