Hello!
I want to have JAXB-annotated classes which would be
marshalled/unmarshalled to different XML namespaces.
What I need is something like:
<someRootElement xmlns="urn:my:ns1"
xmlns:a="urn:my:ns2" xmlns:b="urn:my:ns3">
<someElement/>
<a:someElement/>
<b:someElement/>
</someRootElement>
How can it be done?
Can it be ...
I have been tasked with refactoring some components that used xmlbeans to now make use of jaxb. Everything is going great, until I get to a place where the previous author has called the copy() function of one of the XmlObjects. Since all objects in xmlbeans extend XmlObject, we get the magic deep copy function for free.
Jaxb does not s...
I have following schema
<complexType name="BookShelf">
<sequence>
<element name="newBook" type="string" minOccurs="0" maxOccurs="unbounded"/>
<element name="oldBook" type="string" minOccurs="0" maxOccurs="unbounded"/>
</sequence>
</complexType>
XJC generates BookShelf class with two lists, one for newBook and one for...
I have this Maven "task" to generate Java classes from an XSD file using JAXB.
<!-- XML to Java classes -->
<plugin>
<groupId>com.sun.tools.xjc.maven2</groupId>
<artifactId>maven-jaxb-plugin</artifactId>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>generate</goal>
</g...
I'm getting a javax.xml.bind.JAXBException: "doesnt contain ObjectFactory.class or jaxb.index" while trying to create a JAXBContext using JAXBContext.newInstance(String contextPath). I'm guessing there's a "usual" way to create and maintain a jaxb.index file?
...
I have some jaxb objects (instantiated from code generated from xsd by jaxb) that I need to clone. The Jaxb class does not appear to provide an interface for doing this easily. I can not hand edit the class and can not extend it - so I need to create a helper/utility method to do this. What is the best approach?
...
My first post, so go easy on me.
I'm looking for advice on organising and referencing third party jars for use in my j2ee web application. The jars I need to organise and reference are the JWSDP-2.0 JAXB api jars.
I'm using Eclipse and Tomcat 5.5. My web app exchanges XML with a web service, and therefore needs to do some XML marshall...
I'm new to using JAXB, and I used JAXB 2.1.3's xjc to generate a set of classes from my XML Schema. In addition to generating a class for each element in my schema, it created an ObjectFactory class.
There doesn't seem to be anything stopping me from instantiating the elements directly, e.g.
MyElement element = new MyElement();
where...
I am connecting to a webservice which has a service deifnition of the following format
<main>
<header>
<data>xyz</data>
</header>
<test>
<![CDATA[<xml><a></a><b></b></xml>]]>
</test>
</main>
How do I use jaxb to create class file for the cdata strcture
...
Hi,
I have a structure like this:
Hashtable<String, ArrayList<Hashtable<Integer, Integer>>> complexTable
And I want to marshall this using JAXB. I suppose I should write an Adapter for this, but I have no idea how this adapter should look like. Can anybody help me with this?
...
Castor framework (xml to java bean binder framework) provides functionality to map my existing java bean to xml. Can I achieve same thing using JAXB ?
...
Hi,
I have a complexType like:
<xsd:complexType name="NightlyRate">
<xsd:complexContent>
<xsd:extension base="com:Money">
<xsd:attribute name="night" type="com:Number" use="required"/>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
Now, I want to add a child element to "NightlyRate", whi...
I need to create one of these as the interface requires it...can someone please let me know how to create one, as there doesnt seem to be a c'tor defined?
...
I am using JAXB to unmarshall an XML file into a Java object -- standard stuff. Once JAXB has completed this, I'd like a method to be called on the newly created object.
Is there a mechanism to do this? I'd prefer the object, not an external entity, do this to keep construction in one place.
Thanks.
...
Hi,
I am using JAXB to parse my xml schema(xsd). I have a complexType as follows:
<xsd:complexType name="PromotionalInfo">
<xsd:attribute name="promotionName" type="xsd:string" use="required"/>
<xsd:attribute name="blackOutDates" type="DateList"/>
<xsd:attribute name="amount" type="xsd:float" use="required"/>
<xsd:attri...
Hi,
I have been having problem with adding type="date" in my schema, as whenever it is null it throws a marshalling error. I found out that for elements we can add an attribute like nullable="true" and get rid of this issue. But, wasn't able to find similar way for attributes. Is there a way to avoid this issue for attributes?
Thanks!...
I have successfully marshaled the following class
@XmlRootElement(name = "Field")
private static class MyField {
@XmlAttribute(name = "Name")
String name;
@XmlElement(name = "Size")
int size;
....}
Now I want to have my container class to hold multiple instances of Field, so I declared a class in the followi...
I need to load wikipedia revision histories into POJOs, so I'm using JAXB to unmarshall the wikipeida data dump (well, individual pages of it). The problem is that the text nodes occasionally contain entities that are not defined in the wikipedia xml dump. eg: (`°' pleases keep in mind that I do not know the complete set of entiti...
Hi,
suppose I have this class:
public class A {
private HashMap<String, B> map;
@XmlElement
private void setB(ArrayList<B> col) {
...
}
private ArrayList<B> getB() {
...
}
}
When trying to unmarshall an xml document to this class using JaxB I notice that instead of calling the setB() method...
I am trying to match the text contents(character data) of an XML file with a series of regexs and then change the XML based on the matches. Example:
<text>
<para>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
</para>
</text>
I want to match for instance ...