KeyshawnJohnson
New Member
I am reading some xml. (What I am reading is fxg files if you are familar with them.)Part of the data has varying tag names:\[code\]\[code\]<varying_name1 scaleX="1.0046692" x="177.4" y="74.2"/><varying_name2 scaleX="1.0031128" x="171.9" y="118.9"/> \[/code\]..\[/code\]I have created a class named Transforms to represent the data within the varying tag name segment. On my jaxb class to hold the data I have:\[code\] @XmlAnyElement(lax=true)
@XmlJavaTypeAdapter(TransformAdapter.class)
protected List transforms;\[/code\]In my Adapter, I attempt to unmarshall the data:\[code\] JAXBContext context = JAXBContext.newInstance(Transform.class); Unmarshaller unmarshaller = context.createUnmarshaller(); Transform result = (Transform) unmarshaller.unmarshal(v); \[/code\]However, my code throws an exception here because the root name on my element varies. It is not a constant. I get: ""unexpected element (uri:"http://ns.adobe.com/fxg/2008", local:"m6_mc"). Expected elements are (none)""How can I get it to just unmarshall my data as if the root element had the name it expected?
@XmlJavaTypeAdapter(TransformAdapter.class)
protected List transforms;\[/code\]In my Adapter, I attempt to unmarshall the data:\[code\] JAXBContext context = JAXBContext.newInstance(Transform.class); Unmarshaller unmarshaller = context.createUnmarshaller(); Transform result = (Transform) unmarshaller.unmarshal(v); \[/code\]However, my code throws an exception here because the root name on my element varies. It is not a constant. I get: ""unexpected element (uri:"http://ns.adobe.com/fxg/2008", local:"m6_mc"). Expected elements are (none)""How can I get it to just unmarshall my data as if the root element had the name it expected?