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


C# XmlWriter.WriteXmlAttribute方法代码示例

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


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

示例1: WritePoint

        private static void WritePoint(XmlWriter writer, Point point, string label)
        {
            writer.WriteStartElement("PNT");
            writer.WriteXmlAttribute("A", "2");
            writer.WriteXmlAttribute("B", label);
            writer.WriteXmlAttribute("C", point.Y.ToString(CultureInfo.InvariantCulture)); // Latitude
            writer.WriteXmlAttribute("D", point.X.ToString(CultureInfo.InvariantCulture)); // Longitude

            writer.WriteEndElement();
        }
开发者ID:ADAPT,项目名称:ISOv4Plugin,代码行数:10,代码来源:ShapeWriter.cs

示例2: WriteContacts

        private static void WriteContacts(XmlWriter writer, List<Contact> contacts)
        {
            if (contacts == null || contacts.Count == 0)
                return;

            writer.WriteXmlAttribute("J", GetContactForType(contacts, ContactTypeEnum.FixedPhone));
            writer.WriteXmlAttribute("K", GetContactForType(contacts, ContactTypeEnum.MobilePhone));
            writer.WriteXmlAttribute("L", GetContactForType(contacts, ContactTypeEnum.Fax));
            writer.WriteXmlAttribute("M", GetContactForType(contacts, ContactTypeEnum.Email));
        }
开发者ID:ADAPT,项目名称:ISOv4Plugin,代码行数:10,代码来源:CustomerWriter.cs

示例3: WriteTotalQuantity

        private static void WriteTotalQuantity(XmlWriter writer, NumericRepresentationValue quantity)
        {
            if (quantity == null || quantity.Value == null)
                return;

            writer.WriteXmlAttribute("G", quantity.Value.Value.ToString("F0", CultureInfo.InvariantCulture));
        }
开发者ID:ADAPT,项目名称:ISOv4Plugin,代码行数:7,代码来源:ProductWriter.cs

示例4: WriteCustomerReference

        private void WriteCustomerReference(XmlWriter writer, int? growerId)
        {
            if (!growerId.HasValue)
                return;

            writer.WriteXmlAttribute("I", TaskWriter.Customers.FindById(growerId.Value));
        }
开发者ID:ADAPT,项目名称:ISOv4Plugin,代码行数:7,代码来源:FarmWriter.cs

示例5: WriteDataVariable

        private static void WriteDataVariable(XmlWriter writer, DataVariable dataVariable)
        {
            writer.WriteStartElement("PDV");

            var variableDdi = DetermineVariableDdi(dataVariable);
            writer.WriteAttributeString("A", string.Format(CultureInfo.InvariantCulture, "{0:X4}", variableDdi));
            writer.WriteAttributeString("B", dataVariable.IsoUnit.ConvertToIsoUnit(dataVariable.Value).ToString("F0", CultureInfo.InvariantCulture));
            writer.WriteXmlAttribute("C", dataVariable.ProductId);

            writer.WriteEndElement();
        }
开发者ID:ADAPT,项目名称:ISOv4Plugin,代码行数:11,代码来源:TreatmentZoneWriter.cs

示例6: WriteGuidacenGroup

        private void WriteGuidacenGroup(XmlWriter writer, GuidanceGroup guidanceGroup)
        {
            writer.WriteStartElement(XmlPrefix);
            var guidanceGroupId = guidanceGroup.Id.FindIsoId() ?? GenerateId();
            TaskWriter.Ids.Add(guidanceGroupId, guidanceGroup.Id);

            writer.WriteAttributeString("A", guidanceGroupId);
            writer.WriteXmlAttribute("B", guidanceGroup.Description);

            WriteGuidancePatterns(writer, guidanceGroup.GuidancePatternIds);
            WriteBoundary(writer, guidanceGroup.BoundingPolygon);

            writer.WriteEndElement();
        }
开发者ID:ADAPT,项目名称:ISOv4Plugin,代码行数:14,代码来源:GuidanceGroupWriter.cs

示例7: WriteLine

        public static void WriteLine(XmlWriter writer, LineString line, string lineType)
        {
            if (line == null || line.Points == null || line.Points.Count == 0)
                return;

            writer.WriteStartElement("LSG");
            writer.WriteXmlAttribute("A", lineType);

            for (int i = 0; i < line.Points.Count; i++)
            {
                var pointLabel = i == 0 ? "start" : i == line.Points.Count - 1 ? "end" : "";
                WritePoint(writer, line.Points[i], pointLabel);
            }

            writer.WriteEndElement();
        }
开发者ID:ADAPT,项目名称:ISOv4Plugin,代码行数:16,代码来源:ShapeWriter.cs

示例8: WriteRing

        private static void WriteRing(XmlWriter writer, LinearRing ring, bool isExterior)
        {
            if (ring.Points == null ||
                ring.Points.Count == 0)
                return;

            writer.WriteStartElement("LSG");
            writer.WriteXmlAttribute("A", isExterior ? "1" : "2");

            for (int i = 0; i < ring.Points.Count; i++)
            {
                var pointLabel = i == 0 ? "start" : i == ring.Points.Count - 1 ? "end" : "";
                WritePoint(writer, ring.Points[i], pointLabel);
            }

            writer.WriteEndElement();
        }
开发者ID:ADAPT,项目名称:ISOv4Plugin,代码行数:17,代码来源:ShapeWriter.cs

示例9: WriteContactInfo

        private static void WriteContactInfo(XmlWriter writer, ContactInfo contactInfo)
        {
            if (contactInfo == null)
                return;

            writer.WriteXmlAttribute("D", contactInfo.AddressLine1);
            writer.WriteXmlAttribute("E", contactInfo.PoBoxNumber);
            writer.WriteXmlAttribute("F", contactInfo.PostalCode);
            writer.WriteXmlAttribute("G", contactInfo.City);
            writer.WriteXmlAttribute("H", contactInfo.StateOrProvince);
            writer.WriteXmlAttribute("I", contactInfo.Country);
        }
开发者ID:ADAPT,项目名称:ISOv4Plugin,代码行数:12,代码来源:FarmWriter.cs

示例10: WritePolygon

        public static void WritePolygon(XmlWriter writer, Polygon polygon)
        {
            if (polygon.ExteriorRing == null)
                return;

            writer.WriteStartElement("PLN");
            writer.WriteXmlAttribute("A", "1");

            WriteRing(writer, polygon.ExteriorRing, true);
            if (polygon.InteriorRings != null)
            {
                foreach (var ring in polygon.InteriorRings)
                {
                    WriteRing(writer, ring, false);
                }
            }

            writer.WriteEndElement();
        }
开发者ID:ADAPT,项目名称:ISOv4Plugin,代码行数:19,代码来源:ShapeWriter.cs

示例11: Write

        public static string Write(XmlWriter writer, string zoneId, TreatmentZone treatmentZone)
        {
            if (treatmentZone == null)
                return null;

            writer.WriteStartElement("TZN");
            writer.WriteAttributeString("A", zoneId);
            writer.WriteXmlAttribute("B", treatmentZone.Name);

            if (treatmentZone.Variables != null)
            {
                foreach (var dataVariable in treatmentZone.Variables)
                {
                    WriteDataVariable(writer, dataVariable);
                }
            }

            writer.WriteEndElement();
            return zoneId;
        }
开发者ID:ADAPT,项目名称:ISOv4Plugin,代码行数:20,代码来源:TreatmentZoneWriter.cs

示例12: WriteFarmReference

        private void WriteFarmReference(XmlWriter writer, int? farmId)
        {
            if (!farmId.HasValue)
                return;

            writer.WriteXmlAttribute("F", TaskWriter.Farms.FindById(farmId.Value));
        }
开发者ID:ADAPT,项目名称:ISOv4Plugin,代码行数:7,代码来源:FieldWriter.cs

示例13: WriteCropZone

        private void WriteCropZone(XmlWriter writer, CompoundIdentifier fieldId)
        {
            if (TaskWriter.DataModel.Catalog.CropZones == null ||
                TaskWriter.DataModel.Catalog.CropZones.Count == 0)
                return;

            foreach (var cropZone in TaskWriter.DataModel.Catalog.CropZones)
            {
                if (cropZone.FieldId == fieldId.ReferenceId)
                {
                    var cropId = TaskWriter.Crops.FindById(cropZone.CropId.Value);
                    writer.WriteXmlAttribute("G", cropId);
                    break;
                }
            }
        }
开发者ID:ADAPT,项目名称:ISOv4Plugin,代码行数:16,代码来源:FieldWriter.cs

示例14: WriteTreatmentZones

        private TreatmentZone WriteTreatmentZones(XmlWriter writer, RasterGridPrescription prescription)
        {
            if (prescription.ProductIds == null)
                return null;

            var lossOfSignalTreatmentZone = new TreatmentZone { Name = "Loss of GPS", Variables = new List<DataVariable>() };
            var outOfFieldTreatmentZone = new TreatmentZone { Name = "Out of Field", Variables = new List<DataVariable>() };
            var defaultTreatmentZone = new TreatmentZone { Name = "Default", Variables = new List<DataVariable>() };

            var defaultRate = new NumericRepresentationValue(null, new NumericValue(prescription.RxProductLookups.First().UnitOfMeasure, 0));
            var isoUnit = DetermineIsoUnit(prescription.RxProductLookups.First().UnitOfMeasure);

            foreach (var productId in prescription.ProductIds)
            {
                var isoProductId = TaskWriter.Products.FindById(productId) ?? TaskWriter.CropVarieties.FindById(productId);

                AddDataVariable(lossOfSignalTreatmentZone, prescription.LossOfGpsRate, isoProductId, isoUnit);
                AddDataVariable(outOfFieldTreatmentZone, prescription.OutOfFieldRate, isoProductId, isoUnit);
                AddDataVariable(defaultTreatmentZone, defaultRate, isoProductId, isoUnit);
            }

            var lossOfSignalZoneId = "253";
            if (lossOfSignalTreatmentZone.Variables.Count > 0)
                writer.WriteXmlAttribute("I", lossOfSignalZoneId);

            var outOfFieldZoneId = "254";
            if (outOfFieldTreatmentZone.Variables.Count > 0)
                writer.WriteXmlAttribute("J", outOfFieldZoneId);

            TreatmentZoneWriter.Write(writer, "1", defaultTreatmentZone);
            if (lossOfSignalTreatmentZone.Variables.Count > 0)
                TreatmentZoneWriter.Write(writer, lossOfSignalZoneId, lossOfSignalTreatmentZone);
            if (outOfFieldTreatmentZone.Variables.Count > 0)
                TreatmentZoneWriter.Write(writer, outOfFieldZoneId, outOfFieldTreatmentZone);

            return defaultTreatmentZone;
        }
开发者ID:ADAPT,项目名称:ISOv4Plugin,代码行数:37,代码来源:PrescriptionWriter.cs

示例15: WriteFieldMeta

        private void WriteFieldMeta(XmlWriter writer, int fieldId)
        {
            var field = TaskWriter.Fields.FindById(fieldId);
            writer.WriteXmlAttribute("E", field);

            if (!string.IsNullOrEmpty(field))
                WriteFarmMeta(writer, fieldId);
        }
开发者ID:ADAPT,项目名称:ISOv4Plugin,代码行数:8,代码来源:PrescriptionWriter.cs


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