Sending IP in XML

I’m playing with ajax and sending/receiving data from a web page via XML.

At the moment I’m trying to send the IP address of the arduino back to the client in XML, but simply putting each array member in the XML tags throws back an error in the browser.

 cl.print("<?xml version = \"1.0\" ?>");
    cl.print("<ips>");
    
    cl.print("<ip01>");
    cl.print(ip[0]);
    cl.print("<ip01>");

    cl.print("<ip02>");
    cl.print(ip[1]);
    cl.print("<ip02>");

    cl.print("<ip03>");
    cl.print(ip[2]);
    cl.print("<ip03>");

    cl.print("<ip04>");
    cl.print(ip[3]);
    cl.print("<ip04>");

    cl.print("<ips>");

I’m struggling to work out what format I need to have each octet in to successfully send them to the client.

Any help would be much appreciated!

Your xml is malformed. You need to have open and closed xml tags. You have all open tags. For example:

<container>data</container>
<ipaddress>192.168.0.3</ipaddress>

<ips>
 <ip01>192</ip01>
 <ip02>168</ip02>
 <ip03>0</ip03>
 <ip04>3</ip04>
</ips>

Notice that the second matching closing tag has the character ‘/’ to show it is a closing tag. This is missing from your xml.