コード例 #1
0
        private static void addCmsSitemap(XContainer xml)
        {
            var pages = Cache.Pages.GroupBy(p => p.Category);
            foreach (var category in pages)
            {
                var categoryName = category.Key.ToLower();

                if (!categoryName.Matches("Home"))
                    xml.Add(urlElementFor(Settings.Domain + "/" + categoryName));

                foreach (var page in category.Where(p => !p.Category.Matches("Home") && p.Crawl))
                    xml.Add(urlElementFor(page.FullURL));
            }
        }
コード例 #2
0
        protected virtual void AddElements(XContainer root)
        {
            XContainer events = new XElement("events");
            XContainer eventEntity = new XElement("event");
            root.Add(new XElement("import-id", 1));
            root.Add(new XElement("user-id", "ABC"));
            root.Add(new XElement("echo", "123"));

            eventEntity.Add(new XElement("description", "This is a test response"));
            eventEntity.Add(new XElement("event-type", "SUBMITTING"));
            eventEntity.Add(new XElement("status", "INPROGRESS"));
            eventEntity.Add(new XElement("value", "50"));

            events.Add(eventEntity);
            root.Add(events);
        }
コード例 #3
0
ファイル: PathParser.cs プロジェクト: mcwatt77/vimcontrols
 private static void AddNode(XContainer parent, ParseTreeNode node)
 {
     var element = new XElement(node.Name.Length == 0 ? "root" : node.Name,
                                new XAttribute("data", node.Text));
     parent.Add(element);
     if (node.Children != null)
         node.Children.Do(child => AddNode(element, child));
 }
コード例 #4
0
        /// <summary>
        /// Updates the property element.
        /// </summary>
        /// <param name="property">The property.</param>
        /// <param name="elementPosition">The element position.</param>
        /// <param name="fileId">The file id.</param>
        private static void UpdatePropertyElement(XContainer property, SourceElementPosition elementPosition, string fileId)
        {
            property.Add(new XElement("FileRef", new XAttribute("uid", fileId)));

            var seqpnt = new XElement(
                "SequencePoint",
                new XAttribute("vc", property.Element("MethodPoint").Attribute("vc").Value),
                new XAttribute("sl", elementPosition.Start));

            property.Element("SequencePoints").Add(seqpnt);
        }
コード例 #5
0
 private void CompileRecursive(ConnectionInfo serializationTarget, XContainer parentElement)
 {
     var newElement = parentElement;
     if (!(serializationTarget is RootNodeInfo))
     {
         newElement = CompileConnectionInfoNode(serializationTarget);
         parentElement.Add(newElement);
     }
     var serializationTargetAsContainer = serializationTarget as ContainerInfo;
     if (serializationTargetAsContainer == null) return;
     foreach (var child in serializationTargetAsContainer.Children)
         CompileRecursive(child, newElement);
 }
コード例 #6
0
        /// <summary>
        /// Updates the method element.
        /// </summary>
        /// <param name="method">The method.</param>
        /// <param name="elementPosition">The element position.</param>
        /// <param name="fileId">The file id.</param>
        private static void UpdateMethodElement(XContainer method, SourceElementPosition elementPosition, string fileId)
        {
            for (int i = elementPosition.Start; i <= elementPosition.End; i++)
            {
                var seqpnt = new XElement(
                    "pt",
                    new XAttribute("visit", "0"),
                    new XAttribute("fid", fileId),
                    new XAttribute("sl", i));

                method.Add(seqpnt);
            }
        }
コード例 #7
0
        /// <summary>
        /// Adds a new source code file to the report.
        /// </summary>
        /// <param name="filesContainer">The files container.</param>
        /// <param name="fileId">The file id.</param>
        /// <param name="file">The file path.</param>
        protected override void AddNewFile(XContainer filesContainer, string fileId, string file)
        {
            XDocument document = filesContainer as XDocument;

            if (document != null)
            {
                document.Root.Add(new XElement("File", new XAttribute("id", fileId), new XAttribute("url", file)));
            }
            else
            {
                filesContainer.Add(new XElement("File", new XAttribute("id", fileId), new XAttribute("url", file)));
            }
        }
コード例 #8
0
 protected bool addElementToNode(XElement newElement, XContainer container)
 {
     try
     {
         container.Add(newElement);
         this.saveDocument();
     }
     catch (System.Exception exception)
     {
         Console.WriteLine(this.ToString() + "->addElementToNode Exception. Err : " + exception.Message);
         return false;
     }
     return true;
 }
コード例 #9
0
 public MappingWriter(DatabaseTable table, CodeWriterSettings codeWriterSettings)
 {
     _codeWriterSettings = codeWriterSettings;
     var ns = codeWriterSettings.Namespace;
     _table = table;
     _doc = XDocument.Parse(@"<?xml version=""1.0"" encoding=""utf-8"" ?>
     <hibernate-mapping xmlns=""urn:nhibernate-mapping-2.2"" namespace=""" + ns + @""" assembly=""" + ns + @""">
     </hibernate-mapping>");
     var hibmap = _doc.Descendants(_xmlns + "hibernate-mapping").First();
     //add the class element
     _classElement = new XElement(_xmlns + "class",
                                  new XAttribute("name", _table.NetName),
                                  new XAttribute("table", SqlSafe(_table.Name)),
                                  _table.SchemaOwner != null ? new XAttribute("schema", SqlSafe(_table.SchemaOwner)) : null,
         //consider this
                                  new XAttribute("dynamic-update", "true"),
                                  new XAttribute("optimistic-lock", "dirty"));
     if (_table is DatabaseView)
     {
         _classElement.Add(new XAttribute("mutable", "false"));
     }
     hibmap.Add(_classElement);
 }
コード例 #10
0
        private static void TraverseWithXDocument(XContainer document, string path)
        {
            bool inDirectories = true;
            string[] folderDirectories = Directory.GetDirectories(path);

            if (0 == folderDirectories.Length)
            {
                folderDirectories = Directory.GetFiles(path);
                inDirectories = false;
            }

            for (int i = 0; i < folderDirectories.Length; i++)
            {
                if (inDirectories)
                {
                    XAttribute attribute = new XAttribute("path", folderDirectories[i]);
                    XElement innerNode = new XElement("dir", attribute);
                    TraverseWithXDocument(innerNode, folderDirectories[i]);
                    document.Add(innerNode);
                }
                else
                {
                    XAttribute attribute = new XAttribute("fileName", Path.GetFileName(folderDirectories[i]));
                    XElement innerNode = new XElement("file", attribute);
                    document.Add(innerNode);
                }
            }
        }
コード例 #11
0
        private void WriteObject(string name, object value, XContainer parent, IDictionary<string, XNamespace> namespaces)
        {
            if(HaveCustomValueConvertor(value.GetType()))
            {
                var valueConvertorType = reflection.GetGenericTypeOf(typeof (IValueConvertor<>), value);
                var convertor = serviceLocator.Resolve(valueConvertorType);

                var elementName = GetXmlNamespace(namespaces, value.GetType()) + name;

                var convertedValue = reflection.InvokeToElement(convertor, value, v => GetXmlNamespace(namespaces, v));

            	convertedValue = ApplyMessageSerializationBehaviorIfNecessary(value.GetType(), convertedValue);

                parent.Add(new XElement(elementName, convertedValue));
            }
			else if(HaveCustomSerializer(value.GetType()))
			{
				var customSerializer = customElementSerializers.First(s => s.CanSerialize(value.GetType()));
				var elementName = GetXmlNamespace(namespaces, value.GetType()) + name;
				var element = customSerializer.ToElement(value, v => GetXmlNamespace(namespaces, v));
				var customElement = new XElement(elementName, element);
				customElement = ApplyMessageSerializationBehaviorIfNecessary(value.GetType(), customElement);
				parent.Add(customElement);
			}
            else if (ShouldPutAsString(value))
            {
                var elementName = GetXmlNamespace(namespaces, value.GetType()) + name;
                parent.Add(new XElement(elementName, FormatAsString(value)));
            }
			else if (value is byte[])
			{
				var elementName = GetXmlNamespace(namespaces, typeof(byte[])) + name;
				parent.Add(new XElement(elementName, Convert.ToBase64String((byte[]) value)));
			}
			else if (ShouldTreatAsDictionary(value.GetType()))
			{
				XElement list = GetContentWithNamespace(value, namespaces, name);
				parent.Add(list);
				var itemCount = 0;
				foreach (var item in ((IEnumerable)value))
				{
					if (item == null)
						continue;
					itemCount += 1;
					if (itemCount > MaxNumberOfAllowedItemsInCollection)
						throw new UnboundedResultSetException("You cannot send collections with more than 256 items (" + value + " " + name + ")");

					var entry = new XElement("entry");
					var keyProp = reflection.Get(item, "Key");
					if (keyProp == null)
						continue;
					WriteObject("Key", keyProp, entry, namespaces);
					var propVal = reflection.Get(item, "Value");
					if (propVal != null)
					{
						WriteObject("Value", propVal, entry, namespaces);
					}
					
					list.Add(entry);
				}
			}
			else if (value is IEnumerable)
            {
                XElement list = GetContentWithNamespace(value, namespaces, name);
                parent.Add(list);
                var itemCount = 0;
                foreach (var item in ((IEnumerable)value))
                {
                    if (item == null)
                        continue;
                    itemCount += 1;
                    if (itemCount > MaxNumberOfAllowedItemsInCollection)
                        throw new UnboundedResultSetException("You cannot send collections with more than 256 items (" + value + " " + name + ")");

                    WriteObject("value", item, list, namespaces);
                }
            }
            else
            {
                XElement content = GetContentWithNamespace(value, namespaces, name);
                foreach (var property in reflection.GetProperties(value))
                {
                    var propVal = reflection.Get(value, property);
                    if (propVal == null)
                        continue;
                    WriteObject(property, propVal, content, namespaces);
                }
            	content = ApplyMessageSerializationBehaviorIfNecessary(value.GetType(), content);
				parent.Add(content);
            }
        }
コード例 #12
0
        private void WriteObject(string name, object value, XContainer parent, IDictionary<string, XNamespace> namespaces)
        {
            //TODO custom value converter IValueConverter<T> from RSB
            //TODO custom serializer ICustomElementSerializer from RSB
            if (ShouldPutAsString(value))
            {
                var elementName = GetXmlNamespace(namespaces, value.GetType()) + name;
                parent.Add(new XElement(elementName, FormatAsString(value)));
            }
            else if (value is byte[])
            {
                var elementName = GetXmlNamespace(namespaces, typeof(byte[])) + name;
                parent.Add(new XElement(elementName, Convert.ToBase64String((byte[])value)));
            }
            else if (ShouldTreatAsDictionary(value.GetType()))
            {
                XElement list = GetContentWithNamespace(value, namespaces, name);
                parent.Add(list);
                foreach (dynamic keyValuePair in ((IEnumerable)value))
                {
                    var entry = new XElement("entry");
                    object keyProp = keyValuePair.Key;
                    if (keyProp == null)
                        continue;
                    WriteObject("Key", keyProp, entry, namespaces);

                    object propVal = keyValuePair.Value;
                    if (propVal != null)
                    {
                        WriteObject("Value", propVal, entry, namespaces);
                    }

                    list.Add(entry);
                }
            }
            else if (value is IEnumerable)
            {
                XElement list = GetContentWithNamespace(value, namespaces, name);
                parent.Add(list);
                foreach (var item in ((IEnumerable)value))
                {
                    if (item == null)
                        continue;

                    WriteObject("value", item, list, namespaces);
                }
            }
            else
            {
                XElement content = GetContentWithNamespace(value, namespaces, name);
                foreach (var property in value.GetType().GetProperties())
                {
                    var propVal = property.GetValue(value, new object[]{});
                    if (propVal == null)
                        continue;
                    WriteObject(property.Name, propVal, content, namespaces);
                }
                content = ApplyMessageSerializationBehaviorIfNecessary(value.GetType(), content);
                parent.Add(content);
            }
        }
コード例 #13
0
        /// <summary>
        /// Updates the property element.
        /// </summary>
        /// <param name="property">The property.</param>
        /// <param name="elementPosition">The element position.</param>
        /// <param name="fileId">The file id.</param>
        private static void UpdatePropertyElement(XContainer property, SourceElementPosition elementPosition, string fileId)
        {
            if (!property.Elements().Any())
            {
                var seqpnt = new XElement(
                    "pt",
                    new XAttribute("visit", "0"),
                    new XAttribute("fid", fileId),
                    new XAttribute("sl", elementPosition.Start));

                property.Add(seqpnt);
            }
            else
            {
                foreach (var pt in property.Elements().Take(1))
                {
                    pt.Add(new XAttribute("sl", elementPosition.Start));
                    pt.Add(new XAttribute("fid", fileId));
                }
            }
        }
コード例 #14
0
 /// <summary>
 /// Adds a new source code file to the report.
 /// </summary>
 /// <param name="filesContainer">The files container.</param>
 /// <param name="fileId">The file id.</param>
 /// <param name="file">The file path.</param>
 protected override void AddNewFile(XContainer filesContainer, string fileId, string file)
 {
     filesContainer.Add(new XElement("File", new XAttribute("uid", fileId), new XAttribute("fullPath", file)));
 }
コード例 #15
0
 public override void Close()
 {
     _root.Add(_content);
 }
コード例 #16
0
ファイル: Api.aspx.cs プロジェクト: GuardSources/Skylark
 private void NiGuan(string path, XContainer result)
 {
     Response.Write("<!-- Processing");
     Response.Flush();
     var url = Rbase64.Decode(Request.QueryString["Url"].UrlDecode());
     if (string.IsNullOrWhiteSpace(url)) return;
     foreach (var video in Net.YouTube.Video.GetVideoFromLink(url))
     {
         var element = new XElement("video", new XAttribute("title", video.Title),
             new XAttribute("url", video.Url), new XAttribute("author", video.Author),
             new XAttribute("keywords", string.Join(", ", video.Keywords)),
             new XAttribute("rating", video.AverageRating), new XAttribute("viewCount", video.ViewCount),
             new XAttribute("uploadTime", video.UploadTime.Ticks), new XAttribute("length", video.Length));
         foreach (var link in video.Downloads)
         {
             var e = new XElement("download", new XAttribute("type", link.ToString()),
                                  new XAttribute("information", link.Properties));
             if (link.UrlUnavailableException == null) e.SetAttributeValue("link",
                 string.Format("{0}://{1}/Task/Create/Offline/{2}?Url={3}", Request.Url.Scheme,
                     Request.Url.Host, FileHelper.Combine(path, (link.Parent.Title + link.Extension)
                         .ToValidPath()), Rbase64.Encode(link.GetUrl(link.Parent.Title))));
             element.Add(e);
         }
         result.Add(element);
         Response.Write('.');    // prevent the thread from getting killed, how evil I am MUAHAHA
         Response.Flush();
     }
     Response.Write(" -->" + Environment.NewLine);
 }
コード例 #17
0
		internal static void SortCollectionProperties(XContainer propertyElement)
		{
			if (propertyElement.Elements().Count() < 2)
				return;

			// Write collection properties in guid sorted order,
			// since order is not significant in collections.
			var sortCollectionData = new SortedDictionary<string, XElement>(StringComparer.OrdinalIgnoreCase);
			foreach (var objsurElement in propertyElement.Elements(SharedConstants.Objsur))
			{
				var key = objsurElement.Attribute(SharedConstants.GuidStr).Value.ToLowerInvariant();
				if (!sortCollectionData.ContainsKey(key))
					sortCollectionData.Add(key, objsurElement);
			}

			propertyElement.Elements().Remove();
			foreach (var kvp in sortCollectionData)
				propertyElement.Add(kvp.Value);
		}
コード例 #18
0
		internal static void SortMultiSomethingProperty(XContainer multiSomethingProperty)
		{
			if (multiSomethingProperty.Elements().Count() < 2)
				return;

			var sortedAlternativeElements = new SortedDictionary<string, XElement>();
			foreach (var alternativeElement in multiSomethingProperty.Elements())
			{
				var ws = alternativeElement.Attribute("ws").Value;
				sortedAlternativeElements.Add(ws, alternativeElement);
			}

			multiSomethingProperty.Elements().Remove();
			foreach (var kvp in sortedAlternativeElements)
				multiSomethingProperty.Add(kvp.Value);
		}
コード例 #19
0
ファイル: XmlDataStore.cs プロジェクト: Cyarix/PassFruit
 private XElement GetOrCreateElement(string elementName, XContainer parentElement)
 {
     elementName = elementName.ToLowerInvariant();
     var element = parentElement.Element(elementName);
     if (element == null) {
         element = new XElement(elementName);
         parentElement.Add(element);
     }
     return element;
 }
コード例 #20
0
        internal static void CopyExtendedPropertiesToSsdlElement(MetadataItem metadataItem, XContainer xContainer)
        {
            foreach (var extendedProperty in metadataItem.MetadataProperties.Where(mp => mp.PropertyKind == PropertyKind.Extended))
            {
                var exPropertyElement = extendedProperty.Value as XElement;
                if (exPropertyElement != null)
                {
                    // find the CopyToSSDL attribute - if it exists it can be in any EDMX namespace
                    var copyToSSDLAttribute = exPropertyElement.Attributes().FirstOrDefault(
                        attr => attr.Name.LocalName.Equals("CopyToSSDL", StringComparison.Ordinal)
                                && SchemaManager.GetEDMXNamespaceNames().Contains(attr.Name.NamespaceName));
                    if (copyToSSDLAttribute != null)
                    {
                        if ((bool?)copyToSSDLAttribute == true)
                        {
                            // CopyToSsdl is true, so let's copy this extended property
                            var exAttributeNamespace = copyToSSDLAttribute.Name.Namespace;
                            var newExPropertyElement = new XElement(exPropertyElement);
                            var newCopyToSsdlAttribute = newExPropertyElement.Attribute(exAttributeNamespace + "CopyToSSDL");
                            newCopyToSsdlAttribute.Remove();

                            var namespacePrefix = newExPropertyElement.GetPrefixOfNamespace(exAttributeNamespace);
                            if (namespacePrefix != null)
                            {
                                var xmlnsEdmxAttr = newExPropertyElement.Attribute(XNamespace.Xmlns + namespacePrefix);
                                if (xmlnsEdmxAttr != null)
                                {
                                    xmlnsEdmxAttr.Remove();
                                }
                            }
                            xContainer.Add(newExPropertyElement);
                        }
                    }
                }
            }
        }
コード例 #21
0
 protected virtual void AddElements(XContainer root)
 {
     root.Add(new XElement("import-id", 1));
     root.Add(new XElement("user-id", "ABC"));
     root.Add(new XElement("echo", "123"));
 }
コード例 #22
0
ファイル: BplXmlFormatter.cs プロジェクト: borkaborka/gmit
      // recursively serializes a BPL object
      private void _serializeObject(XContainer parent, BplObject bplObject, BplClass expectedClass) {
         if (bplObject == null) return;

         var bplClass = bplObject.Class;
         var schema = bplClass.Schema;
         var prefix = BplLanguage.Schemas[schema];
         NSMapping.AddIfNeeded(prefix, schema);

         XElement element = null;
         if (expectedClass == null || schema == expectedClass.Schema) {
            element = new XElement(bplClass.TagName);
         } else {
            NSMapping.AddIfNeeded("xsi", xsi);
            element = new XElement(expectedClass.TagName);
            element.Add(new XAttribute(xsi + "type", prefix + ":" + bplClass.TagName.LocalName));
         }

         var identityProperty = bplClass.IdentityProperty;
         if (identityProperty != null) {
            var id = (BplIdentity)identityProperty.GetValue(bplObject);
            if (!id.IsEmpty) {
               element.Add(new XAttribute(identityProperty.TagName, id.ToString(bplClass.IdentityScope)));
            } else if (bplClass.IsA<BplEntity>()) {
               AddError("{0} is missing Id.", bplObject);
            }
         }

         // invariant: write the properties according to their "ProtocolIndex" order
         foreach (var property in bplClass.PropertiesSorted) {
            if (property.IsCalculated || property.IsVirtual || property == identityProperty) continue;

            var value = property.GetValue(bplObject);
            if (value == null) continue;

            if (!ShouldSerialize(property, bplObject)) continue;

            if (property.IsPrimitive) {
               if (property.IsScalar) {
                  _serializeScalar(element, property, value);
               } else if (property.IsArray) {
                  _serializeArray(element, property, (IEnumerable)value);
               }
            } else if (property.IsContainer) {
               if (property.IsReference) {
                  _serializeContainer(element, property, (BplObject)value);
               } else {
                  _serializeContainer(element, property, (IBplCollection)value);
               }
            } else if (property.IsAssociation) {
               if (property.IsReference) {
                  _serializeAssociation(element, property, (BplObject)value);
               } else {
                  _serializeAssociation(element, property, (IBplCollection)value);
               }
            }
         }

         parent.Add(element);
      }
コード例 #23
0
 private void SetInheritanceAttributes(XContainer element, IInheritable connectionInfo)
 {
     if (_saveFilter.SaveInheritance)
     {
         element.Add(new XAttribute("InheritCacheBitmaps", connectionInfo.Inheritance.CacheBitmaps.ToString()));
         element.Add(new XAttribute("InheritColors", connectionInfo.Inheritance.Colors.ToString()));
         element.Add(new XAttribute("InheritDescription", connectionInfo.Inheritance.Description.ToString()));
         element.Add(new XAttribute("InheritDisplayThemes", connectionInfo.Inheritance.DisplayThemes.ToString()));
         element.Add(new XAttribute("InheritDisplayWallpaper", connectionInfo.Inheritance.DisplayWallpaper.ToString()));
         element.Add(new XAttribute("InheritEnableFontSmoothing", connectionInfo.Inheritance.EnableFontSmoothing.ToString()));
         element.Add(new XAttribute("InheritEnableDesktopComposition", connectionInfo.Inheritance.EnableDesktopComposition.ToString()));
         element.Add(new XAttribute("InheritDomain", connectionInfo.Inheritance.Domain.ToString()));
         element.Add(new XAttribute("InheritIcon", connectionInfo.Inheritance.Icon.ToString()));
         element.Add(new XAttribute("InheritPanel", connectionInfo.Inheritance.Panel.ToString()));
         element.Add(new XAttribute("InheritPassword", connectionInfo.Inheritance.Password.ToString()));
         element.Add(new XAttribute("InheritPort", connectionInfo.Inheritance.Port.ToString()));
         element.Add(new XAttribute("InheritProtocol", connectionInfo.Inheritance.Protocol.ToString()));
         element.Add(new XAttribute("InheritPuttySession", connectionInfo.Inheritance.PuttySession.ToString()));
         element.Add(new XAttribute("InheritRedirectDiskDrives", connectionInfo.Inheritance.RedirectDiskDrives.ToString()));
         element.Add(new XAttribute("InheritRedirectKeys", connectionInfo.Inheritance.RedirectKeys.ToString()));
         element.Add(new XAttribute("InheritRedirectPorts", connectionInfo.Inheritance.RedirectPorts.ToString()));
         element.Add(new XAttribute("InheritRedirectPrinters", connectionInfo.Inheritance.RedirectPrinters.ToString()));
         element.Add(new XAttribute("InheritRedirectSmartCards", connectionInfo.Inheritance.RedirectSmartCards.ToString()));
         element.Add(new XAttribute("InheritRedirectSound", connectionInfo.Inheritance.RedirectSound.ToString()));
         element.Add(new XAttribute("InheritSoundQuality", connectionInfo.Inheritance.SoundQuality.ToString()));
         element.Add(new XAttribute("InheritResolution", connectionInfo.Inheritance.Resolution.ToString()));
         element.Add(new XAttribute("InheritAutomaticResize", connectionInfo.Inheritance.AutomaticResize.ToString()));
         element.Add(new XAttribute("InheritUseConsoleSession", connectionInfo.Inheritance.UseConsoleSession.ToString()));
         element.Add(new XAttribute("InheritUseCredSsp", connectionInfo.Inheritance.UseCredSsp.ToString()));
         element.Add(new XAttribute("InheritRenderingEngine", connectionInfo.Inheritance.RenderingEngine.ToString()));
         element.Add(new XAttribute("InheritUsername", connectionInfo.Inheritance.Username.ToString()));
         element.Add(new XAttribute("InheritICAEncryptionStrength", connectionInfo.Inheritance.ICAEncryptionStrength.ToString()));
         element.Add(new XAttribute("InheritRDPAuthenticationLevel", connectionInfo.Inheritance.RDPAuthenticationLevel.ToString()));
         element.Add(new XAttribute("InheritLoadBalanceInfo", connectionInfo.Inheritance.LoadBalanceInfo.ToString()));
         element.Add(new XAttribute("InheritPreExtApp", connectionInfo.Inheritance.PreExtApp.ToString()));
         element.Add(new XAttribute("InheritPostExtApp", connectionInfo.Inheritance.PostExtApp.ToString()));
         element.Add(new XAttribute("InheritMacAddress", connectionInfo.Inheritance.MacAddress.ToString()));
         element.Add(new XAttribute("InheritUserField", connectionInfo.Inheritance.UserField.ToString()));
         element.Add(new XAttribute("InheritExtApp", connectionInfo.Inheritance.ExtApp.ToString()));
         element.Add(new XAttribute("InheritVNCCompression", connectionInfo.Inheritance.VNCCompression.ToString()));
         element.Add(new XAttribute("InheritVNCEncoding", connectionInfo.Inheritance.VNCEncoding.ToString()));
         element.Add(new XAttribute("InheritVNCAuthMode", connectionInfo.Inheritance.VNCAuthMode.ToString()));
         element.Add(new XAttribute("InheritVNCProxyType", connectionInfo.Inheritance.VNCProxyType.ToString()));
         element.Add(new XAttribute("InheritVNCProxyIP", connectionInfo.Inheritance.VNCProxyIP.ToString()));
         element.Add(new XAttribute("InheritVNCProxyPort", connectionInfo.Inheritance.VNCProxyPort.ToString()));
         element.Add(new XAttribute("InheritVNCProxyUsername", connectionInfo.Inheritance.VNCProxyUsername.ToString()));
         element.Add(new XAttribute("InheritVNCProxyPassword", connectionInfo.Inheritance.VNCProxyPassword.ToString()));
         element.Add(new XAttribute("InheritVNCColors", connectionInfo.Inheritance.VNCColors.ToString()));
         element.Add(new XAttribute("InheritVNCSmartSizeMode", connectionInfo.Inheritance.VNCSmartSizeMode.ToString()));
         element.Add(new XAttribute("InheritVNCViewOnly", connectionInfo.Inheritance.VNCViewOnly.ToString()));
         element.Add(new XAttribute("InheritRDGatewayUsageMethod", connectionInfo.Inheritance.RDGatewayUsageMethod.ToString()));
         element.Add(new XAttribute("InheritRDGatewayHostname", connectionInfo.Inheritance.RDGatewayHostname.ToString()));
         element.Add(new XAttribute("InheritRDGatewayUseConnectionCredentials", connectionInfo.Inheritance.RDGatewayUseConnectionCredentials.ToString()));
         element.Add(new XAttribute("InheritRDGatewayUsername", connectionInfo.Inheritance.RDGatewayUsername.ToString()));
         element.Add(new XAttribute("InheritRDGatewayPassword", connectionInfo.Inheritance.RDGatewayPassword.ToString()));
         element.Add(new XAttribute("InheritRDGatewayDomain", connectionInfo.Inheritance.RDGatewayDomain.ToString()));
     }
     else
     {
         element.Add(new XAttribute("InheritCacheBitmaps", false.ToString()));
         element.Add(new XAttribute("InheritColors", false.ToString()));
         element.Add(new XAttribute("InheritDescription", false.ToString()));
         element.Add(new XAttribute("InheritDisplayThemes", false.ToString()));
         element.Add(new XAttribute("InheritDisplayWallpaper", false.ToString()));
         element.Add(new XAttribute("InheritEnableFontSmoothing", false.ToString()));
         element.Add(new XAttribute("InheritEnableDesktopComposition", false.ToString()));
         element.Add(new XAttribute("InheritDomain", false.ToString()));
         element.Add(new XAttribute("InheritIcon", false.ToString()));
         element.Add(new XAttribute("InheritPanel", false.ToString()));
         element.Add(new XAttribute("InheritPassword", false.ToString()));
         element.Add(new XAttribute("InheritPort", false.ToString()));
         element.Add(new XAttribute("InheritProtocol", false.ToString()));
         element.Add(new XAttribute("InheritPuttySession", false.ToString()));
         element.Add(new XAttribute("InheritRedirectDiskDrives", false.ToString()));
         element.Add(new XAttribute("InheritRedirectKeys", false.ToString()));
         element.Add(new XAttribute("InheritRedirectPorts", false.ToString()));
         element.Add(new XAttribute("InheritRedirectPrinters", false.ToString()));
         element.Add(new XAttribute("InheritRedirectSmartCards", false.ToString()));
         element.Add(new XAttribute("InheritRedirectSound", false.ToString()));
         element.Add(new XAttribute("InheritSoundQuality", false.ToString()));
         element.Add(new XAttribute("InheritResolution", false.ToString()));
         element.Add(new XAttribute("InheritAutomaticResize", false.ToString()));
         element.Add(new XAttribute("InheritUseConsoleSession", false.ToString()));
         element.Add(new XAttribute("InheritUseCredSsp", false.ToString()));
         element.Add(new XAttribute("InheritRenderingEngine", false.ToString()));
         element.Add(new XAttribute("InheritUsername", false.ToString()));
         element.Add(new XAttribute("InheritICAEncryptionStrength", false.ToString()));
         element.Add(new XAttribute("InheritRDPAuthenticationLevel", false.ToString()));
         element.Add(new XAttribute("InheritLoadBalanceInfo", false.ToString()));
         element.Add(new XAttribute("InheritPreExtApp", false.ToString()));
         element.Add(new XAttribute("InheritPostExtApp", false.ToString()));
         element.Add(new XAttribute("InheritMacAddress", false.ToString()));
         element.Add(new XAttribute("InheritUserField", false.ToString()));
         element.Add(new XAttribute("InheritExtApp", false.ToString()));
         element.Add(new XAttribute("InheritVNCCompression", false.ToString()));
         element.Add(new XAttribute("InheritVNCEncoding", false.ToString()));
         element.Add(new XAttribute("InheritVNCAuthMode", false.ToString()));
         element.Add(new XAttribute("InheritVNCProxyType", false.ToString()));
         element.Add(new XAttribute("InheritVNCProxyIP", false.ToString()));
         element.Add(new XAttribute("InheritVNCProxyPort", false.ToString()));
         element.Add(new XAttribute("InheritVNCProxyUsername", false.ToString()));
         element.Add(new XAttribute("InheritVNCProxyPassword", false.ToString()));
         element.Add(new XAttribute("InheritVNCColors", false.ToString()));
         element.Add(new XAttribute("InheritVNCSmartSizeMode", false.ToString()));
         element.Add(new XAttribute("InheritVNCViewOnly", false.ToString()));
         element.Add(new XAttribute("InheritRDGatewayUsageMethod", false.ToString()));
         element.Add(new XAttribute("InheritRDGatewayHostname", false.ToString()));
         element.Add(new XAttribute("InheritRDGatewayUseConnectionCredentials", false.ToString()));
         element.Add(new XAttribute("InheritRDGatewayUsername", false.ToString()));
         element.Add(new XAttribute("InheritRDGatewayPassword", false.ToString()));
         element.Add(new XAttribute("InheritRDGatewayDomain", false.ToString()));
     }
 }
コード例 #24
0
ファイル: XmlSerializer.cs プロジェクト: Canonzki/RestSharp
        private void Map(XContainer root, object obj)
        {
            Type objType = obj.GetType();
            IEnumerable<PropertyInfo> props = from p in objType.GetProperties()
                                              let indexAttribute = p.GetAttribute<SerializeAsAttribute>()
                                              where p.CanRead && p.CanWrite
                                              orderby indexAttribute == null
                                                  ? int.MaxValue
                                                  : indexAttribute.Index
                                              select p;
            SerializeAsAttribute globalOptions = objType.GetAttribute<SerializeAsAttribute>();

            foreach (PropertyInfo prop in props)
            {
                string name = prop.Name;
                object rawValue = prop.GetValue(obj, null);

                if (rawValue == null)
                {
                    continue;
                }

                string value = this.GetSerializedValue(rawValue);
                Type propType = prop.PropertyType;
                bool useAttribute = false;
                SerializeAsAttribute settings = prop.GetAttribute<SerializeAsAttribute>();

                if (settings != null)
                {
                    name = settings.Name.HasValue()
                        ? settings.Name
                        : name;
                    useAttribute = settings.Attribute;
                }

                SerializeAsAttribute options = prop.GetAttribute<SerializeAsAttribute>();

                if (options != null)
                {
                    name = options.TransformName(name);
                }
                else if (globalOptions != null)
                {
                    name = globalOptions.TransformName(name);
                }

                XName nsName = name.AsNamespaced(this.Namespace);
                XElement element = new XElement(nsName);
#if !WINDOWS_UWP
                if (propType.IsPrimitive || propType.IsValueType || propType == typeof(string))
#else
                if (propType.GetTypeInfo().IsPrimitive || propType.GetTypeInfo().IsValueType || propType == typeof(string))
#endif
                {
                    if (useAttribute)
                    {
                        root.Add(new XAttribute(name, value));
                        continue;
                    }

                    element.Value = value;
                }
                else if (rawValue is IList)
                {
                    string itemTypeName = "";

                    foreach (object item in (IList) rawValue)
                    {
                        if (itemTypeName == "")
                        {
                            Type type = item.GetType();
                            SerializeAsAttribute setting = type.GetAttribute<SerializeAsAttribute>();

                            itemTypeName = setting != null && setting.Name.HasValue()
                                ? setting.Name
                                : type.Name;
                        }

                        XElement instance = new XElement(itemTypeName.AsNamespaced(this.Namespace));

                        this.Map(instance, item);
                        element.Add(instance);
                    }
                }
                else
                {
                    this.Map(element, rawValue);
                }

                root.Add(element);
            }
        }
コード例 #25
0
        private void SetElementAttributes(XContainer element, ConnectionInfo connectionInfo)
        {
            var nodeAsContainer = connectionInfo as ContainerInfo;
            element.Add(new XAttribute("Name", connectionInfo.Name));
            element.Add(new XAttribute("Type", connectionInfo.GetTreeNodeType().ToString()));
            if (nodeAsContainer != null)
                element.Add(new XAttribute("Expanded", nodeAsContainer.IsExpanded.ToString()));
            element.Add(new XAttribute("Descr", connectionInfo.Description));
            element.Add(new XAttribute("Icon", connectionInfo.Icon));
            element.Add(new XAttribute("Panel", connectionInfo.Panel));

            element.Add(_saveFilter.SaveUsername
                ? new XAttribute("Username", connectionInfo.Username)
                : new XAttribute("Username", ""));

            element.Add(_saveFilter.SaveDomain
                ? new XAttribute("Domain", connectionInfo.Domain)
                : new XAttribute("Domain", ""));

            if (_saveFilter.SavePassword && !connectionInfo.Inheritance.Password)
                element.Add(new XAttribute("Password", _cryptographyProvider.Encrypt(connectionInfo.Password, _encryptionKey)));
            else
                element.Add(new XAttribute("Password", ""));

            element.Add(new XAttribute("Hostname", connectionInfo.Hostname));
            element.Add(new XAttribute("Protocol", connectionInfo.Protocol));
            element.Add(new XAttribute("PuttySession", connectionInfo.PuttySession));
            element.Add(new XAttribute("Port", connectionInfo.Port));
            element.Add(new XAttribute("ConnectToConsole", connectionInfo.UseConsoleSession.ToString()));
            element.Add(new XAttribute("UseCredSsp", connectionInfo.UseCredSsp.ToString()));
            element.Add(new XAttribute("RenderingEngine", connectionInfo.RenderingEngine));
            element.Add(new XAttribute("ICAEncryptionStrength", connectionInfo.ICAEncryptionStrength));
            element.Add(new XAttribute("RDPAuthenticationLevel", connectionInfo.RDPAuthenticationLevel));
            element.Add(new XAttribute("LoadBalanceInfo", connectionInfo.LoadBalanceInfo));
            element.Add(new XAttribute("Colors", connectionInfo.Colors));
            element.Add(new XAttribute("Resolution", connectionInfo.Resolution));
            element.Add(new XAttribute("AutomaticResize", connectionInfo.AutomaticResize.ToString()));
            element.Add(new XAttribute("DisplayWallpaper", connectionInfo.DisplayWallpaper.ToString()));
            element.Add(new XAttribute("DisplayThemes", connectionInfo.DisplayThemes.ToString()));
            element.Add(new XAttribute("EnableFontSmoothing", connectionInfo.EnableFontSmoothing.ToString()));
            element.Add(new XAttribute("EnableDesktopComposition", connectionInfo.EnableDesktopComposition.ToString()));
            element.Add(new XAttribute("CacheBitmaps", connectionInfo.CacheBitmaps.ToString()));
            element.Add(new XAttribute("RedirectDiskDrives", connectionInfo.RedirectDiskDrives.ToString()));
            element.Add(new XAttribute("RedirectPorts", connectionInfo.RedirectPorts.ToString()));
            element.Add(new XAttribute("RedirectPrinters", connectionInfo.RedirectPrinters.ToString()));
            element.Add(new XAttribute("RedirectSmartCards", connectionInfo.RedirectSmartCards.ToString()));
            element.Add(new XAttribute("RedirectSound", connectionInfo.RedirectSound.ToString()));
            element.Add(new XAttribute("SoundQuality", connectionInfo.SoundQuality.ToString()));
            element.Add(new XAttribute("RedirectKeys", connectionInfo.RedirectKeys.ToString()));
            element.Add(new XAttribute("Connected", (connectionInfo.OpenConnections.Count > 0).ToString()));
            element.Add(new XAttribute("PreExtApp", connectionInfo.PreExtApp));
            element.Add(new XAttribute("PostExtApp", connectionInfo.PostExtApp));
            element.Add(new XAttribute("MacAddress", connectionInfo.MacAddress));
            element.Add(new XAttribute("UserField", connectionInfo.UserField));
            element.Add(new XAttribute("ExtApp", connectionInfo.ExtApp));
            element.Add(new XAttribute("VNCCompression", connectionInfo.VNCCompression));
            element.Add(new XAttribute("VNCEncoding", connectionInfo.VNCEncoding));
            element.Add(new XAttribute("VNCAuthMode", connectionInfo.VNCAuthMode));
            element.Add(new XAttribute("VNCProxyType", connectionInfo.VNCProxyType));
            element.Add(new XAttribute("VNCProxyIP", connectionInfo.VNCProxyIP));
            element.Add(new XAttribute("VNCProxyPort", connectionInfo.VNCProxyPort));

            element.Add(_saveFilter.SaveUsername
                ? new XAttribute("VNCProxyUsername", connectionInfo.VNCProxyUsername)
                : new XAttribute("VNCProxyUsername", ""));

            element.Add(_saveFilter.SavePassword
                ? new XAttribute("VNCProxyPassword",
                    _cryptographyProvider.Encrypt(connectionInfo.VNCProxyPassword, _encryptionKey))
                : new XAttribute("VNCProxyPassword", ""));

            element.Add(new XAttribute("VNCColors", connectionInfo.VNCColors));
            element.Add(new XAttribute("VNCSmartSizeMode", connectionInfo.VNCSmartSizeMode));
            element.Add(new XAttribute("VNCViewOnly", connectionInfo.VNCViewOnly.ToString()));
            element.Add(new XAttribute("RDGatewayUsageMethod", connectionInfo.RDGatewayUsageMethod));
            element.Add(new XAttribute("RDGatewayHostname", connectionInfo.RDGatewayHostname));
            element.Add(new XAttribute("RDGatewayUseConnectionCredentials", connectionInfo.RDGatewayUseConnectionCredentials));

            element.Add(_saveFilter.SaveUsername
                ? new XAttribute("RDGatewayUsername", connectionInfo.RDGatewayUsername)
                : new XAttribute("RDGatewayUsername", ""));

            element.Add(_saveFilter.SavePassword
                ? new XAttribute("RDGatewayPassword",
                    _cryptographyProvider.Encrypt(connectionInfo.RDGatewayPassword, _encryptionKey))
                : new XAttribute("RDGatewayPassword", ""));

            element.Add(_saveFilter.SaveDomain
                ? new XAttribute("RDGatewayDomain", connectionInfo.RDGatewayDomain)
                : new XAttribute("RDGatewayDomain", ""));
        }
コード例 #26
0
ファイル: Api.aspx.cs プロジェクト: GuardSources/Skylark
 private void Details(string path, XContainer result)
 {
     var element = FileHelper.GetElement(FileHelper.GetDataFilePath(path));
     var info = new FileInfo(FileHelper.GetFilePath(path));
     if (element.GetAttributeValue("state") == TaskType.NoTask || element.GetAttributeValue("size") == null)
         element.SetAttributeValue("size", info.Length);
     element.SetAttributeValue("lastWriteTimeUtc", info.LastWriteTimeUtc);
     element.Add(new XElement("ffmpeg", FFmpeg.Analyze(info.FullName)));
     result.Add(element);
 }
コード例 #27
0
        private void CreateComment(IQuickXmlItem item, XContainer document = null)
        {
            var comment = new XComment(item.Value);
            var parentElement = _elementLookup.LastOrDefault(i => i.Key < item.Depth).Value;

            if (parentElement != null)
                parentElement.Add(comment);
            else if (document != null)
                document.Add(comment);
        }
コード例 #28
0
ファイル: XNodeBuilder.cs プロジェクト: yicong/corefx
 private void Close()
 {
     _root.Add(_content);
 }
コード例 #29
0
 private void Close()
 {
     root.Add(content);
 }
コード例 #30
0
ファイル: BaseJobRunner.cs プロジェクト: uQr/kudu
        private static XElement GetOrCreateElement(XContainer root, string name)
        {
            var element = root.XPathSelectElement(name);

            if (element == null)
            {
                element = new XElement(name);
                root.Add(element);
            }

            return element;
        }
コード例 #31
0
ファイル: XmlData.cs プロジェクト: hillwhite/DeltaEngine
 private void AddXChildren(XContainer root, XDocument doc)
 {
     foreach (XmlData child in Children)
         root.Add(child.GetXRootElement(doc));
 }
コード例 #32
0
ファイル: XmlParser.cs プロジェクト: sevensky/win8stock
        private XContainer ParseNode(StringCounter sc, XContainer parent)
        {
            sc.TrimStart();
            if (sc.StartValue == '<')
            {
                sc.Index = sc.Index + 1;
                XContainer node = null;
                bool isComment = false;
                bool isDeclaration = false;
                int breakOff = 0;
                XName name = null;
                if (sc.StartsWith("?xml"))
                {
                    //Declaration
                    isDeclaration = true;
                    sc.Index += 4;
                }
                else if (sc.StartValue == '!')
                {
                    //Comment
                    isComment = true;
                    if (sc.Value[sc.Index + 1] == '-') breakOff = 1;
                    if (sc.Value[sc.Index + 2] == '-') breakOff = 2;
                    sc.Index += breakOff + 1;
                    sc.TrimStart();
                }
                else if (IsValidTagChar(sc.StartValue))
                {
                    //Name
                    name = ParseName(sc);
                    if (name != null)
                    {
                        node = new XElement(name);
                    }
                    else
                    {
                        throw new Exception("Invalid Node Name.");
                    }
                }
                else
                {
                    throw new Exception("Invalid Node Name.");
                }



                if (node != null || isComment || isDeclaration)
                {

                    //Attributes
                    bool elementAtEnd = name != null ? (name.LocalName == "br") : false;

                    string comment = string.Empty;
                    string declVer = string.Empty;
                    string declEnc = string.Empty;
                    string declSta = string.Empty;
                    for (int i = sc.Index; i < sc.Value.Length; i++)
                    {
                        if (!isComment && !isDeclaration)
                        {
                            //Node Attributes
                            if (sc.Value[i] != ' ')
                            {                                                     
                                if (sc.Value[i] == '>')
                                {
                                    sc.Index = i + 1;
                                    break;
                                }
                                else if (sc.Value[i] == '/' && sc.Value[i + 1] == '>')
                                {
                                    elementAtEnd = true;
                                    sc.Index += 2;
                                    break;
                                }
                                else if (IsValidTagChar(sc.Value[i]))
                                {
                                    XAttribute att = ParseAttribute(sc.NewIndex(i));
                                    i = sc.Index - 1;
                                    if (att != null)
                                    {
                                        node.Add(att);
                                    }
                                }
                            }
                        }
                        else
                        {
                            if (isComment)
                            {
                                //Comment
                                if ((breakOff == 2 && sc.Value[i] == '-' && sc.Value[i + 1] == '-' && sc.Value[i + 2] == '>') || (breakOff == 0 && sc.Value[i] == '>') || (breakOff == 1 && sc.Value[i] == '-' && sc.Value[i + 1] == '>'))
                                {
                                    if (parent != null) parent.Add(new XComment(comment));
                                    sc.Index = i + breakOff + 1;
                                    break;
                                }
                                else
                                {
                                    comment += sc.Value[i];
                                }
                            }
                            else if (isDeclaration)
                            {
                                //Declaration
                                if (sc.Value[i] == '?' && sc.Value[i + 1] == '>')
                                {
                                    if (parent != null && parent is XDocument) ((XDocument)parent).Declaration = new XDeclaration(declVer, declEnc, declSta);
                                    sc.Index = i + 2;
                                    break;
                                }
                                else if (IsValidTagChar(sc.Value[i]))
                                {
                                    XAttribute att = ParseAttribute(sc.NewIndex(i));
                                    i = sc.Index - 1;
                                    if (att != null)
                                    {
                                        if (att.Name.LocalName.ToLower() == "version")
                                        {
                                            declVer = att.Value;
                                        }
                                        else if (att.Name.LocalName.ToLower() == "encoding")
                                        {
                                            declEnc = att.Value;
                                        }
                                        else if (att.Name.LocalName.ToLower() == "standalone")
                                        {
                                            declSta = att.Value;
                                        }
                                    }
                                }
                            }
                        }
                    }


                    if (node != null) parent.Add(node);


                    //Content
                    if (node != null && !elementAtEnd)
                    {
                        string innerText = string.Empty;
                        string fullName = name.ToString();
                        for (int i = sc.Index; i < sc.Value.Length; i++)
                        {
                            if (sc.Value[i] == '<')
                            {
                                if (innerText != string.Empty)
                                {
                                    node.Add(XmlParser.DecodeXml(innerText));
                                    innerText = string.Empty;
                                }

                                if (sc.Value[i + 1] == '/')
                                {
                                    //End Tag
                                    XName endName = ParseName(sc.NewIndex(i + 2));
                                    if (endName != null)
                                    {
                                        if (CompareXName(endName, name))
                                        {
                                            //Actual End Name
                                            sc.Index = i + 3 + fullName.Length;
                                            break;
                                        }
                                        else
                                        {
                                            if (name.LocalName != "script")
                                            {
                                                //Other End Name
                                                XContainer par = ((parent is XElement && XmlParser.CompareXName(((XElement)parent).Name, endName)) ? parent : (XContainer)this.FindParent(parent, endName));
                                                if (par != null)
                                                {
                                                    if (name.LocalName != "form")
                                                    {
                                                        XElement[] enm = MyHelper.EnumToArray(node.Elements());
                                                        if (enm.Length > 0)
                                                        {
                                                            foreach (XElement elem in enm)
                                                            {
                                                                parent.Add(elem);
                                                            }
                                                        }
                                                        node.Elements().Remove();
                                                        sc.Index = i;
                                                        break;
                                                    }
                                                    else
                                                    {
                                                        sc.Index = i + endName.ToString().Length + 3;
                                                        i = sc.Index - 1;
                                                    }
                                                }
                                                else
                                                {
                                                    sc.Index = i + endName.ToString().Length + 2;
                                                    i = sc.Index - 1;
                                                }
                                            }
                                        }
                                    }
                                    else if (fullName == "script")
                                    {
                                        //Script Text
                                        //innerText += text[i];
                                    }
                                    else
                                    {
                                        throw new Exception("Invalid End Name.");
                                    }

                                }
                                else if (fullName == "script")
                                {
                                    //Script Text
                                    //innerText += text[i];
                                }
                                else
                                {
                                    //Start Tag
                                    XContainer childNode = this.ParseNode(sc.NewIndex(i), node);
                                    i = sc.Index - 1;
                                }
                            }
                            else if (!(sc.Value[i] == ' ' && innerText == string.Empty))
                            {
                                //Inner Text
                                if (fullName != "script") innerText += sc.Value[i];
                            }
                        }
                    }

                }
                sc.TrimStart();
                return node;
            }
            else
            {
                throw new Exception("Invalid Start Tag. A node has to start with [<].");
            }
        }
コード例 #33
0
        public void Save(XContainer node)
        {
            // Actualizamos la cámara antes de guardarla
            CalculatePosition();

            // Armamos los elementos más pequeños
            // Position
            XElement position = new XElement("position");
            position.SetAttributeValue("x", Position.x);
            position.SetAttributeValue("y", Position.y);
            position.SetAttributeValue("z", Position.z);

            // Target
            XElement target = new XElement("target");
            target.SetAttributeValue("x", Target.x);
            target.SetAttributeValue("y", Target.y);
            target.SetAttributeValue("z", Target.z);

            // Up
            XElement up = new XElement("up");
            up.SetAttributeValue("x", Up.x);
            up.SetAttributeValue("y", Up.y);
            up.SetAttributeValue("z", Up.z);

            // Creamos el elemento cámara
            XElement camera = new XElement("camera");
            camera.SetAttributeValue("farClip", FarClip);
            camera.SetAttributeValue("nearClip", NearClip);
            camera.SetAttributeValue("fieldOfView", FOV);
            // Le asignamos los nodos hijos
            camera.Add(position);
            camera.Add(target);
            camera.Add(up);

            // Asignamos la cámara como hijo del documento
            node.Add(camera);
        }