예제 #1
0
        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);
        }
예제 #2
0
        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);
        }
예제 #3
0
        public static HyperlinkTextSource ReadXml(XmlReader reader)
        {
            HyperlinkTextSource psr = new HyperlinkTextSource();

            if (reader.HasAttributes)
            {
                psr.Self   = reader.GetAttribute("Self");
                psr.Name   = reader.GetAttribute("Name");
                psr.Hidden = Parser.ParseBoolean(reader.GetAttribute("Hidden"));
                psr.AppliedCharacterStyle = reader.GetAttribute("AppliedCharacterStyle");
            }

            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 "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 "HyperlinkTextSource":
                    if (reader.NodeType == XmlNodeType.EndElement)
                    {
                        goto exit1;
                    }
                    break;

                default:
                    Debug.WriteLine("Unrecognized element: {0} in element: {1}", reader.Name, "HyperlinkTextSource");
                    break;
                }
            }

exit1:
            return(psr);
        }
예제 #4
0
        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);
        }
예제 #5
0
        public static CharacterStyleRange ReadXml(XmlReader reader)
        {
            CharacterStyleRange csr = new CharacterStyleRange();

            if (reader.HasAttributes)
            {
                csr.AppliedCharacterStyle = reader.GetAttribute("AppliedCharacterStyle");
                csr.FillColor             = reader.GetAttribute("FillColor");
                csr.FontStyle             = reader.GetAttribute("FontStyle");
                csr.PointSize             = reader.GetAttribute("PointSize");
                csr.PositionValue         = (Position?)Parser.ParseEnum <Position>(reader.GetAttribute("Position"));
            }

            if (reader.IsEmptyElement)
            {
                return(csr);
            }

            while (reader.Read())
            {
                switch (reader.Name)
                {
                case "Properties":
                    while (reader.Read())
                    {
                        switch (reader.Name)
                        {
                        case "Leading":
                            csr.Leading = reader.ReadString();
                            break;

                        case "AppliedFont":
                            csr.AppliedFont = reader.ReadString();
                            break;

                        case "Properties":
                            if (reader.NodeType == XmlNodeType.EndElement)
                            {
                                goto exit1;
                            }

                            break;

                        default:
                            Debug.WriteLine("Unrecognized element: {0} in element: {1}", reader.Name, "CharacterStyleRange -> Properties");
                            break;
                        }
                    }
exit1:
                    break;

                case "Footnote":
                    csr.Children.Add(Footnote.ReadXml(reader));
                    break;

                case "GaijiOwnedItemObject":
                    csr.Children.Add(GaijiOwnedItemObject.ReadXml(reader));
                    break;

                case "Note":
                    csr.Children.Add(Note.ReadNote(reader));
                    break;

                case "Table":
                    csr.Children.Add(Table.ReadXml(reader));
                    break;

                case "TextVariableInstance":
                    csr.Children.Add(TextVariableInstance.ReadXml(reader));
                    break;

                //add more cases here
                case "XMLElement":
                    csr.Children.Add(XmlElement.ReadXml(reader));
                    break;

                case "HiddenText":
                    csr.Children.Add(HiddenText.ReadXml(reader));
                    break;

                case "Content":
                    csr.Children.Add(new Content(reader.ReadString()));
                    break;

                case "Br":
                    csr.Children.Add(new Br());
                    break;

                case "HyperlinkTextSource":
                    csr.Children.Add(HyperlinkTextSource.ReadXml(reader));
                    break;

                case "CharacterStyleRange":
                    if (reader.NodeType == XmlNodeType.EndElement)
                    {
                        goto exit2;
                    }
                    break;

                default:
                    Debug.WriteLine("Unrecognized element: {0} in element: {1}", reader.Name, "CharacterStyleRange");
                    break;
                }
            }

exit2:
            return(csr);
        }