users@jaxb.java.net

parameterizing attributes

From: Alec Swan <aukcioner_at_yahoo.com>
Date: Thu, 25 May 2006 10:49:39 -0700 (PDT)

I have an XML document, which contains an element, which gets unmarshalled and processed by my application. Now, suppose I want to simulate a case where I have a document with 1000 such elements (with little variations) and see how my application performs under load.

So, I added an attribute to the element, which allows me to specify how many times this elements needs to be processed by my application once it's unmarshalled. However, in order to avoid violating unique constraints (e.g. when storing element state in the database), I need to change some of its attributes and sub-elements. In other words, I need to be able to parameterize the element and replace parameters at run time with sequential or random values.

I was planning to use type adaptors, but then realized that they are used only during unmarshalling and will not help me replace parameters in attribute values after that. It would be nice if there was a way to instruct JAXB to use my preprocessor before returning the value from a getter method.

I would appreciate any ideas on how to best parameterize XML attributes and elements.

Thanks.