Marshal « jaxb « Java XML Q&A

Home
Java XML Q&A
1.convert
2.Development
3.document
4.dom
5.dom4j
6.dtd
7.element
8.jaxb
9.jaxp
10.jdom
11.jsoup
12.namespace
13.Node
14.parse
15.parser
16.pdf
17.sax
18.schema
19.stax
20.tag
21.transform
22.Validation
23.xalan
24.xmlbeans
25.xpath
26.xsd
27.xslt
28.xstream
Java XML Q&A » jaxb » Marshal 

1. JAXB Marshalling with null fields    stackoverflow.com

This is a pretty simple request, but I just didn't find a way to do it. I'm basically trying to set up a role in JAXB which says that whenever an null ...

2. JAXB: Can I make XmlAttribute's parameter "required=true" to default?    stackoverflow.com

I have

@XmlAttribute(required=true)
in hundreds places in a projects. Can I make this default?... ...So that I then only need to specify
@XmlAttribute(required=false)
when needed.

3. How do I marshal a JAXB object to XOM?    stackoverflow.com

I'm trying to figure out what bits I need to plug together to marshal a JAXB POJO to a XOM document, and vice versa. The JAXB Marshaller interface's marshal methods take various ...

4. JAXB - Add a node to the XML as html link    stackoverflow.com

I have a basic JavaBean in my service layer and originally it was not designed for marshalling. This object is used by both JAX-WS, JAX-RS, and Servlets in other layers ...

5. Is there any way to restict the marshalling depth for object graphs in JAXB?    stackoverflow.com

I'm using JAXB for quick-and-dirty XML generation. I have a class that represents a tree structure:

@XmlRootElement(name = "element")
public class Element {

  // [...]

  @XmlElementWrapper(name="childs")
  @XmlElementRef
  public List<Element> ...

6. Marshalling an object that has object fields    stackoverflow.com

Not sure if the title makes any sense. I have an object that I want to marshal using JAXB that looks like this:

@XmlRootElement(name = "subscriptionRequest")
    public class RegistrationRequest {

 ...

7. JAXB Marshalling Objects with java.lang.Object field    stackoverflow.com

I'm trying to marshal an object that has an Object as one of its fields.

@XmlRootElement
public class TaskInstance implements Serializable {
   ...
   private Object dataObject;
   ...
}
The ...

8. How to Customize JAXB Marshalling if generating JAXB beans from XML    stackoverflow.com

I want to customize the marshalling of dates in JAXB. It's a variant of this already asked question. I would think I would use an XMLAdapter, as this answer ...

9. Can JAXB Incrementally Marshall An Object?    stackoverflow.com

I've got a fairly simple, but potentially large structure to serialize. Basically the structure of the XML will be:

<simple_wrapper>
   <main_object_type>
     <sub_objects>
   </main_object_type>
 ...

10. How to add DOCTYPE and xml processing instructions when marshalling with JAXB?    stackoverflow.com

I am marshalling (serializing) JAXB beans to output stream. How can I add DOCTYPE declaration and xml processing instructions to ouput? I am doing currently marshalling like this:

JAXBContext jaxbContext = JAXBContext.newInstance("com.example.package");
Marshaller ...

11. JAXB Work-Flow - How Do You Jump into Using JAXB    stackoverflow.com

The JAXB documentation is like a text-book, and I simply don't have to time to learn everything JAXB before I need to use it. I have an XSD, if I want to ...

12. How to marshal an object via JAXB without any information about it?    stackoverflow.com

I have an object value, which is of some type, either @XmlRootElement-annotated, or not. I want to marshal it into XML:

String value1 = "test";
assertEquals("<foo>test</foo>", toXml("foo", value1));
// ...
@XmlRootElement
class Bar {
  public ...

13. How to marshal a JAXB class instance as its superclass    stackoverflow.com

Is it possible to marshal a JAXB annotated class instance as its superclass (which is also a JAXB annotated class)?

@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "BenamningTYPE", propOrder = {"benamningId"})
@XmlSeeAlso({MoreDetailedBenamningTYPE.class})
public class BenamningTYPE {
    ...

14. Insert additional fields in JAXB marshalling    stackoverflow.com

When marshaling some objects into XML, I need to insert an additional field in each of the resulting XML objects - sort of flag. The purpose is not modifying the source ...

15. JAXB marshalling/unmarshalling without any configuration    stackoverflow.com

I'm trying to marshal/unmarshal Java ValueObject class through JAXB. To do it, I found that it requires XML Schema file and ObjectFactory class that can be automatically created by ant. If so, it seems ...

16. JAXB Web Services: Multiple Object Marshalling    stackoverflow.com

I can marshal and unmarshal 1 object with no problems (in netbeans); I need to know how to do this with multiple objects? I can't generate anything but null pointer exceptions ...

17. jaxb marshaling    stackoverflow.com

my class is like below.

class Employee {
  private String Code;
      //getter and setter below
}
using jaxb when i marshal i am getting below elements
<employee><code>some value</code></employee>
but i ...

18. JAXB Marshalling and Polymorphism    stackoverflow.com

I have a hierarchy of JAXB-generated classes. I would like to marshal a child class as a base class element (but with all the child class attributes), using xsi:type to indicate ...

19. JAXB Resteasy marshall desired fields    stackoverflow.com

I would like to marshall an object using JAXB, the problems is that I would like to marshall just some fields depending on some business logic. For example I have an ...

20. JAXB marshalling XMPP stanzas    stackoverflow.com

I am trying to marshall a message using the following snippet:

        JAXBContext jContext = JAXBContext.newInstance(Iq.class);
        Marshaller m ...

21. How can I marshal Objects from a Socket without closing it? (JAXB Marshaling from Inputstream via Socket)    stackoverflow.com

I have tried in many different ways to send my xml document over a socket connection between a server and a client without closing the socket after sending (keep the outputstream ...

23. Comment Node JaxB Marshalling    stackoverflow.com

I have a Document element with comment node in it. I tried to marshall the document using Transformer, the comment node is not ignored but when marshalling using JAXB, the comment ...

24. How to get output in JAXB (marshaling)?    stackoverflow.com

I tried hello world example from here and I can't see any output in my program (in console when using "java" command). Is it something wrong I do? The ...

25. JAXB runtime specify what to marshall    stackoverflow.com

Im wondering is there any RUNTIME possibility how to select which fields should be omitted during marshalling. I know that there is @XmlTransient annotation, but that is not runtime. E.g.

@XmlRootElement
public class Person ...

26. Does jaxb support redefine in marshalling    stackoverflow.com

I have 2 XML schema, called Banner-2.2.xsd and BatchBanner-2.2.xsd. BatchBanner-2.2.xsd contains

<xs:redefine schemaLocation="BannerXml-2.2.xsd" >
The jaxb generates from it the classes as expected, there is a class called OriginalBanner according to Banner-2.2.xsd and ...

27. JAXB Does not Marshall as Expected    stackoverflow.com

A buddy of mine asked me to post this question: EDIT: He decided to post the question on his own here: JAXB Unmarshalls XML Incorrectly I tried to delete this ...

28. How to add XML processing instructions during JAXB marshal    stackoverflow.com

I would like to add a processing instruction whenever a collection/array property is serialized to get something like

<alice>
  <? array bob ?>
  <bob>edgar</bob>
  <bob>david</bob>
</alice>
Is this possible with JAXB? ...

29. How to generate XML version other than 1.0 while marshalling with JAXB    stackoverflow.com

I have few XSD files and corresponding XJC files. The version number of all the generated XML files using JAXB should be uniform and should be picked up from either XJC ...

30. JAXB marshall/unmarshall using propOrder and null values    stackoverflow.com

I have a class that looks like this:

public class Word {
      String text;
      String root;
      int ...

31. Marshaling arrays in JAXB    stackoverflow.com

I have no problem to marshal Job objects but when i try to marhsal an array of Job i am getting a bad XML. It seems like i need to create ...

32. JAXB creating context and marshallers cost    stackoverflow.com

The question is a bit theoretical, what is the cost of creating JAXB context, marshaller and unmarshaller? I've found that my code could benefit from keeping the same JAXB context and possibly ...

33. JAXB marshalling and unmarshalling CDATA    stackoverflow.com

I have a requirement in which i have XML like this

<programs>
   <program>
      <name>test1</name>
      <instr><![CDATA[ some string ]]></instr>
   ...

34. JAX-B is marshalling everything    stackoverflow.com

I have a class with an @XmlRootElement(name="objectName",namespace="https:blahblah") and some attributes in the class all with @XmlElement(namespace="https:blahblah") But now I have some element without an XmlElement annotation. Why is it also marshalled? I only ...

35. Java Marshalling and UnMarshalling    stackoverflow.com

Employee.xsd

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:jxb="http://java.sun.com/xml/ns/jaxb" jxb:version="1.0" elementFormDefault="qualified">
<xsd:include schemaLocation="Family.xsd"/>
    <xsd:element name="NewFields">
        <xsd:complexType>
          ...

36. Marshalling a domain class to 2 different JSONs    stackoverflow.com

I have a requirement to produce different JSON from one of my domain classes without changing the current JAXB annotations. The only way that comes to mind is to extend my ...

37. JAXB 2.0 - how to marshal static inner classes    stackoverflow.com

In JAXB 2.0 if you compile a schema to java classes and a class contains an inner class, are you required to do anything different while building your content tree from ...

38. Marshal inner class with JAXB - Java    stackoverflow.com

I followed the following tutorial on JAXB http://blog.adamsbros.org/2010/02/07/jaxb-example-code/, and wanted to modify it to include the class I want to as an nested (inner) class as follows:

import javax.xml.bind.JAXBContext; 
import ...

java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.