Skip to main content
1-Visitor
September 27, 2018
Question

create & Write data into XML file

  • September 27, 2018
  • 2 replies
  • 2555 views

hello everyone 

I want to create xml file on button click and write some content into this. which API do i need to used how to used it. could you please help me into this. 

 

Thanks in advance 

2 replies

5-Regular Member
September 27, 2018

The FileRepository thing template has a service called SaveXML. The input is the path and the content.

 

For write and edit XML files, here is a post explaining it:

 

Create XML

 

Here it is a example: 

 

var languages = <languages type="dynamic">
 <lang>JavaScript</lang>
 <lang>Python</lang>
</languages>;


var params = {
	path: "/theXml.xml" /* STRING */,
	content: languages /* XML */
};

// no return
Things["RepositoryThing"].SaveXML(params);

 

Hope it helps 😃

5-Regular Member
October 15, 2018

Hi @RockLala

 

Could you please confirm if your issue has been resolved. If yes, Please mark this post as accept as solution for the future reference, So that other can take benefit in case of same question.

 

Redards- Mohit Goel