0

assume the following XML structure:

<A>
 <B>
   <C>
     <!-- other stuff -->
   </C>
 </B>
</A>

I am not interested in mapping tags A and B, I just want to map C and what is within it. I tried it like this:

@Root
@Path("/A/B")
public class C {
  // Mapping for fields within
}

Also tried @Path("/A/B/C") but nothing seems to work. I don't want to create mappings for the outer tags.

It crashes with the following error message:

"Exception in thread "main" org.simpleframework.xml.core.ValueRequiredException: Unable to satisfy @org.simpleframework.xml.Element(name=, type=void, data=false, required=true) on field 'InvoiceNumber' public java.lang.String silc.xml.ups.Invoice.InvoiceNumber for class silc.xml.ups.Invoice at line 2"

Here, "InvoiceNumber" is another element within tag C. If I comment out A and B everything works as intended with no error.

My expected result is, that tags A and B are ignored and C is treatet as root node for parsing the XML document.

Any suggestions on how to do this?

Jim Garrison
  • 85,615
  • 20
  • 155
  • 190
NilsHaldenwang
  • 3,567
  • 3
  • 20
  • 30

0 Answers0