cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Want the oppurtunity to discuss enhancements to PTC products? Join a working group! X

create & Write data into XML file

RockLala
12-Amethyst

create & Write data into XML file

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 2
vxavier
14-Alexandrite
(To:RockLala)

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 =)

mgoel
17-Peridot
(To:RockLala)

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  

Announcements


Top Tags