Questions tagged [xmlanyelement]
9 questions
3
votes
0 answers
JAXB MOXy marshalling and unmarshalling generic Collecton of Objects (including Strings and Primitive Wrappers)
I am facing issues marshalling and unmarshalling collections using MOXy. Collection may hold elements of any type. In the test case below I am trying to marshal and then unmarshall colection of Strings.
Test generates following output:
Going with…

Sla
- 91
- 7
2
votes
0 answers
JAXB @XmlAnyElement with default namespace adds prefix when marshalling
I have some JAXB classes that are supposed to map XML that may contain unknown elements which it should preserve.
I created a tiny testcase for this with two classes Thing and Subthing, where Thing also has an @XmlAnyElement List property.…

Stylpe
- 612
- 1
- 7
- 16
2
votes
1 answer
JSON marshaling of object arrays with JAXB
Using MOXy I'm trying to marshal a java class like this to JSON:
@XmlRootElement
@XmlAccessorType(XmlAccessType.FIELD)
public class Request {
String method;
@XmlAnyElement(lax=true)
Object[] arguments;
}
I would expect something like:
{
…

siddhadev
- 16,501
- 2
- 28
- 35
1
vote
0 answers
Parsing GPX XML "any"-Element from XSD generated classes
I'm trying to parse Geocaching GPX files with java. Those GPX files are based on standard GPX XSD file with an additional XSD file.
For class generation I'm using jaxb-maven-plugin.
Except from pom.xml:
…

darkspirit510
- 41
- 1
1
vote
1 answer
@XmlAnyElement does not unmarshal into specific Java type, but stop at JAXBElement
To learn how to use @XmlAnyElement, I created the following test service:
@WebService(serviceName = "TestServices")
@Stateless()
public class TestServices {
@WebMethod(operationName = "testMethod")
public ServiceResult testMethod() {
…

Mr.J4mes
- 9,168
- 9
- 48
- 90
1
vote
0 answers
@XmlAnyElement,DomHandler and completely unknown Xml
I have been following Blaise Doughan blog .
In this example we trimmed only the ........ section . so the output is
...
Without the trimming the String looks like
...…

web2dev
- 557
- 10
- 28
0
votes
1 answer
JAXB ANY element add marhalling error javax.xml.bind.JAXBException: class *** nor any of its super class is known to this context
I've got this autogenerated code from the xsd (extracted from CAURequest.java):
@XmlRootElement(name = "CAURequest")
public class CAURequest {
@XmlElement(name = "PF")
protected CAURequest.PF pf;
@XmlElement(name = "DI")
protected CAURequest.DI…

Francesco
- 55
- 7
0
votes
2 answers
MOXy order of fields in the target Java object matters when unmarshalling
It seems there is a bug in the MOXy. The piece of code below works perfectly when fields in class Request declared as metaInfo and then content, but test fails on unmarshalling with exception when fields declared in reverse order (content first and…

Sla
- 91
- 7
0
votes
1 answer
WinRT XmlAnyElement and Serialization
We have a Windows Store application that communicates with our server using XML for requests / responses and are serialized with the XmlSerializer. The issue we are encountering is that one of our types can contain arbitrary XML as one of its…

littlepod
- 1
- 1