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


C# Linq.XNamespace类代码示例

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


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

示例1: CreateGpx_1_1_Route

        private Route CreateGpx_1_1_Route(XDocument routeDocument, XNamespace ns)
        {
            XElement track = routeDocument.Root.Element(ns + "trk");
            string name = track.Element(ns + "name").Value;

            Route newRoute = new Route {Name = name, DateCreated = DateTime.Now};
            List<RoutePoint> routePoints = new List<RoutePoint>();
            var trackPoints = track.Descendants(ns + "trkpt");
            foreach (XElement trackPoint in trackPoints)
            {
                RoutePoint routePoint = new RoutePoint();
                routePoint.Latitude = double.Parse(trackPoint.Attribute("lat").Value);
                routePoint.Longitude = double.Parse(trackPoint.Attribute("lon").Value);
                routePoint.Elevation = double.Parse(trackPoint.Element(ns + "ele").Value);
                routePoint.TimeRecorded = DateTime.Parse(trackPoint.Element(ns + "time").Value);
                routePoints.Add(routePoint);
            }
            routePoints = routePoints.OrderBy(rp => rp.TimeRecorded).ToList();
            int index = 0;
            foreach (RoutePoint routePoint in routePoints)
            {
                routePoint.SequenceIndex = index;
                index++;
            }
            newRoute.RoutePoints = routePoints;
            newRoute.Distance = CalculateDistance(newRoute.RoutePoints);
            Tuple<double, double> ascentDescent = CalculateAscentDescent(newRoute.RoutePoints);
            newRoute.TotalAscent += ascentDescent.Item1;
            newRoute.TotalDescent += ascentDescent.Item2;
            return newRoute;
        }
开发者ID:JamesRandall,项目名称:CycleCycleCycle.com,代码行数:31,代码来源:GpxRouteCreator.cs

示例2: GetMsTasks

        public static ObservableCollection<GanttTask> GetMsTasks(XDocument xDocument, XNamespace xnamespace)
        {
            var allTasks = new ObservableCollection<GanttTask>();
            var task = xDocument.Root.Elements(xnamespace + "Tasks");
            var tasks = task.Elements(xnamespace + "Task");
            tasks.FirstOrDefault().Remove();
            PrepareXMLTasksForConvertingToGanttTasks(xnamespace, tasks);
            GenerateAllGanttTasks(tasks, xnamespace);

            foreach (var t in taskIdToGanttTask)
            {
                var gtask = t.Value.Item1;

                SetUpRelationsToGanttTask(t.Key, t.Value, gtask);

                var oNumber = t.Value.Item2;
                if (oNumber != null)
                {
                    SetUpChildrenToGanttTask(t.Value, gtask);

                }
                if (IsRootTask(oNumber))
                {
                    allTasks.Add(gtask);
                }
            }
            return allTasks;
        }
开发者ID:Rufix,项目名称:xaml-sdk,代码行数:28,代码来源:MsProjectImportHelper.cs

示例3: CorrelationKey

 private CorrelationKey(string keyString, XNamespace provider) : base(GenerateKey(keyString), dictionary)
 {
     Dictionary<XName, InstanceValue> dictionary = new Dictionary<XName, InstanceValue>(2);
     dictionary.Add(provider.GetName("KeyString"), new InstanceValue(keyString, InstanceValueOptions.Optional));
     dictionary.Add(WorkflowNamespace.KeyProvider, new InstanceValue(provider.NamespaceName, InstanceValueOptions.Optional));
     this.KeyString = keyString;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:7,代码来源:CorrelationKey.cs

示例4: UPnPService

 public UPnPService(UPnPDevice parent, XNamespace ns, XElement service)
 {
     ParentDevice = parent;
       ServiceType = service.Elements().First(e => e.Name.LocalName == "serviceType").Value;
       ServiceID = service.Elements().First(e => e.Name.LocalName == "serviceId").Value;
       ControlUrl = service.Elements().First(e => e.Name.LocalName == "controlURL").Value;
 }
开发者ID:yartat,项目名称:Auto3D,代码行数:7,代码来源:UPnPService.cs

示例5: UpdateXElement

 internal static void UpdateXElement(this XElement element, SettingsInfo settings, XNamespace ns)
 {
     element.Attribute("ID").Value = settings.Id.ToString();
     element.Attribute("processorRef").Value = settings.Processor.Id.ToString();
     element.Element(ns + "name").Value = settings.Name;
     element.Element(ns + "serialPortSettings").UpdateXElement(settings.SerialPortSettings, ns);
 }
开发者ID:KiselevKN,项目名称:BootMega,代码行数:7,代码来源:SettingsInfoExtensions.cs

示例6: CreateElement

 /// <summary>
 /// 
 /// </summary>
 /// <param name="xmlns"></param>
 /// <returns></returns>
 public override XElement CreateElement(XNamespace xmlns)
 {
     return new XElement(xmlns + "channel")
         .AddElement(xmlns + "title", Title)
         .AddElement(xmlns + "link", Link)
         .AddElement(xmlns + "description", Description);
 }
开发者ID:fengweijp,项目名称:higlabo,代码行数:12,代码来源:RssChannel.cs

示例7: EpubSummaryParser

        public EpubSummaryParser(Stream source)
        {
            _zip = ZipContainer.Unzip(source);
            XDocument xmlDocument = _zip.GetFileStream("META-INF/container.xml").GetXmlDocument();
            XElement root = xmlDocument.Root;
            if (root == null)
                throw new DataException(InvalidEpubMetaInfo);

            XAttribute attribute = root.Attribute("xmlns");
            XNamespace xmlns = (attribute != null) ? XNamespace.Get(attribute.Value) : XNamespace.None;
            XAttribute fullPath = xmlDocument.Descendants(xmlns + "rootfile").First().Attribute("full-path");
            if (fullPath == null)
                throw new DataException(InvalidEpubMetaInfo);

            string path = fullPath.Value;
            _opfPath = path;
            _opf = _zip.GetFileStream(path).GetXmlDocument();
            _opfRoot = _opf.Root;
            if (_opfRoot == null)
                throw new DataException(InvalidEpubMetaInfo);

            _oebps = GetPath(path);
            _opfns = XNamespace.Get("http://www.idpf.org/2007/opf");
            _opfdc = XNamespace.Get("http://purl.org/dc/elements/1.1/");

            _coverHelper = new EpubCoverHelper(_zip, _opfns, _opfRoot, _oebps);
        }
开发者ID:bdvsoft,项目名称:reader_wp8_OPDS,代码行数:27,代码来源:EpubSummaryParser.cs

示例8: XElementFromElastic

		public static XElement XElementFromElastic(ElasticObject elastic, XNamespace nameSpace = null)
		{
			// we default to empty namespace
			nameSpace = nameSpace ?? string.Empty;
			var exp = new XElement(nameSpace + elastic.InternalName);

			foreach (var a in elastic.Attributes.Where(a => a.Value.InternalValue != null))
			{
				// if we have xmlns attribute add it like XNamespace instead of regular attribute
				if (a.Key.Equals("xmlns", StringComparison.InvariantCultureIgnoreCase))
				{
					nameSpace = a.Value.InternalValue.ToString();
					exp.Name = nameSpace.GetName(exp.Name.LocalName);
				}
				else
				{
					exp.Add(new XAttribute(a.Key, a.Value.InternalValue));
				}
			}

			if (elastic.InternalContent is string)
			{
				exp.Add(new XText(elastic.InternalContent as string));
			}

			foreach (var child in elastic.Elements.Select(c => XElementFromElastic(c, nameSpace)))
			{
				exp.Add(child);
			}

			return exp;
		}
开发者ID:ME3Explorer,项目名称:ME3Explorer,代码行数:32,代码来源:DynamicExtensions.cs

示例9: ActiveForm

 //private String Method;
 //private String ApiTimeStamp;
 public ActiveForm(XNamespace ns, String ApiKey, String SecretApiKey)
 {
     this.NameSpace = ns;
       this.ApiKey = ApiKey;
       this.SecretApiKey = SecretApiKey;
       BaseUrl = "https://api.activeforms.com/4.0/";
 }
开发者ID:johny1515,项目名称:Bank_REI,代码行数:9,代码来源:ActiveForms.cs

示例10: SchemaInfo

 internal SchemaInfo(IFormChannelIdentifier channelIdentifier, XNamespace namespaceObj, XDocument schema)
 {
     this.ChannelIdentifier = channelIdentifier;
     this.Namespace = namespaceObj;
     this.Schema = schema;
     this.SchemaType = FormSchemaType.Uicontrols;
 }
开发者ID:DBailey635,项目名称:C1-CMS,代码行数:7,代码来源:SchemaBuilder.cs

示例11: GetAvailability

 public static string GetAvailability(this XElement xElement, XNamespace ns)
 {
     return xElement.Element(ns + "Offers") == null ? string.Empty :
         xElement.Element(ns + "Offers").Element(ns + "Offer") == null ? string.Empty :
         xElement.Element(ns + "Offers").Element(ns + "Offer").Element(ns + "OfferListing") == null ? string.Empty :
         xElement.Element(ns + "Offers").Element(ns + "Offer").Element(ns + "OfferListing").ElementValue("Availability", ns);
 }
开发者ID:arkum,项目名称:AmazonProductApi,代码行数:7,代码来源:Extensions.cs

示例12: XNamespace

		static XNamespace ()
		{
			nstable = new Dictionary<string, XNamespace> ();
			blank = Get (String.Empty);
			xml = Get ("http://www.w3.org/XML/1998/namespace");
			xmlns = Get ("http://www.w3.org/2000/xmlns/");
		}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:7,代码来源:XNamespace.cs

示例13: HtmlImageResultFormatter

 public HtmlImageResultFormatter(Configuration configuration, ITestResults results, HtmlResourceSet htmlResourceSet)
 {
     this.configuration = configuration;
     this.results = results;
     this.htmlResourceSet = htmlResourceSet;
     this.xmlns = HtmlNamespace.Xhtml;
 }
开发者ID:hugohaggmark,项目名称:pickles,代码行数:7,代码来源:HtmlImageResultFormatter.cs

示例14: MyClassInitialize

		public static void MyClassInitialize(TestContext testContext)
		{
			if (!Directory.Exists(Utility.RootFolder))
			{
				Directory.CreateDirectory(Utility.RootFolder);
			}
			if (!Directory.Exists(Utility.TempFolder))
			{
				Directory.CreateDirectory(Utility.TempFolder);
			}
			_mXmlNs = Utility.NS;
			_mOnGenerator = new OneNoteGenerator(Utility.RootFolder);
			//Get Id of the test notebook so we chould retrieve generated content
			//KindercareFormatConverter will create notebookName as Kindercare
			_mNotebookId = _mOnGenerator.CreateNotebook(NotebookName);

			var word = new Application();
			var doc = word.Application.Documents.Add();

			//add pages to doc
			for (int i = 1; i < DocPageTitles.Count; i++)
			{
				doc.Content.Text += DocPageTitles[i];
				doc.Words.Last.InsertBreak(WdBreakType.wdPageBreak);
			}

			var filePath = TestDocPath as object;
            doc.SaveAs(ref filePath);
            ((_WordDocument)doc).Close();
            ((_WordApplication)word).Quit();
		}
开发者ID:OneNoteDev,项目名称:OneNoteConversionTool,代码行数:31,代码来源:GenericFormatConverterUnitTest.cs

示例15: OpenXmlSdkDocumentProperties

        //TODO Use PackageProperties.
        internal OpenXmlSdkDocumentProperties(OpenXmlSdkTextDocument document)
        {
            if (document == null)
            {
                throw new ArgumentNullException("document");
            }

            _document = document;

            _xCorePropertiesNamespace = CorePropertiesSchema;
            _xDublinCoreNamespace = DublinCoreSchema;
            _xDCTermsNamespace = DublinCoreTermsSchema;

            _xCreatedElementName = _xDCTermsNamespace + "created";
            _xCreatorElementName = _xDublinCoreNamespace + "creator";
            _xDescriptionElementName = _xDublinCoreNamespace + "description";
            _xKeywordsElementName = _xCorePropertiesNamespace + "keywords";
            _xLanguageElementName = _xDublinCoreNamespace + "language";
            _xLastModifiedByElementName = _xCorePropertiesNamespace + "lastModifiedBy";
            _xLastPrintedElementName = _xCorePropertiesNamespace + "lastPrinted";
            _xModifiedElementName = _xDCTermsNamespace + "modified";
            _xRevisionElementName = _xCorePropertiesNamespace + "revision";
            _xSubjectElementName = _xDublinCoreNamespace + "subject";
            _xTitleElementName = _xDublinCoreNamespace + "title";

            using (Stream stream = document.InnerObject.CoreFilePropertiesPart.GetStream())
            {
                _xDocument = XDocument.Load(stream);
            }
        }
开发者ID:Tenere,项目名称:Semantic-Lib,代码行数:31,代码来源:OpenXmlSdkDocumentProperties.cs


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