<application>
<name>test</name>
<instance>
<instanceId>test-6cd8b7f98b-k67zg:test:5000</instanceId>
<hostName>192.168.9.243</hostName>
<app>PLATFORM-xxxx-MANAGEMENT</app>
<ipAddr>192.168.9.243</ipAddr>
<status>UP</status>
<overriddenstatus>UNKNOWN</overriddenstatus>
<port enabled="true">5000</port>
<securePort enabled="false">443</securePort>
<countryId>1</countryId>
<dataCenterInfo class="com.netflix.appinfo.InstanceInfo$DefaultDataCenterInfo">
<name>MyOwn</name>
</dataCenterInfo>
<leaseInfo>
<renewalIntervalInSecs>30</renewalIntervalInSecs>
<durationInSecs>90</durationInSecs>
<registrationTimestamp>1606459374104</registrationTimestamp>
<lastRenewalTimestamp>1606483497025</lastRenewalTimestamp>
</leaseInfo>
<metadata>
<management.port>5000</management.port>
</metadata>
<homePageUrl>http://192.168.9.1:5000/</homePageUrl>
</instance>
</application>
比如某个接口返回的response是如上的XML,我们需要从上面获取homePageUrl的值
首先将XML转换为JSON:
var DATA = xml2Json(responseBody);
|