xml « jaxb « Java Enterprise Q&A





1. Intefacing EJB - XML using JAXB interface    stackoverflow.com

I was trying to add the XML schema to an existing EJB project. JAXB is used to bind the XML-Schema to a Java class. As we are going to use the ...

2. getter for boolean properties with JAXB    stackoverflow.com

I´m trying to expose services using jax-ws but the first surprise i got was that Weblogic does not support inner classes for request/response objects. After get over this situation here, ...

3. How to intercept xml response and request during web service invocation?    stackoverflow.com

I wonder if there is some neat way to intercept xml request send during java webservice method invocation and xml given in response? I don't want to print those xmls to ...

4. jaxb unmarshal abusable by crafted xml when using default sax parser?    stackoverflow.com

So in my current project I use the JAXB RI with the default Java parser from Sun's JRE (which I believe is Xerces) to unmarshal arbitrary XML. First I use XJC to ...

5. How to make generated classes contain Javadoc from XML Schema documentation    stackoverflow.com

I'm currently working with an XML Schema that has <xsd:annotation>/<xsd:documentation> on most types and elements. When I generate Java Beans from this XML Schema, then the Javadoc of those Beans only ...

6. Ignoring container elements through JAXB customization    stackoverflow.com

Hi all I am struggling with a simple JAXB customization issue. I have an schema like this. (its actually a snippet of Bing Maps Web Services schema)

 <xs:complexType name="GeocodeOptions">
  <xs:sequence>
  ...

7. JAXB: @XmlTransient on third-party or external super class    stackoverflow.com

I need some help regarding the following issue with JAXB 2.1. Sample: I've created a SpecialPerson class that extends a abstract class Person. Now I want to transform my object structure into ...

8. Where should you put XSD documentation in order for JAXB to pick them up and put them in Javadoc?    stackoverflow.com

I am developing a contract first webservice and wish to include the appropriate documentation in the schema so that it is as self descriptive as possible. What is the best practice to ...

9. XML strings in JAXB    stackoverflow.com

I have a JPA entity class mimicking a table. Something like this:

@XmlType(name="MyClassElementType")
public class MyClass {
    String name;
    String xmlDesc;

    public MyClass() {}

 ...





10. Jersey - JaxB: Should I send the stack trace for Bad XML?    stackoverflow.com

For any bad XML, by default the Jersey - JaxB throws the following: Method failed: HTTP/1.1 400 Bad Request My client(REST ws user) is insisting on giving a full blown info about the ...

11. Unmarshalling xml to a bean with a colleciton    stackoverflow.com

I'm working with Redmine's xml rest api. The service returns xml like in the example below. I'm using the Jersey Client API to communicate with the restful service. Mapping the plain ...

12. Can you optionally serialize a class property through JAXB?    stackoverflow.com

Is it possible to optionally serialize the properties of a class via JAX-B using using some dynamic flag? e.g. Suppose I Have

@XmlRootElement
public class TodoItem {
 private int id;
 private String title;
 private ...

13. parsing subnodes with Jersey    stackoverflow.com

We are connecting to a third party using Jersey. We then want to extract the returned xml into our class. This is actually working fine except for one node in the ...

14. Is there a JavaScript API for XML binding - analog to JAXB for Java?    stackoverflow.com

In Java, we work a lot with JAXB2. Object<->XML mappings are defined as annotations in Java classes:

@XmlRootElement(name="usertask", namespace="urn:test")
public class UserTask
{
    @XmlElement(namespace="urn:test")
    public String getAssignee() { ...

15. IllegalAnnotationException: Two classes have the same XML type name    stackoverflow.com

I am developing web service under JBoss 5 and Java 1.6. What could possibly cause this exception? Below is my simplified web service code.

@Stateless
@WebService()
public class AccountWS {

@WebMethod()
public CreateAccountResponse createAccount(@WebParam(name = "request") ...

16. Attribute on root element in a JAX-WS service    stackoverflow.com

I'm trying to annotate a java class which will in the input param in an JAX-WS based web service. The following is the input class

@XmlRootElement
class InputClass
   @XmlAttribute
   private ...





17. Who is using XML Schema 1.1 version? Which parser versions support it? etc    stackoverflow.com

The XML Schema 1.1 version of very good interesting features that are invaluable for my use cases. However, it seems to be relatively new. So I would like to get your ...

18. some problems parsing xml from webservice with JAXB    stackoverflow.com

I am having issues with parsing the xml response got from the service at http://wiki.dbpedia.org/Lookup My code for the main is the one up here, toghether with annotated ...

19. JAXB Annotation When XML Root Node contains PCData    stackoverflow.com

I'm trying to consume data from a 3rd party web service. Unfortunately, the web service is returning data in what I'd say is an unusual XML format. Here ...

20. Can JAX-B include an XML-valued attribute verbatim?    stackoverflow.com

I have an object which is the return value for a web service method. One of its properties contains an XML document. Ideally, I'd like to have JAX-B include that XML ...

21. Jersey/JAXB/XML/JSON: Adding elements to documents created from POJOs    stackoverflow.com

I'm new to Jersey, JAXB, and JSON, and fairly green with XML. I'm playing with a simple Web service (which strives to be RESTful). Given the following POJO:

@XmlRootElement
public class POJO {
 ...

22. JAXB Binding to change xs:date to xs:dateTime?    stackoverflow.com

I have to access a flawed web service where some fields in the WSDL have the type xs:date but I have to fill them as xs:dateTime. Is it possible to use a ...

23. Combine JAXB and JAXWS for an imported XML Schema    stackoverflow.com

How can I specify a JAXB Binding for an imported XSD within a WSDL when using wsimport? I tried following binding, which causes the error "XPath evaluation of //xs:element[@name='isFoobar'] results in an ...

24. RESTEASY - returning the same object with and without a list    stackoverflow.com

I have a bean that includes several properties and a list. E.g.

public class Person {
    @XmlElement
    public String getName() { }

    @XmlElement
 ...

25. Unable to specify which response type is accepted when calling a Jersey api    stackoverflow.com

I have a Jersey api that was previously set up to respond with XML (JAXB marshalling, @Produces("application/xml")). I now want to add the ability to request responses in JSON format using ...

26. Not able to append XML element in response    stackoverflow.com

I have created a webservices which accepts XML data and after some computation over server it adds few fields in xml and returns the output to the client. I am using ...

27. Problem with REST javax.xml.bind.MarshalException    stackoverflow.com

i tie to make a REST web service , when i returned a simple object it work fine . But when i returned An ArrayList of objects , i have this error ...

28. Converting XML string into valid XML in the Jersey XML output    stackoverflow.com

I am developing RESTful web services in Java using Jersey, Tomcat and Toplink. One of my requirement is replacing a resource link(person) with actual xml data(returned by that person resource link) ...

29. Generated Artifacts via JAXB fail to parse the log.xml    stackoverflow.com

I am trying to generate artifacts for log4j XML parsing using JAXB. I am using the dtd

http://logging.apache.org/log4j/1.2/apidocs/org/ap.../log4j/xml/doc-files/log4j.dtd
and inlined log.xml. I am getting below exception. I am ...

30. JAXB: How can derived object be returned as XML element of base type?    stackoverflow.com

I write web-services using jax-ws and wsdl contains set of types. Java classes to XML mapps using jaxb. Let's look at the following example:

@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "Person")
public class Person {   ...

31. Could not initialize class com.sun.xml.internal.ws.fault.SOAPFaultBuilder    stackoverflow.com

I am using Jaxb-impl-2.1.3.jar in the maven library.. every thing looks fine in pom entry.. if anyone come across with this error pleas give me an idea..

java.lang.reflect.InvocationTargetException
    ...

32. How to customise the XML output of a Jersey JAXB serialisation    stackoverflow.com

I have some @javax.xml.bind.annotation.Xml... annotated classes here intended for a RESt web service. Jersey is setup in a spring managed web container and the web service is returning a well formatted ...

33. Two classes have the same XML type name "objectFactory"    stackoverflow.com

We have been using JAXB 2.1 for a long time in our system. We have a platform that is built with Ant and generates a bunch of bundles that are deployed ...

34. Pushing JAX-B object over network    stackoverflow.com

I have some interface description in text describing a RESTful webserver. I also have JAX-B annotated objects that I want to push and receive from that interface. I'm not sure how much ...

35. Unmarshalling SOAP with JAXB leaves ANY-element empty (null)    stackoverflow.com

I'm unmarshalling a SOAP-message with JAXB, and while most of the message looks fine when unmarshalled, one element is null when its content should be plain text. If I change its ...

36. JAXB / Jackson handling arrays    stackoverflow.com

I'm currently writing a Jersey REST interface for a web application. What I want is the ability to be able to serialize a JSON and XML request to the same object ...

37. RestEasy JAXB - expose third party classes in XML    stackoverflow.com

I'm new both to RestEasy and JAXB. I think they're pretty easy to use as far as you control all the sources you want to expose via a web service. But now ...

38. javax.xml.ws.soap.SOAPFaultException: Rejected by policy. (from client)    stackoverflow.com

I am getting the following error javax.xml.ws.soap.SOAPFaultException: Rejected by policy. (from client) when I am trying to access a web service using JAXB client. Same authentication credentials worked properly using SOAP UI 3.0. ...

39. Learning mapping a class to XML schema complex type in JavaEE    stackoverflow.com

If I have the following definitions

@XmlType(name = "State", propOrder={"name", "zip"})
public class StateTo {
    ...
    @XmlElementWrapper(name = "Cities")
    @XmlElement(name = "City", type = ...

40. Parsing large xml files with JAXB    forums.netbeans.org

Hello, I am using JAXB to read xml document. Everything works well (fast and easy). Now, as the xml files I received becomes larger and larger, I have to increase the ...

41. JAXB Marshalling to XML loses xmlns from 3rd party xsd    forums.netbeans.org

The plaza & xs namespace tags are missing from the XML output. I believe they are missing since they are not used by the rest of the document so the marshaller ignores them. However, my vendor is querying why the xmlns schema tags are missing. Is there a way of forcing the marshaller to output these namespaces. I have tried amending ...

42. XML and Object already defined. JAXB type questions    coderanch.com

OK, so we have an Object Model already that we use in our application. We have a web service with its XML schema defined already. The Object Model and XML are set and I need to be able to convert between the two easily. JAXB has the marshalling and unmarshalling of XML to Object and back. For some reason in my ...

43. JAXB XML Processing    coderanch.com

IS it possible to process only a part of XML by binding a part of XML as input using the JAXB? My problem heare is, I need to process large XML documents and i need to process only a part of the XML document and the rest can be wtiten out without processing. I am using JAXB and binf the XML. ...

44. JAXB and larg xml document    coderanch.com

Hello all: I am still green in web services, and I need your collective wisdom to choose a technology for parsing and building large xml documents. I have some knowledge with DOM, SAX and JAXB, and I want to know which technology suites better. There will be 2 modules: The first module: Receives large unformatted XML documents, parse it, convert it ...

45. JAXB - generating XML schema problem    coderanch.com

Hello all I have some java code (and interface, it's impl class and another POJO or two) and I use it to create an XML schema. Everything is ok until I have a Class containing a List. for some reason, the schema created does not recognize the List and instead creates a schema containg the object of the list (as if ...

46. javax.xml.bind .UnmarshalException in JAXB    coderanch.com

Hi I working in a project which receives xml from external source (on which I have not control) ... then using my own defined schema convert it to java objects. It was working fine... but then they changed the xml and I update my schema. I am getting this error while unmarshalling. javax.xml.bind.UnmarshalException - with linked exception: [org.xml.sax .SAXParseException: unexpected root ...

47. Jaxb creates duplicated namespace declaration from output xml    coderanch.com

Hi, I have this problem when I use jaxb to create output xml. My output xml looks like this: 1 7783 SOUTH 73 RD STREET 2 There are duplicate namespace declaration on the output. ...

49. XML JAXB Serializable    coderanch.com

I use JAXB to marshall/unmarshall XML-Documents and have a few questions: - Do I need the Serializable-Interface in all classes which JAXB uses?: @XmlRootElement @XmlAccessorType(XmlAccessType.NONE) @XmlType(name = &quot;Node&quot;) public class Node implements Serializable{ private static final long serialVersionUID = 12105787978166974402L; @XmlRootElement @XmlAccessorType(XmlAccessType.NONE) @XmlType(name = &quot;User&quot;) private Set&amp;lt;User&amp;gt; subjects = new HashSet&amp;lt;User&amp;gt;(); // inner class: Serializable, too ?? @XmlRootElement @XmlAccessorType(XmlAccessType.NONE) @XmlType(name = ...

50. Jaxb, WASD and getting to the XML    coderanch.com

I am working in WSAD which limits us to the 1.4 JVM and use of JAXB 1.0. We interact with a service through the classes generated in WebSphere and are successfully getting back a response from the service. I have been asked if there is a way that we can capture part of the actual XML message and put it into ...

51. JAXB 1.0 External Binding Customization: Binding Duplicate Elements in XML Schema    coderanch.com

I have following xsd: Schema3.xsd 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. **I CANNOT CHANGE THE XSD. THIS IS A VALID XSD, although not a good design ** What mapping can ...

52. when using jaxb,how to pass xml message as string    coderanch.com

I used jaxb earlier but there whatever input message I pass is an object which is same as my wsdl's input xsd so I don't have any problem but now I had a web service which is expecting String as input message for a particular operation but that input String is of nested xml elements,Considering the fact it's a huge set ...

53. Is there a way to construct empty xml elements while marshalling a jaxb object    coderanch.com

Hi Nevin, As we know Java assigns default values to instance variables, I'm surprised why the default integer value 0 not being picked up by JAXB(I presume you use this for data binding and for that matter that doesn't really matter) and accordingly create xml message. Why don't you use minOccurs=1 in your schema before generating binding objects?

55. XML to Java object using JAXB    coderanch.com

hello all, in my assignment...my tl gave me a xsd and xml file and told me to parse it using SAX parser after that i have to use JAXB to validate and to Get object of XML file into list. can any one tell me how it should be done thanks i am using jdk 1.5 with Oracle Jdeveloper

57. how to validate xml with xsd using JAXB 2.0    coderanch.com

setSchema void setSchema(Schema schema)Specify the JAXP 1.3 Schema object that should be used to validate subsequent unmarshal operations against. Passing null into this method will disable validation. This method replaces the deprecated setValidating(boolean) API. Initially this property is set to null. Parameters: schema - Schema object to validate unmarshal operations against or null to disable validation Throws: UnsupportedOperationException - could be ...

58. Difference between (Java to XML) binding and serialization, JAXB and XStream    coderanch.com

Hi Guys.. In our work we are using XStream to marshal/unmarshall for RESTful resources.Here XStream exactly behaves like JAXB except different annotatons. They say XStream is aserialization frame and should not be confused with JAXB which is binding frame work. Does anyone clarify the differnece between these two please.. Thank you, Ganesh Kandisa ------------------ OCPJP 6(93%),OCPWCD 5(92%)

59. JAXB Saving and loading a generic List of type T to/from XML    coderanch.com

I have been trying to do this for 2 days now and I am about to pull my hair out. I want to make a class that can serialize/deserialize a list of objects of type T into XML using JDK7 and JAXB. I made a class that contains 2 methods to do this: public void saveToFile(final List list, final String fileName) ...

60. JAXB Marshalling to XML loses xmlns from 3rd party xsd    coderanch.com

Hello I am using NetBeans 7.0.1 with JDK 6.0.27. I have created a JAXB Binding. The XSD document is supplied by a vendor. When I create an XML document using JAXB the marshalled output is missing some of the xmlns tags specified in the venodrs XSD document. Vendors XSD Doc... JAXB ...