ScriptSpot

Forum topic · General Scripting

DotNet XML usage

By Primergy · 2016-06-24

Downloads
Description

Hey guys I got a question about Dotnet and writing out xml files.

Currently I'm writing a script which should export data to a .xml file, which has to follow a certain format to be usable in a game.

I want to recreate the format of "open" in the line (see attachment please) but I have no clue which command I have to use.

I know how to add attributes to an element, but the thing I want to add, should not be an attribute sadly :/

Can someone give me the right direction?

My code so far:

dotNet.loadAssembly "system.xml"
xmlDoc=dotNetObject "system.xml.xmlDocument"
--Format properties and methods to the listener.
clearListener()
format "Properties\n"
showProperties xmlDoc
format "\nMethods\n"
showMethods xmlDoc

--Create a root element for the xml doc and add it to the xmlDocument.
root=xmlDoc.createElement "building_logic"
xmlDoc.appendChild root

--show the properties for the new element.
showMethods root

--add building defence type

defence_type_Element=xmlDoc.createElements "building_defence_type"
	--defence_type_Element. "building_defence_type"
	 open_element
	
root.appendchild defence_type_Element 
Comments (1)