本文整理汇总了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();
}
示例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));
}
示例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));
}
示例4: WriteCustomerReference
private void WriteCustomerReference(XmlWriter writer, int? growerId)
{
if (!growerId.HasValue)
return;
writer.WriteXmlAttribute("I", TaskWriter.Customers.FindById(growerId.Value));
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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);
}
示例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();
}
示例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;
}
示例12: WriteFarmReference
private void WriteFarmReference(XmlWriter writer, int? farmId)
{
if (!farmId.HasValue)
return;
writer.WriteXmlAttribute("F", TaskWriter.Farms.FindById(farmId.Value));
}
示例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;
}
}
}
示例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;
}
示例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);
}