Help with xml(solved)

I start to play with xml document and i try to reproduce a simple xml structure but no success until now,can anyone help with this ?
this is the structure i try to reproduce

<modDesc descVersion="20"> <author>john</author> <version>1.0</version> <title> <en>My XML</en> </title> <description> <en>My Test</en> </description> </modDesc>
and here is my code

Dim xml As New XmlDocument dim root as XmlNode root = xml.AppendChild(xml.CreateElement("modDesc")) root.SetAttribute("descVersion", "20") Dim author As XMLNode author =root.AppendChild(xml.CreateElement("author")) Dim player As XMLNode player =author.AppendChild(xml.CreateElement("Player")) player.SetAttribute("name", "john") LoadXml1(xml)
and the result i get…

<modDesc descVersion="20"> <Author> <Player name="john"/> </Author> </modDesc>

On tag i want to pass only the name “john”.

Hello Loannis,

Your code is very close to what you need. Here is the modified code which seems to show the XML that you want to create:

[code] Dim xml As New XmlDocument
dim root as XmlNode
root = xml.AppendChild(xml.CreateElement(“modDesc”))
root.SetAttribute(“descVersion”, “20”)
Dim author As XMLNode
author =root.AppendChild(xml.CreateElement(“author”))

Dim version As XMLNode
author =root.AppendChild(xml.CreateElement(“version”))

Dim title As XMLNode
title =root.AppendChild(xml.CreateElement(“title”))
Dim em as XmlNode
em = title.AppendChild(xml.CreateElement(“en”))
em.AppendChild(xml.CreateTextNode(“My XML”))

Dim description As XMLNode
description =root.AppendChild(xml.CreateElement(“description”))
description.AppendChild(xml.CreateTextNode(“My Test”))

//Save the file
Dim f as FolderItem
Dim dlg as new SaveAsDialog
dlg.PromptText = “Save XML File”
f = dlg.showmodal()

This example saves the file to your computer with code in the bottom. .

Happy to help.

XML with Xojo

Thank you Eugene.
So the trick was the CreateTextNode.
Really appreciate the Help