Digester: Extracting node name for a map<tagname, value>

Posted by enguerran on Stack Overflow See other posts from Stack Overflow or by enguerran
Published on 2010-05-04T10:10:13Z Indexed on 2010/05/04 10:28 UTC
Read the original article Hit count: 229

My question is close to this one: Digester: Extracting node name

Even with the answer, I can't find out.

Here is my xml file (from smartgwt RestDataSource POST):

<data>
  <isc_OID_14>
    <attribute1>value1</attribute1>
    <attribute2>value2</attribute2>
  </isc_OID_14>
</data>

I would like to create, with Commons Digester, the following map : {attribute1=value1, attribute2=value2}

I already have those lines:

digester = new Digester();
digester.addObjectCreate("data", HashMap.class);
// some "put" rules matching something like data/*
return digester.parse(myFile);

I do not know the list nor the name of tags in the <data><sourceId /></data>. isc_OID_14 or attribute1 can be named foobar or id or attribute335...

© Stack Overflow or respective owner

Related posts about commons-digester

Related posts about java