java - JAXB : Read non-static attributes into a collection -


i write jaxb implementation read/unmarshall below xml. challenge here how read attributes names not defined. in below example, keys can vary a1 an. question is, can use jaxb here? if yes, how write node.java class?

<?xml version="1.0"?>  <node a1="blabla"      a2="xyz"      a3="application"      a4="dfd"      a5="dfd"      ...     >        </node>   public class node { //what done here?   } 

you can use @xmlanyattribute :

@xmlrootelement public class node {      @xmlanyattribute     private map<qname,string> attributemap;      //getters , setters  } 

source : https://docs.oracle.com/javase/7/docs/api/javax/xml/bind/annotation/xmlanyattribute.html


Comments

Popular posts from this blog

html - How to set bootstrap input responsive width? -

javascript - Highchart x and y axes data from json -

javascript - Get js console.log as python variable in QWebView pyqt -