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

Community Tip - Stay updated on what is happening on the PTC Community by subscribing to PTC Community Announcements. X

I have to edit particular node in the xml file node will be user input how can I do it???

svempalli
1-Visitor

I have to edit particular node in the xml file node will be user input how can I do it???

suppose I have following xml

<edge>

<processing>

<threads_count>99</threads_count>

<queue_limit>1233</queue_limit>

</processing>

<gui>

<port>9901</port>

</gui>

<edge>

I can edit processing data like this xmlFile.*::processing but processing will be user input it can be either processing/ gui hw to use variable data in that code ???

ACCEPTED SOLUTION

Accepted Solutions
PaiChung
22-Sapphire I
(To:svempalli)

Have you tried [YourVariableHere] or (YourVariableHere) to represent the node?

View solution in original post

2 REPLIES 2
PaiChung
22-Sapphire I
(To:svempalli)

Have you tried [YourVariableHere] or (YourVariableHere) to represent the node?

Hi ...

you could create a mashup, with some textfields and pass on its contents to a service which is using numbers and input parameters (e.g. n1 & n2).

The service then manipulates the xml structure and you can use it with its values changed afterwards.

I've tried the following code which is replacing the numbers with the numbers I specify in the n1 & n2 input parameter:

I hope that helps...

Cheers,

Michael

// read xml file

var params = {

ignoreSSLErrors: true /* BOOLEAN */,

url: "<urlToMyXmlFile>" /* STRING */,

};

// get xml structure

var xmlVar = Resources["ContentLoaderFunctions"].GetXML(params);

// change values

xmlVar.*::processing.threads_count = n1;

xmlVar.*::processing.queue_limit = n2;

// return xml

var result = xmlVar.*::processing

Announcements


Top Tags