Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JAXBResult cannot be initialized with target type #252

Open
Tomas-Kraus opened this issue Sep 16, 2009 · 5 comments
Open

JAXBResult cannot be initialized with target type #252

Tomas-Kraus opened this issue Sep 16, 2009 · 5 comments
Assignees
Labels
enhancement New feature or request Major Priority

Comments

@Tomas-Kraus
Copy link
Contributor

If I want to unmarshal an XML document on to a class that doesn't have the
@XmlRootElement annotation, then I can use unmarshaller.unmarshal(source, Class)
to tell it which type to bind to, and it'll return me a JAXBElement for that type.

However, if I want to use JAXBResult to pipe a transform on to the same type, I
have no such option. JAXBResult gets a UnmarshallerHandler from the
Unmarshaller, but there's no mechanism for passing in the target type. And so,
JAXBResult can only target @XmlRootElement-annotated clases, which severely
limits its usefulness.

WOuld it be possible to have JAXBResult modified so that I can construct it with
a JAXBContext, plus a target type?

JAXBResult result = new JAXBResult(context, MyClass.class);
// perform transform on to result
JAXBElement output = result.getResult();

Environment

Operating System: All
Platform: All

Affected Versions

[2.1.12]

@Tomas-Kraus
Copy link
Contributor Author

@glassfishrobot Commented
Reported by skaffman

@Tomas-Kraus
Copy link
Contributor Author

@glassfishrobot Commented
Was assigned to snajper

@Tomas-Kraus
Copy link
Contributor Author

@glassfishrobot Commented
snajper said:
This requires api change, changing subcomponent.

@Tomas-Kraus
Copy link
Contributor Author

@glassfishrobot Commented
This issue was imported from java.net JIRA JAXB-690

@Tomas-Kraus
Copy link
Contributor Author

@lukasj lukasj transferred this issue from eclipse-ee4j/jaxb-ri May 19, 2022
@lukasj lukasj added enhancement New feature or request and removed Component: spec labels May 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Major Priority
Projects
None yet
Development

No branches or pull requests

3 participants