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


C# XmlNode.GetXmlAttribute方法代码示例

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


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

示例1: CheckContacts

        private static void CheckContacts(XmlNode ctrNode, List<Contact> contacts)
        {
            var jnode = ctrNode.GetXmlAttribute("J");
            var knode = ctrNode.GetXmlAttribute("K");
            var lnode = ctrNode.GetXmlAttribute("L");
            var mnode = ctrNode.GetXmlAttribute("M");

            if (!string.IsNullOrEmpty(jnode))
            {
                var fixedPhoneContact = contacts.Single(x => x.Type == ContactTypeEnum.FixedPhone);
                Assert.AreEqual(jnode, fixedPhoneContact.Number);
            }
            if (!string.IsNullOrEmpty(knode))
            {
                var mobilePhoneContact = contacts.Single(x => x.Type == ContactTypeEnum.MobilePhone);
                Assert.AreEqual(knode, mobilePhoneContact.Number);
            }
            if (!string.IsNullOrEmpty(lnode))
            {
                var faxContact = contacts.Single(x => x.Type == ContactTypeEnum.Fax);
                Assert.AreEqual(lnode, faxContact.Number);
            }
            if (!string.IsNullOrEmpty(mnode))
            {
                var emailContact = contacts.Single(x => x.Type == ContactTypeEnum.Email);
                Assert.AreEqual(mnode, emailContact.Number);
            }
        }
开发者ID:ADAPT,项目名称:ISOv4Plugin,代码行数:28,代码来源:GrowerAssert.cs

示例2: CheckName

 private static void CheckName(XmlNode ctrNode, Grower grower)
 {
     var bNode = ctrNode.GetXmlAttribute("B");
     var cNode = ctrNode.GetXmlAttribute("C");
     if (!String.IsNullOrWhiteSpace(cNode))
         Assert.AreEqual(bNode + ", " + cNode, grower.Name);
     else
         Assert.AreEqual(bNode, grower.Name);
 }
开发者ID:ADAPT,项目名称:ISOv4Plugin,代码行数:9,代码来源:GrowerAssert.cs

示例3: AreEqual

        private static void AreEqual(XmlNode ctpNode, Crop crop, Catalog catalog, Dictionary<string, List<UniqueId>> linkList)
        {
            UniqueIdAssert.AreEqual(linkList, ctpNode.GetXmlAttribute("A"), crop.Id.UniqueIds);
            Assert.AreEqual(ctpNode.GetXmlAttribute("A"), crop.Id.FindIsoId());
            Assert.AreEqual(ctpNode.GetXmlAttribute("B"), crop.Name);

            var matchingCropVarieties = catalog.Products.Where(x => x is CropVariety).Cast<CropVariety>().Where(cv => cv.CropId == crop.Id.ReferenceId).ToList();
            CropVarietyAssert.AreEqual(ctpNode.SelectNodes("CVT"), matchingCropVarieties, linkList);
        }
开发者ID:ADAPT,项目名称:ISOv4Plugin,代码行数:9,代码来源:CropAssert.cs

示例4: AreEqual

        public static void AreEqual(XmlNode productNode, FertilizerProduct fertilizerProduct, Dictionary<string, List<UniqueId>> linkList)
        {
            if (productNode.GetXmlAttribute("A") == null || productNode.GetXmlAttribute("B") == null)
                return;

            UniqueIdAssert.AreEqual(linkList, productNode.GetXmlAttribute("A"), fertilizerProduct.Id.UniqueIds);
            Assert.AreEqual(productNode.GetXmlAttribute("A"), fertilizerProduct.Id.FindIsoId());
            Assert.AreEqual(productNode.GetXmlAttribute("B"), fertilizerProduct.Description);
        }
开发者ID:ADAPT,项目名称:ISOv4Plugin,代码行数:9,代码来源:FertilizerProductAssert.cs

示例5: AreEqual

        public static void AreEqual(XmlNode productNode, XmlNodeList productNodes, ProductMix productMix, Catalog catalog, Dictionary<string, List<UniqueId>> linkList)
        {
            if (productNode.GetXmlAttribute("A") == null || productNode.GetXmlAttribute("B") == null)
                return;

            UniqueIdAssert.AreEqual(linkList, productNode.GetXmlAttribute("A"), productMix.Id.UniqueIds);
            Assert.AreEqual(productNode.GetXmlAttribute("A"), productMix.Id.FindIsoId());
            Assert.AreEqual(productNode.GetXmlAttribute("B"), productMix.Description);

            var prnNodes = productNode.SelectNodes("PRN");
            ProductComponentAssert.AreEqual(prnNodes, productMix.ProductComponents, productNodes, catalog, linkList);
        }
开发者ID:ADAPT,项目名称:ISOv4Plugin,代码行数:12,代码来源:ProductMixAssert.cs

示例6: AreEqual

        private static void AreEqual(XmlNode prnNode, ProductComponent productComponent, XmlNodeList productNodes, Catalog catalog, Dictionary<string, List<UniqueId>> linkList)
        {
            var productNode = FindMatchingProductNode(prnNode.GetXmlAttribute("A"), productNodes);
            if (productNode == null)
                return;

            var quantityDdi = Int32.Parse(productNode.GetXmlAttribute("E"));
            var uom = new RepresentationMapper().GetUnitForDdi(quantityDdi);
            Assert.AreEqual(uom, productComponent.Quantity.Value.UnitOfMeasure);
            Assert.AreEqual(prnNode.GetXmlAttribute("B"), productComponent.Quantity.Value.Value);

            var ingredient = catalog.Ingredients.Single(x => x.Id.ReferenceId == productComponent.IngredientId);
            Assert.AreEqual(productNode.GetXmlAttribute("B"), ingredient.Description);
        }
开发者ID:ADAPT,项目名称:ISOv4Plugin,代码行数:14,代码来源:ProductComponentAssert.cs

示例7: Load

        private GuidanceShift Load(XmlNode node)
        {
            var groupId = node.GetXmlAttribute("A");
            var patternId = node.GetXmlAttribute("B");
            if (string.IsNullOrEmpty(groupId) || string.IsNullOrEmpty(patternId))
                return null;

            var guidanceGroup = FindGuidanceGroup(groupId);

            return new GuidanceShift
            {
                GuidanceGroupId = guidanceGroup != null && guidanceGroup.Group != null ? guidanceGroup.Group.Id.ReferenceId : 0,
                GuidancePatterId = FindGuidancePatternId(guidanceGroup, patternId),
                EastShift = GetShiftValue(node.GetXmlAttribute("C")),
                NorthShift = GetShiftValue(node.GetXmlAttribute("D")),
                PropagationOffset = GetShiftValue(node.GetXmlAttribute("E"))
            };
        }
开发者ID:ADAPT,项目名称:ISOv4Plugin,代码行数:18,代码来源:GuidanceShiftLoader.cs

示例8: AreEqual

 private static void AreEqual(XmlNode ctrNode, Grower grower, Dictionary<string, List<UniqueId>> linkList)
 {
     UniqueIdAssert.AreEqual(linkList, ctrNode.GetXmlAttribute("A"), grower.Id.UniqueIds);
     Assert.AreEqual(ctrNode.GetXmlAttribute("A"), grower.Id.FindIsoId());
     CheckName(ctrNode, grower);
     Assert.AreEqual(ctrNode.GetXmlAttribute("D"), grower.ContactInfo.AddressLine1);
     Assert.AreEqual(ctrNode.GetXmlAttribute("E"), grower.ContactInfo.PoBoxNumber);
     Assert.AreEqual(ctrNode.GetXmlAttribute("F"), grower.ContactInfo.PostalCode);
     Assert.AreEqual(ctrNode.GetXmlAttribute("G"), grower.ContactInfo.City);
     Assert.AreEqual(ctrNode.GetXmlAttribute("H"), grower.ContactInfo.StateOrProvince);
     Assert.AreEqual(ctrNode.GetXmlAttribute("I"), grower.ContactInfo.Country);
     CheckContacts(ctrNode, grower.ContactInfo.Contacts);
 }
开发者ID:ADAPT,项目名称:ISOv4Plugin,代码行数:13,代码来源:GrowerAssert.cs

示例9: CheckArea

        private static void CheckArea(XmlNode fieldNode, Field field)
        {
            long areaValue;
            if (fieldNode.GetXmlAttribute("D").ParseValue(out areaValue) == false || areaValue < 0)
                return;

            Assert.AreEqual(areaValue, field.Area.Value.Value);
            Assert.AreEqual(RepresentationInstanceList.vrReportedFieldArea.ToModelRepresentation().Code,
                field.Area.Representation.Code);
            Assert.AreEqual(new CompositeUnitOfMeasure("m2").ToModelUom().Code, field.Area.Value.UnitOfMeasure.Code);
            Assert.AreEqual(new CompositeUnitOfMeasure("m2").ToModelUom().Code, field.Area.UserProvidedUnitOfMeasure.Code);
        }
开发者ID:ADAPT,项目名称:ISOv4Plugin,代码行数:12,代码来源:FieldAssert.cs

示例10: CheckCropZone

        private static void CheckCropZone(XmlNode fieldNode, Field field, Catalog catalog)
        {
            var cropId = fieldNode.GetXmlAttribute("G");
            if(String.IsNullOrEmpty(cropId))
               return;

            var cropZone = catalog.CropZones.Single(cz => cz.FieldId == field.Id.ReferenceId);
            var crop = catalog.Crops.Single(c => c.Id.ReferenceId == cropZone.CropId);

            Assert.AreEqual(cropId, crop.Id.FindIsoId());
            Assert.AreEqual(field.Id.ReferenceId, cropZone.FieldId);
            Assert.AreEqual(field.Description, cropZone.Description);
            Assert.AreEqual(field.Area.Value.Value, cropZone.Area.Value.Value);

            if(field.GuidanceGroupIds != null)
                Assert.AreEqual(field.GuidanceGroupIds, cropZone.GuidanceGroupIds);
        }
开发者ID:ADAPT,项目名称:ISOv4Plugin,代码行数:17,代码来源:FieldAssert.cs

示例11: AreEqual

        private static void AreEqual(XmlNode fieldNode, Field field, Catalog catalog, Dictionary<string, List<UniqueId>> linkList)
        {
            if (fieldNode.GetXmlAttribute("A") == null || fieldNode.GetXmlAttribute("C") == null || fieldNode.GetXmlAttribute("D") == null)
                return;

            UniqueIdAssert.AreEqual(linkList, fieldNode.GetXmlAttribute("A"), field.Id.UniqueIds);
            Assert.AreEqual(fieldNode.GetXmlAttribute("A"), field.Id.FindIsoId());
            Assert.AreEqual(fieldNode.GetXmlAttribute("C"), field.Description);

            CheckArea(fieldNode, field);
            CheckFarm(fieldNode, field, catalog);
            CheckBoundary(fieldNode, field, catalog);
            CheckGuidanceGroups(fieldNode, field, catalog, linkList);
            CheckCropZone(fieldNode, field, catalog);
        }
开发者ID:ADAPT,项目名称:ISOv4Plugin,代码行数:15,代码来源:FieldAssert.cs

示例12: AreEqual

 public static void AreEqual(XmlNode pointNode, Point point)
 {
     Assert.AreEqual(double.Parse(pointNode.GetXmlAttribute("C")), point.Y);
     Assert.AreEqual(double.Parse(pointNode.GetXmlAttribute("D")), point.X);
 }
开发者ID:ADAPT,项目名称:ISOv4Plugin,代码行数:5,代码来源:PointAssert.cs

示例13: CheckFarm

        private static void CheckFarm(XmlNode fieldNode, Field field, Catalog catalog)
        {
            var farmId = fieldNode.GetXmlAttribute("F");
            if (String.IsNullOrEmpty(farmId))
                return;

            var farm = catalog.Farms.Single(f => f.Id.ReferenceId == field.FarmId);
            Assert.AreEqual(farmId, farm.Id.FindIsoId());
        }
开发者ID:ADAPT,项目名称:ISOv4Plugin,代码行数:9,代码来源:FieldAssert.cs

示例14: AreEqual

 private static void AreEqual(XmlNode cropVarietyNode, CropVariety cropVariety, Dictionary<string, List<UniqueId>> linkList)
 {
     UniqueIdAssert.AreEqual(linkList, cropVarietyNode.GetXmlAttribute("A"), cropVariety.Id.UniqueIds);
     Assert.AreEqual(cropVarietyNode.GetXmlAttribute("A"), cropVariety.Id.FindIsoId());
     Assert.AreEqual(cropVarietyNode.GetXmlAttribute("B"), cropVariety.Description);
 }
开发者ID:ADAPT,项目名称:ISOv4Plugin,代码行数:6,代码来源:CropVarietyAssert.cs


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