Click here to Skip to main content
16,021,823 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want extract key value pair from xml file in my java code.

My XML element that contain key value pair :

<ips>
    <ip key="192.168.12.11"  value="owner" />
    <ip key="192.168.12.12"  value="cus" />
</ips>


What I have tried:

@XmlAccessorType(XmlAccessType.FIELD)
 @XmlType(name = "", propOrder = {
        "ip"
 })
 public static class dBIp {

     protected Map<String,String> ip;

     public Map<String,String> getIp() {
         if (ip == null) {
                ip = new HashMap<String,String>();
          }
          System.out.println("ip===="+this.ip);
          return this.ip;
      }

 }
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900