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

go - serving up pdfs using golang -

how to add preprocess loader in webpack 2 -

python - django admin: changing the way a field (w/ relationship to another model) is submitted on a form so that it can be submitted multiple times -