当前位置: 首页>>代码示例>>C#>>正文


C# System.Xml.XmlTextWriter.WriteProcessingInstruction方法代码示例

本文整理汇总了C#中System.Xml.XmlTextWriter.WriteProcessingInstruction方法的典型用法代码示例。如果您正苦于以下问题:C# System.Xml.XmlTextWriter.WriteProcessingInstruction方法的具体用法?C# System.Xml.XmlTextWriter.WriteProcessingInstruction怎么用?C# System.Xml.XmlTextWriter.WriteProcessingInstruction使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Xml.XmlTextWriter的用法示例。


在下文中一共展示了System.Xml.XmlTextWriter.WriteProcessingInstruction方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Create

        /// <summary>
        /// Construct an StreamContent from a provided populated OFX object
        /// </summary>
        /// <param name="ofxObject">A populated OFX message with request or response data</param>
        /// <returns>Created StreamContent ready to send with HttpClient.Post</returns>
        public static StreamContent Create(Protocol.OFX ofxObject)
        {
            // Serialized data will be written to a MemoryStream
            var memoryStream = new System.IO.MemoryStream();

            // XMLWriter will be used to encode the data using UTF8Encoding without a Byte Order Marker (BOM)
            var xmlWriter = new System.Xml.XmlTextWriter(memoryStream, new System.Text.UTF8Encoding(false));

            // Write xml processing instruction
            xmlWriter.WriteStartDocument();
            // Our OFX protocol uses a version 2.0.0 header with 2.1.1 protocol body
            xmlWriter.WriteProcessingInstruction("OFX", "OFXHEADER=\"200\" VERSION=\"211\" SECURITY=\"NONE\" OLDFILEUID=\"NONE\" NEWFILEUID=\"NONE\"");

            // Don't include namespaces in the root element
            XmlSerializerNamespaces ns = new XmlSerializerNamespaces();
            ns.Add("", "");

            // Generate XML to the stream
            m_serializer.Serialize(xmlWriter, ofxObject, ns);

            // Flush writer to stream
            xmlWriter.Flush();

            // Position the stream back to the start for reading
            memoryStream.Position = 0;

            // Wrap in our HttpContent-derived class to provide headers and other HTTP encoding information
            return new StreamContent(memoryStream);
        }
开发者ID:rhadman,项目名称:SoDotCash,代码行数:34,代码来源:StreamContent.cs

示例2: datagridviewExportAsXml

        private void datagridviewExportAsXml(DataGridView dgv, string FileFullPath)
        {
            string strExamPath = FileFullPath.Substring(0, FileFullPath.LastIndexOf('\\'));
            if (!System.IO.Directory.Exists(strExamPath))
            {
                MessageBox.Show(FileFullPath, "目录错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            DataSet ds4Xml = new DataSet();

            datagridviewToDataSet(dgv, ds4Xml);

            System.Xml.XmlTextWriter writer = new System.Xml.XmlTextWriter(FileFullPath, Encoding.UTF8);
            writer.Formatting = System.Xml.Formatting.Indented;
            writer.WriteStartDocument();
            string str = string.Format("type=\"text/xsl\" href=\"{0}.xslt\"", System.IO.Path.GetFileNameWithoutExtension(FileFullPath));
            writer.WriteProcessingInstruction("xml-stylesheet", str);

            ds4Xml.WriteXml(writer);
            writer.Close();
            MessageBox.Show("文件成功保存到了" + FileFullPath, "保存成功", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
开发者ID:viticm,项目名称:pap2,代码行数:22,代码来源:DataRecordsQureyForm.cs

示例3: Clone

        public AnimationTarget Clone(Overlay newTarget)
        {
            StringBuilder sb = new StringBuilder();
            using (System.IO.StringWriter textWriter = new System.IO.StringWriter(sb))
            {
                using (System.Xml.XmlTextWriter writer = new System.Xml.XmlTextWriter(textWriter))
                {
                    writer.WriteProcessingInstruction("xml", "version='1.0' encoding='UTF-8'");

                    this.SaveToXml(writer);
                }
            }

            System.Xml.XmlDocument doc = new System.Xml.XmlDocument();
            doc.LoadXml(sb.ToString());

            AnimationTarget at = new AnimationTarget(owner);
            System.Xml.XmlNode node = doc["KeyFrames"];
            at.FromXml(node);
            at.Target = newTarget;
            at.TargetID = newTarget.GetIndentifier();
            return at;
        }
开发者ID:ngonzalezromero,项目名称:wwt-windows-client,代码行数:23,代码来源:AnimationTarget.cs

示例4: DataTableExportAsXml

        public static bool DataTableExportAsXml(DataTable dt, string FileFullPath)
        {
            if (!System.IO.Directory.Exists(Path.GetDirectoryName(FileFullPath)))
            {
                CreatePath(FileFullPath);
            }           
            
            System.Xml.XmlTextWriter writer = new System.Xml.XmlTextWriter(FileFullPath, Encoding.UTF8);
            writer.Formatting = System.Xml.Formatting.Indented;            
            writer.WriteStartDocument();
            string str = string.Format("type=\"text/xsl\" href=\"{0}.xslt\"", Path.GetFileNameWithoutExtension(FileFullPath) );
            writer.WriteProcessingInstruction("xml-stylesheet", str);
            

            dt.DataSet.WriteXml(writer);
            writer.Close();

            return true;
        }
开发者ID:viticm,项目名称:pap2,代码行数:19,代码来源:Helper.cs

示例5: copyPopertyKeyframes_Click

        void copyPopertyKeyframes_Click(object sender, EventArgs e)
        {
            if (tour != null && tour.CurrentTourStop != null)
            {
                if (Selection.Count > 0)
                {
                    StringBuilder sb = new StringBuilder();
                    using (System.IO.StringWriter textWriter = new System.IO.StringWriter(sb))
                    {
                        using (System.Xml.XmlTextWriter writer = new System.Xml.XmlTextWriter(textWriter))
                        {
                            writer.WriteProcessingInstruction("xml", "version='1.0' encoding='UTF-8'");
                            writer.WriteStartElement("CopiedKeys");
                            string targetID = Selection[0];
                            AnimationTarget target = GetTargetByID(targetID);

                            target.SaveToXml(writer);

                            writer.WriteEndElement();
                        }
                    }
                    DataFormats.Format format = DataFormats.GetFormat(Key.ClipboardFormatProperties);

                    IDataObject dataObject = new DataObject();
                    dataObject.SetData(format.Name, false, sb.ToString());

                    Clipboard.SetDataObject(dataObject, false);

                    Refresh();
                }
            }
        }
开发者ID:ngonzalezromero,项目名称:wwt-windows-client,代码行数:32,代码来源:TimeLine.cs

示例6: copyKeys_Click

        void copyKeys_Click(object sender, EventArgs e)
        {
            bool columnSelection = IsColumnSelection();

            if (tour != null && tour.CurrentTourStop != null)
            {
                if (selectedKeys.Count > 0)
                {
                    StringBuilder sb = new StringBuilder();
                    using (System.IO.StringWriter textWriter = new System.IO.StringWriter(sb))
                    {
                        using (System.Xml.XmlTextWriter writer = new System.Xml.XmlTextWriter(textWriter))
                        {
                            writer.WriteProcessingInstruction("xml", "version='1.0' encoding='UTF-8'");
                            writer.WriteStartElement("CopiedKeys");

                            foreach (AnimationTarget target in tour.CurrentTourStop.AnimationTargets)
                            {
                                target.SaveSelectedToXml(writer, selectedKeys);
                            }

                            writer.WriteEndElement();
                        }
                    }

                    DataFormats.Format format = DataFormats.GetFormat(Key.ClipboardFormatSelection);

                    IDataObject dataObject = new DataObject();
                    dataObject.SetData(format.Name, false, sb.ToString());

                    if (columnSelection)
                    {
                        // Add other data format
                        DataFormats.Format formatColumn = DataFormats.GetFormat(Key.ClipboardFormatColumn);
                        dataObject.SetData(formatColumn.Name, false, sb.ToString());
                    }

                    Clipboard.SetDataObject(dataObject, false);
                    Refresh();
                }
            }
        }
开发者ID:ngonzalezromero,项目名称:wwt-windows-client,代码行数:42,代码来源:TimeLine.cs

示例7: copyMenu_Click

        void copyMenu_Click(object sender, EventArgs e)
        {
            StringBuilder sb = new StringBuilder();
            using (System.IO.StringWriter textWriter = new System.IO.StringWriter(sb))
            {
                using (System.Xml.XmlTextWriter writer = new System.Xml.XmlTextWriter(textWriter))
                {
                    writer.WriteProcessingInstruction("xml", "version='1.0' encoding='UTF-8'");
                    writer.WriteStartElement("TourStops");
                    foreach (TourStop item in tourStopList.SelectedItems.Values)
                    {
                        item.SaveToXml(writer, true);
                    }
                    writer.WriteEndElement();
                }
            }
            DataFormats.Format format = DataFormats.GetFormat(TourStop.ClipboardFormat);

            IDataObject dataObject = new DataObject();
            dataObject.SetData(format.Name, false, sb.ToString());

            Clipboard.SetDataObject(dataObject, false);
        }
开发者ID:ngonzalezromero,项目名称:wwt-windows-client,代码行数:23,代码来源:TourEdit.cs


注:本文中的System.Xml.XmlTextWriter.WriteProcessingInstruction方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。