0

When i try to read xml data from Ajax response

xmlDoc = data[0].body; alert(xmlDoc);

i got below string of xml string

"<VNET><ID>0</ID><UID>0</UID><GID>0</GID><UNAME>oneadmin</UNAME><GNAME>oneadmin</GNAME><NAME>vnet</NAME><PERMISSIONS><OWNER_U>1</OWNER_U><OWNER_M>1</OWNER_M><OWNER_A>0</OWNER_A><GROUP_U>0</GROUP_U><GROUP_M>0</GROUP_M><GROUP_A>0</GROUP_A><OTHER_U>0</OTHER_U><OTHER_M>0</OTHER_M><OTHER_A>0</OTHER_A></PERMISSIONS><CLUSTER_ID>-1</CLUSTER_ID><CLUSTER></CLUSTER><TYPE>0</TYPE><BRIDGE>bro</BRIDGE><VLAN>0</VLAN><PHYDEV/><VLAN_ID/><GLOBAL_PREFIX/><SITE_PREFIX/><RANGE><IP_START>192.168.5.2</IP_START><IP_END>192.168.5.254</IP_END></RANGE><TOTAL_LEASES>0</TOTAL_LEASES><TEMPLATE><DNS><![CDATA[192.168.5.1]]></DNS><GATEWAY><![CDATA[192.168.5.1]]></GATEWAY><NETWORK_ADDRESS><![CDATA[192.168.5.0]]></NETWORK_ADDRESS><NETWORK_MASK><![CDATA[255.255.255.0]]></NETWORK_MASK></TEMPLATE></VNET>"

so to avoid Html parsing in javascript. I want actual xml formate string.

ex:

"<VNET><ID>0</ID><UID>0</UID></VNET>"

want like

"<VNET><ID>0</ID><UID>0</UID></VNET>"

Any One please help me

1 Answer 1

1

The following answer would do what you're looking for, but it would be better to ensure the XML is not encoded in the original data response. https://stackoverflow.com/a/14227660/463205

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.