當前位置: 首頁>>代碼示例>>C#>>正文


C# Xml.XmlWriter類代碼示例

本文整理匯總了C#中System.Xml.XmlWriter的典型用法代碼示例。如果您正苦於以下問題:C# XmlWriter類的具體用法?C# XmlWriter怎麽用?C# XmlWriter使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


XmlWriter類屬於System.Xml命名空間,在下文中一共展示了XmlWriter類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: WriteTo

 // Methods
 internal virtual void WriteTo( XmlWriter xmlWriter )
 {
     xmlWriter.WriteStartElement( XmlDiff.Prefix, "descriptor", XmlDiff.NamespaceUri );
     xmlWriter.WriteAttributeString( "opid", _operationID.ToString() );
     xmlWriter.WriteAttributeString( "type", Type );
     xmlWriter.WriteEndElement();
 }
開發者ID:Podracer,項目名稱:DAE-notepad,代碼行數:8,代碼來源:OperationDescriptor.cs

示例2: WriteXml

        internal void WriteXml(XmlWriter writer)
        {
            writer.WriteAttributeString("classCode", ClassCode);

            its.TemplateSignpost(templateId + "#" + templateText, writer);
            writeXML(writer);

            if (assignedPerson != null)
            {
                writer.WriteStartElement("assignedPerson");
                assignedPerson.TemplateId = templateId;
                assignedPerson.TemplateText = "assignedPerson";
                assignedPerson.WriteXml(writer);
                writer.WriteEndElement();
            }

            if (assignedDevice != null)
            {
                writer.WriteStartElement("assignedAuthoringDevice");
                assignedDevice.TemplateId = templateId;
                assignedDevice.TemplateText = "assignedAuthoringDevice";
                assignedDevice.WriteXml(writer);
                writer.WriteEndElement();
            }

            if (representedOrganisation != null)
            {
                writer.WriteStartElement("representedOrganization");
                representedOrganisation.TemplateId = templateId;
                representedOrganisation.TemplateText = "representedOrganization";
                representedOrganisation.WriteXml(writer);
                writer.WriteEndElement();
            }
        }
開發者ID:nagyist,項目名稱:cdaapi_core,代碼行數:34,代碼來源:r_Generic.cs

示例3: SerializeNetwork

        public override void SerializeNetwork(XmlWriter xmlWriter)
        {
            base.SerializeNetwork(xmlWriter);

            var expander = ControlElements[0] as SliderExpanderDouble;
            if (expander == null) return;

            xmlWriter.WriteStartAttribute("SliderMax");
            xmlWriter.WriteValue(expander.SliderMax);
            xmlWriter.WriteEndAttribute();

            xmlWriter.WriteStartAttribute("SliderMin");
            xmlWriter.WriteValue(expander.SliderMin);
            xmlWriter.WriteEndAttribute();

            xmlWriter.WriteStartAttribute("SliderValue");
            xmlWriter.WriteValue(expander.SliderValue);
            xmlWriter.WriteEndAttribute();

            xmlWriter.WriteStartAttribute("SliderStep");
            xmlWriter.WriteValue(expander.SliderStep);
            xmlWriter.WriteEndAttribute();

            xmlWriter.WriteStartAttribute("IsExpanded");
            xmlWriter.WriteValue(expander.IsExpanded);
            xmlWriter.WriteEndAttribute();
        }
開發者ID:aquarius20th,項目名稱:CSharp_TUM.CMS.VPLControl,代碼行數:27,代碼來源:DoubleSlider.cs

示例4: Transform

    /// <summary>
    /// Applies the transformation from the reader to the writer
    /// </summary>
    /// <param name="reader"></param>
    /// <param name="writer"></param>
    public void Transform(XmlReader reader, XmlWriter writer) {
      Contract.Requires(reader != null);
      Contract.Requires(writer != null);

      while (reader.Read())
        this.WriteNodeSingle(reader, writer);
    }
開發者ID:asvishnyakov,項目名稱:CodeContracts,代碼行數:12,代碼來源:XmlTraverserBase.cs

示例5: SanitizerNodeVisited

        void SanitizerNodeVisited(string nodeName, HtmlNode node, XmlWriter writer)
        {
            if (nodeName == "img" && node.Attributes["src"] != null && node.Attributes["src"].Value.StartsWith("cid:"))
            {
                // split src
                var src = node.Attributes["src"].Value.Split(new[] { ':' }, 2);

                if (src.Length == 2)
                {
                    // Find inline attachment with given contentid
                    var document = source.Documents.FirstOrDefault(d => d.ContentType == ContentType.Inline && d.ContentId == src[1]);

                    if (document != null)
                    {
                        // Replace content-id url with filename
                        var filename = ClientState.Current.Storage.ResolvePhysicalFilename(".", document.StreamName);

                        node.Attributes["src"].Value = String.Format("file://{0}", filename);
                    }
                }
            }
            else if (nodeName == "a" && node.Attributes["href"] != null)
            {
                var url = node.Attributes["href"].Value;

                // Clean href and inject javascript hook
                node.Attributes["href"].Value = String.Empty;

                writer.WriteAttributeString("onclick", String.Format("javascript:window.external.JsNavigate('{0}')", url));
            }
        }
開發者ID:Klaudit,項目名稱:inbox2_desktop,代碼行數:31,代碼來源:MessageBuilder.cs

示例6: WriteGraphAttributes

        /// <summary>
        /// Writes all experiment graph attributes.
        /// </summary>
        /// <param name="writer">The writer.</param>
        /// <param name="flow">The flow.</param>
        public virtual void WriteGraphAttributes(XmlWriter writer, IExperiment flow)
        {
            string path = System.IO.Path.Combine(System.IO.Path.GetTempPath(), Guid.NewGuid().ToString());
            System.IO.Directory.CreateDirectory(path);

            PropertyDescriptorCollection propertiesToWrite = TypeDescriptor.GetProperties(flow);
            foreach (PropertyDescriptor property in propertiesToWrite)
            {
                WriteXmlAttribute(writer, property, flow);
            }

            writer.WriteStartElement("References");
            {
                if (flow.References != null)
                {
                    var serializer = TraceLab.Core.Serialization.XmlSerializerFactory.GetSerializer(typeof(PackageSystem.PackageReference), null);
                    foreach (IPackageReference reference in flow.References)
                    {
                        serializer.Serialize(writer, reference);
                    }
                }
            }
            writer.WriteEndElement();

            // Iterate again and write any elements that are pending.  ALL attributes must be done first, or it results in invalid XML
            foreach (PropertyDescriptor property in propertiesToWrite)
            {
                WriteXmlElement(writer, property, flow);
            }
        }
開發者ID:jira-sarec,項目名稱:ICSE-2012-TraceLab,代碼行數:35,代碼來源:ExperimentFactoryWriter.cs

示例7: WriteXmlAttributes

        protected internal override void WriteXmlAttributes(XmlWriter writer)
        {
            if (Mode == VerticesEnumeratorMode.Range)
            {
                writer.WriteStartAttribute(StartField);
                writer.WriteValue(Start);
                writer.WriteEndAttribute();

                writer.WriteStartAttribute(EndField);
                writer.WriteValue(End);
                writer.WriteEndAttribute();

                writer.WriteStartAttribute(IncField);
                writer.WriteValue(Increment);
                writer.WriteEndAttribute();
            }
            
            if (Mode != VerticesEnumeratorMode.All)
            {
                writer.WriteStartAttribute(ModeField);
                writer.WriteValue(Mode.ToString());
                writer.WriteEndAttribute();
            }

            base.WriteXmlAttributes(writer);
        }
開發者ID:netgrim,項目名稱:MapKit,代碼行數:26,代碼來源:VerticesEnumerator.cs

示例8: writeVertex

 public static void writeVertex(XmlWriter writer, Vector2D vert)
 {
     writer.WriteStartElement("vertex");
     writer.WriteAttributeString("x", vert.x.ToString());
     writer.WriteAttributeString("y", vert.y.ToString());
     writer.WriteEndElement();
 }
開發者ID:CodeMason,項目名稱:LibGDX_DoomBuilder,代碼行數:7,代碼來源:MapWriter.cs

示例9: WriteAlbum

 private static void WriteAlbum(XmlWriter writer, string albumTitle, string artist)
 {
     writer.WriteStartElement("album");
     writer.WriteElementString("title", albumTitle);
     writer.WriteElementString("artist", artist);
     writer.WriteEndElement();
 }
開發者ID:NK-Hertz,項目名稱:Telerik-Academy-2015,代碼行數:7,代碼來源:Program.cs

示例10: Validate

        public override void Validate(XmlWriter output, SchematronRuntimeOptions options)
        {
            if (output == null) throw new ArgumentNullException("output");
             if (options == null) throw new ArgumentNullException("options");

             this.executable.Run(output, GetXsltOptions(options));
        }
開發者ID:skurdiukov,項目名稱:myxsl,代碼行數:7,代碼來源:XsltSchematronValidator.cs

示例11: WrappedSerializer

        internal WrappedSerializer(Serialization.DataFormat dataFormat, string streamName, TextWriter output) : base(dataFormat, streamName)
        {
            this.firstCall = true;
            this.textWriter = output;
            Serialization.DataFormat dataFormat1 = this.format;
            switch (dataFormat1)
            {
                case Serialization.DataFormat.Text:
                {
                    return;
                }
                case Serialization.DataFormat.XML:
                {
                    XmlWriterSettings xmlWriterSetting = new XmlWriterSettings();
                    xmlWriterSetting.CheckCharacters = false;
                    xmlWriterSetting.OmitXmlDeclaration = true;
                    this.xmlWriter = XmlWriter.Create(this.textWriter, xmlWriterSetting);
                    this.xmlSerializer = new Serializer(this.xmlWriter);
                    return;
                }
                default:
                {
                    return;
                }
            }
        }
開發者ID:nickchal,項目名稱:pash,代碼行數:26,代碼來源:WrappedSerializer.cs

示例12: WriteItem

        protected virtual void WriteItem(XmlWriter writer, string baseUrl, SiteMapEntry item)
        {
            // <url>
            if (item.Url.StartsWith("http")) return;
            
            writer.WriteStartElement("url");
#if DEBUG2           
            if (!string.IsNullOrEmpty(item.ID))
                writer.WriteElementString("id", item.ID);

            if (!string.IsNullOrEmpty(item.Title))
                writer.WriteElementString("title", item.Title);

            if (!string.IsNullOrEmpty(item.Class))
                writer.WriteElementString("class", item.Class);
#endif   
            writer.WriteElementString("loc", baseUrl + item.Url);
            
            if (item.LastModified.HasValue)
                 writer.WriteElementString("lastmod", item.LastModified.Value.ToString("yyyy-MM-dd")); // Google doesn't like IS0 8601/W3C 
            
            if (item.ChangeFrequency != ChangeFrequencyEnum.Undefined)
                writer.WriteElementString("changefreq", item.ChangeFrequency.ToString().ToLowerInvariant());
            
            writer.WriteElementString("priority", item.Priority.ToString(CultureInfo.InvariantCulture)); 

            // </url>
            writer.WriteEndElement();
        }
開發者ID:grbbod,項目名稱:drconnect-jungo,代碼行數:29,代碼來源:SiteMapXmlResult.cs

示例13: WritePaymentSpecificXml

 public override void WritePaymentSpecificXml(XmlWriter xmlw)
 {
     if (_paymentMethod != null)
     {
         WriteSimpleElement(xmlw, "paymentmethod", _paymentMethod.Value);
     }
 }
開發者ID:Matsutt,項目名稱:dotnet-integration,代碼行數:7,代碼來源:PaymentMethodPayment.cs

示例14:

 void IXmlSerializable.WriteXml(XmlWriter writer)
 {
     if (address != null)
     {
         address.WriteContentsTo(this.addressVersion, writer);
     }
 }
開發者ID:iskiselev,項目名稱:JSIL.NetFramework,代碼行數:7,代碼來源:MetadataReference.cs

示例15: PrintQuery

 public override void PrintQuery(XmlWriter w) {
     w.WriteStartElement(this.GetType().Name);
     w.WriteAttributeString("op", (isOr ? Operator.Op.OR : Operator.Op.AND).ToString());
     opnd1.PrintQuery(w);
     opnd2.PrintQuery(w);
     w.WriteEndElement();
 }
開發者ID:gbarnett,項目名稱:shared-source-cli-2.0,代碼行數:7,代碼來源:booleanexpr.cs


注:本文中的System.Xml.XmlWriter類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。