Home AMX User Forum NetLinx Studio

xml to variable

Hi

I am trying to store a xml string from my buffer to a structure by using xml_to_variable
But I could not, can some one help

struct _address
{
char name [30]
char email_id[100]
char place [100]
char age [3]
}

define_variable
_address address [20]


and in my button_event
push:
{
Value = XML_TO_VARIABLE (address, server_buffer, 1, 0)
}

The data in my buffer looks like

<address1>
<name1>bravo</name1>
<emaid1>sss@dddf.com</emailid1>
<place1>gdrkdr</place1>
<age1>44</age1>
</address1>
<address2>
<name2>bravo</name2>
<emaid2>sss@dddf.com</emailid2>
<place2>gdrkdr</place2>
<age2>44</age2>
</address2>

Comments

  • viningvining Posts: 4,368
    I would first do a VARIABLE_TO_XML on your structure to see the format that it creates and then use that XML file to enter your data in the proper fields. Then do the XML_TO_VARIABLE to then load the data into your structure.

    Download XMLPad which is a nice little app. for XML viewing and data manipulation.

    I don't believe you can't arbitrarily create your onw XML format and expect this function to know how to handle it.
  • GSLogicGSLogic Posts: 562
    vining wrote:
    I don't believe you can't arbitrarily create your onw XML format and expect this function to know how to handle it.

    You can't change the structure of the XML file but you can load data offline in to an XML file and then have Netlinx load that data on an event.
Sign In or Register to comment.