Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8237895
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T19:37:26+00:00 2026-06-07T19:37:26+00:00

I’m a total newbie with XML. I’m doing a Java EE project REST implementation

  • 0

I’m a total newbie with XML. I’m doing a Java EE project REST implementation and we return a lot of XML. With this we decided to use JAXB. So far, we manually coded the Models for the XML.

But there are already these complex structures we don’t know how to code. We’ve read about generating classes from XSD. We do have an XSD.

My questions:

1.) I’ve read about XJC, where can I find it?

2.) Do we have to install the whole JAXB? (so what we used so far? isn’t this JAXB?)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T19:37:28+00:00Added an answer on June 7, 2026 at 7:37 pm

    XJC is included in the bin directory in the JDK starting with Java SE 6. For an example see:

    • http://blog.bdoughan.com/2010/09/processing-atom-feeds-with-jaxb.html

    The contents of the blog are the following:

    Processing Atom Feeds with JAXB
    Atom is an XML format for representing web feeds. A standard format allows reader applications to display feeds from different sources. In this example we will process the Atom feed for this blog.

    Demo

    In this example we will use JAXB to convert the Atom XML feed corresponding to this blog to objects and then back to XML.

    import java.io.InputStream;
    import java.net.URL;
    import javax.xml.bind.*;
    import javax.xml.transform.stream.StreamSource;
    import org.w3._2005.atom.FeedType;
    
    public class Demo {
    
        public static void main(String[] args) throws Exception {
            JAXBContext jc = JAXBContext.newInstance("org.w3._2005.atom");
    
            Unmarshaller unmarshaller = jc.createUnmarshaller();
            URL url = new URL("http://bdoughan.blogspot.com/atom.xml");
            InputStream xml = url.openStream();
            JAXBElement<feedtype> feed = unmarshaller.unmarshal(new StreamSource(xml), FeedType.class);
            xml.close();
    
            Marshaller marshaller = jc.createMarshaller();
            marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
            marshaller.marshal(feed, System.out);
        }
    
    }
    

    JAXB Model

    The following model was generated by the schema to Java compiler (XJC). I have omitted the get/set methods and comments to save space.

    xjc -d generated http://www.kbcafe.com/rss/atom.xsd.xml
    

    package-info

    @XmlSchema(
            namespace = "http://www.w3.org/2005/Atom",
            elementFormDefault = XmlNsForm.QUALIFIED)
    @XmlAccessorType(XmlAccessType.FIELD)
    package org.w3._2005.atom;
    
    import javax.xml.bind.annotation.*;
    

    CategoryType

    package org.w3._2005.atom;
    
    import java.util.*;
    import javax.xml.bind.annotation.*;
    import javax.xml.bind.annotation.adapters.*;
    import javax.xml.namespace.QName;
    
    @XmlType(name = "categoryType")
    public class CategoryType {
        @XmlAttribute(required = true)
        protected String term;
    
        @XmlAttribute
        @XmlSchemaType(name = "anyURI")
        protected String scheme;
    
        @XmlAttribute
        protected String label;
    
        @XmlAttribute(namespace = "http://www.w3.org/XML/1998/namespace")
        @XmlSchemaType(name = "anyURI")
        protected String base;
    
        @XmlAttribute(namespace = "http://www.w3.org/XML/1998/namespace")
        @XmlJavaTypeAdapter(CollapsedStringAdapter.class)
        @XmlSchemaType(name = "language")
        protected String lang;
    
        @XmlAnyAttribute
        private Map<QName, String> otherAttributes = new HashMap<QName, String>();
    }
    

    Content Type

    package org.w3._2005.atom;
    
    import java.util.*;
    import javax.xml.bind.annotation.*;
    import javax.xml.bind.annotation.adapters.*;
    import javax.xml.namespace.QName;
    
    @XmlType(name = "contentType", propOrder = {"content"})
    public class ContentType {
        @XmlMixed
        @XmlAnyElement(lax = true)
        protected List<Object> content;
    
        @XmlAttribute
        protected String type;
    
        @XmlAttribute
        @XmlSchemaType(name = "anyURI")
        protected String src;
    
        @XmlAttribute(namespace = "http://www.w3.org/XML/1998/namespace")
        @XmlSchemaType(name = "anyURI")
        protected String base;
    
        @XmlAttribute(namespace = "http://www.w3.org/XML/1998/namespace")
        @XmlJavaTypeAdapter(CollapsedStringAdapter.class)
        @XmlSchemaType(name = "language")
        protected String lang;
    
        @XmlAnyAttribute
        private Map<QName, String> otherAttributes = new HashMap<QName, String>();
    }
    

    DateTimeType

    package org.w3._2005.atom;
    
    import java.util.*;
    import javax.xml.bind.annotation.*;
    import javax.xml.bind.annotation.adapters.*;
    import javax.xml.datatype.XMLGregorianCalendar;
    import javax.xml.namespace.QName;
    
    @XmlType(name = "dateTimeType", propOrder = {"value"})
    public class DateTimeType {
        @XmlValue
        @XmlSchemaType(name = "dateTime")
        protected XMLGregorianCalendar value;
    
        @XmlAttribute(namespace = "http://www.w3.org/XML/1998/namespace")
        @XmlSchemaType(name = "anyURI")
        protected String base;
    
        @XmlAttribute(namespace = "http://www.w3.org/XML/1998/namespace")
        @XmlJavaTypeAdapter(CollapsedStringAdapter.class)
        @XmlSchemaType(name = "language")
        protected String lang;
    
        @XmlAnyAttribute
        private Map<QName, String> otherAttributes = new HashMap<QName, String>();
    }
    

    EntryType

    package org.w3._2005.atom;
    
    import java.util.*;
    import javax.xml.bind.JAXBElement;
    import javax.xml.bind.annotation.*;
    import javax.xml.bind.annotation.adapters.*;
    import javax.xml.namespace.QName;
    
    @XmlType(name = "entryType", propOrder = {"authorOrCategoryOrContent"})
    public class EntryType {
        @XmlElementRefs({
            @XmlElementRef(name = "id", namespace = "http://www.w3.org/2005/Atom", type = JAXBElement.class),
            @XmlElementRef(name = "rights", namespace = "http://www.w3.org/2005/Atom", type = JAXBElement.class),
            @XmlElementRef(name = "summary", namespace = "http://www.w3.org/2005/Atom", type = JAXBElement.class),
            @XmlElementRef(name = "title", namespace = "http://www.w3.org/2005/Atom", type = JAXBElement.class),
            @XmlElementRef(name = "author", namespace = "http://www.w3.org/2005/Atom", type = JAXBElement.class),
            @XmlElementRef(name = "source", namespace = "http://www.w3.org/2005/Atom", type = JAXBElement.class),
            @XmlElementRef(name = "updated", namespace = "http://www.w3.org/2005/Atom", type = JAXBElement.class),
            @XmlElementRef(name = "category", namespace = "http://www.w3.org/2005/Atom", type = JAXBElement.class),
            @XmlElementRef(name = "content", namespace = "http://www.w3.org/2005/Atom", type = JAXBElement.class),
            @XmlElementRef(name = "published", namespace = "http://www.w3.org/2005/Atom", type = JAXBElement.class),
            @XmlElementRef(name = "contributor", namespace = "http://www.w3.org/2005/Atom", type = JAXBElement.class),
            @XmlElementRef(name = "link", namespace = "http://www.w3.org/2005/Atom", type = JAXBElement.class)
        })
        @XmlAnyElement(lax = true)
        protected List<Object> authorOrCategoryOrContent;
    
        @XmlAttribute(namespace = "http://www.w3.org/XML/1998/namespace")
        @XmlSchemaType(name = "anyURI")
        protected String base;
    
        @XmlAttribute(namespace = "http://www.w3.org/XML/1998/namespace")
        @XmlJavaTypeAdapter(CollapsedStringAdapter.class)
        @XmlSchemaType(name = "language")
        protected String lang;
    
        @XmlAnyAttribute
        private Map<QName, String> otherAttributes = new HashMap<QName, String>();
    }
    

    FeedType

    package org.w3._2005.atom;
    
    import java.util.*;
    import javax.xml.bind.JAXBElement;
    import javax.xml.bind.annotation.*;
    import javax.xml.bind.annotation.adapters.*;
    import javax.xml.namespace.QName;
    
    @XmlType(name = "feedType", propOrder = {"authorOrCategoryOrContributor"})
    public class FeedType {
        @XmlElementRefs({
            @XmlElementRef(name = "link", namespace = "http://www.w3.org/2005/Atom", type = JAXBElement.class),
            @XmlElementRef(name = "updated", namespace = "http://www.w3.org/2005/Atom", type = JAXBElement.class),
            @XmlElementRef(name = "category", namespace = "http://www.w3.org/2005/Atom", type = JAXBElement.class),
            @XmlElementRef(name = "rights", namespace = "http://www.w3.org/2005/Atom", type = JAXBElement.class),
            @XmlElementRef(name = "contributor", namespace = "http://www.w3.org/2005/Atom", type = JAXBElement.class),
            @XmlElementRef(name = "title", namespace = "http://www.w3.org/2005/Atom", type = JAXBElement.class),
            @XmlElementRef(name = "id", namespace = "http://www.w3.org/2005/Atom", type = JAXBElement.class),
            @XmlElementRef(name = "generator", namespace = "http://www.w3.org/2005/Atom", type = JAXBElement.class),
            @XmlElementRef(name = "icon", namespace = "http://www.w3.org/2005/Atom", type = JAXBElement.class),
            @XmlElementRef(name = "subtitle", namespace = "http://www.w3.org/2005/Atom", type = JAXBElement.class),
            @XmlElementRef(name = "author", namespace = "http://www.w3.org/2005/Atom", type = JAXBElement.class),
            @XmlElementRef(name = "entry", namespace = "http://www.w3.org/2005/Atom", type = JAXBElement.class),
            @XmlElementRef(name = "logo", namespace = "http://www.w3.org/2005/Atom", type = JAXBElement.class)
        })
        @XmlAnyElement(lax = true)
        protected List<Object> authorOrCategoryOrContributor;
    
        @XmlAttribute(namespace = "http://www.w3.org/XML/1998/namespace")
        @XmlSchemaType(name = "anyURI")
        protected String base;
    
        @XmlAttribute(namespace = "http://www.w3.org/XML/1998/namespace")
        @XmlJavaTypeAdapter(CollapsedStringAdapter.class)
        @XmlSchemaType(name = "language")
        protected String lang;
    
        @XmlAnyAttribute
        private Map<QName, String> otherAttributes = new HashMap<QName, String>();
    }
    

    GeneratorType

    package org.w3._2005.atom;
    
    import java.util.*;
    import javax.xml.bind.annotation.*;
    import javax.xml.bind.annotation.adapters.*;
    import javax.xml.namespace.QName;
    
    @XmlType(name = "generatorType", propOrder = {"value"})
    public class GeneratorType {
        @XmlValue
        protected String value;
    
        @XmlAttribute
        @XmlSchemaType(name = "anyURI")
        protected String uri;
    
        @XmlAttribute
        protected String version;
    
        @XmlAttribute(namespace = "http://www.w3.org/XML/1998/namespace")
        @XmlSchemaType(name = "anyURI")
        protected String base;
    
        @XmlAttribute(namespace = "http://www.w3.org/XML/1998/namespace")
        @XmlJavaTypeAdapter(CollapsedStringAdapter.class)
        @XmlSchemaType(name = "language")
        protected String lang;
    
        @XmlAnyAttribute
        private Map<QName, String> otherAttributes = new HashMap<QName, String>();
    }
    

    IconType

    package org.w3._2005.atom;
    
    import java.util.*;
    import javax.xml.bind.annotation.*;
    import javax.xml.bind.annotation.adapters.*;
    import javax.xml.namespace.QName;
    
    @XmlType(name = "iconType", propOrder = {"value"})
    public class IconType {
        @XmlValue
        @XmlSchemaType(name = "anyURI")
        protected String value;
    
        @XmlAttribute(namespace = "http://www.w3.org/XML/1998/namespace")
        @XmlSchemaType(name = "anyURI")
        protected String base;
    
        @XmlAttribute(namespace = "http://www.w3.org/XML/1998/namespace")
        @XmlJavaTypeAdapter(CollapsedStringAdapter.class)
        @XmlSchemaType(name = "language")
        protected String lang;
    
        @XmlAnyAttribute
        private Map<QName, String> otherAttributes = new HashMap<QName, String>();
    }
    

    IdType

    package org.w3._2005.atom;
    
    import java.util.*;
    import javax.xml.bind.annotation.*;
    import javax.xml.bind.annotation.adapters.*;
    import javax.xml.namespace.QName;
    
    @XmlType(name = "idType", propOrder = {"value"})
    public class IdType {
        @XmlValue
        @XmlSchemaType(name = "anyURI")
        protected String value;
    
        @XmlAttribute(namespace = "http://www.w3.org/XML/1998/namespace")
        @XmlSchemaType(name = "anyURI")
        protected String base;
    
        @XmlAttribute(namespace = "http://www.w3.org/XML/1998/namespace")
        @XmlJavaTypeAdapter(CollapsedStringAdapter.class)
        @XmlSchemaType(name = "language")
        protected String lang;
    
        @XmlAnyAttribute
        private Map<QName, String> otherAttributes = new HashMap<QName, String>();
    }
    

    LinkType

    package org.w3._2005.atom;
    
    import java.math.BigInteger;
    import java.util.*;
    import javax.xml.bind.annotation.*;
    import javax.xml.bind.annotation.adapters.*;
    import javax.xml.namespace.QName;
    
    @XmlType(name = "linkType", propOrder = {"content"})
    public class LinkType {
        @XmlValue
        protected String content;
    
        @XmlAttribute(required = true)
        @XmlSchemaType(name = "anyURI")
        protected String href;
    
        @XmlAttribute
        protected String rel;
    
        @XmlAttribute
        protected String type;
    
        @XmlAttribute
        @XmlJavaTypeAdapter(CollapsedStringAdapter.class)
        @XmlSchemaType(name = "NMTOKEN")
        protected String hreflang;
    
        @XmlAttribute
        protected String title;
    
        @XmlAttribute
        @XmlSchemaType(name = "positiveInteger")
        protected BigInteger length;
    
        @XmlAttribute(namespace = "http://www.w3.org/XML/1998/namespace")
        @XmlSchemaType(name = "anyURI")
        protected String base;
    
        @XmlAttribute(namespace = "http://www.w3.org/XML/1998/namespace")
        @XmlJavaTypeAdapter(CollapsedStringAdapter.class)
        @XmlSchemaType(name = "language")
        protected String lang;
    
        @XmlAnyAttribute
        private Map<QName, String> otherAttributes = new HashMap<QName, String>();
    }
    

    LogoType

    package org.w3._2005.atom;
    
    import java.util.*;
    import javax.xml.bind.annotation.*;
    import javax.xml.bind.annotation.adapters.*;
    import javax.xml.namespace.QName;
    
    @XmlType(name = "logoType", propOrder = {"value"})
    public class LogoType {
        @XmlValue
        @XmlSchemaType(name = "anyURI")
        protected String value;
    
        @XmlAttribute(namespace = "http://www.w3.org/XML/1998/namespace")
        @XmlSchemaType(name = "anyURI")
        protected String base;
    
        @XmlAttribute(namespace = "http://www.w3.org/XML/1998/namespace")
        @XmlJavaTypeAdapter(CollapsedStringAdapter.class)
        @XmlSchemaType(name = "language")
        protected String lang;
    
        @XmlAnyAttribute
        private Map<QName, String> otherAttributes = new HashMap<QName, String>();
    }
    

    PersonType

    package org.w3._2005.atom;
    
    import java.util.*;
    import javax.xml.bind.JAXBElement;
    import javax.xml.bind.annotation.*;
    import javax.xml.bind.annotation.adapters.*;
    import javax.xml.namespace.QName;
    
    @XmlType(name = "personType", propOrder = {"nameOrUriOrEmail"})
    public class PersonType {
        @XmlElementRefs({
            @XmlElementRef(name = "email", namespace = "http://www.w3.org/2005/Atom", type = JAXBElement.class),
            @XmlElementRef(name = "name", namespace = "http://www.w3.org/2005/Atom", type = JAXBElement.class),
            @XmlElementRef(name = "uri", namespace = "http://www.w3.org/2005/Atom", type = JAXBElement.class)
        })
        @XmlAnyElement(lax = true)
        protected List<Object> nameOrUriOrEmail;
    
        @XmlAttribute(namespace = "http://www.w3.org/XML/1998/namespace")
        @XmlSchemaType(name = "anyURI")
        protected String base;
    
        @XmlAttribute(namespace = "http://www.w3.org/XML/1998/namespace")
        @XmlJavaTypeAdapter(CollapsedStringAdapter.class)
        @XmlSchemaType(name = "language")
        protected String lang;
    
        @XmlAnyAttribute
        private Map<QName, String> otherAttributes = new HashMap<QName, String>();
    }
    

    SourceType

    package org.w3._2005.atom;
    
    import java.util.*;
    import javax.xml.bind.JAXBElement;
    import javax.xml.bind.annotation.*;
    import javax.xml.bind.annotation.adapters.*;
    import javax.xml.namespace.QName;
    
    @XmlType(name = "sourceType", propOrder = {"authorOrCategoryOrContributor"})
    public class SourceType {
        @XmlElementRefs({
            @XmlElementRef(name = "updated", namespace = "http://www.w3.org/2005/Atom", type = JAXBElement.class),
            @XmlElementRef(name = "category", namespace = "http://www.w3.org/2005/Atom", type = JAXBElement.class),
            @XmlElementRef(name = "subtitle", namespace = "http://www.w3.org/2005/Atom", type = JAXBElement.class),
            @XmlElementRef(name = "logo", namespace = "http://www.w3.org/2005/Atom", type = JAXBElement.class),
            @XmlElementRef(name = "generator", namespace = "http://www.w3.org/2005/Atom", type = JAXBElement.class),
            @XmlElementRef(name = "icon", namespace = "http://www.w3.org/2005/Atom", type = JAXBElement.class),
            @XmlElementRef(name = "title", namespace = "http://www.w3.org/2005/Atom", type = JAXBElement.class),
            @XmlElementRef(name = "id", namespace = "http://www.w3.org/2005/Atom", type = JAXBElement.class),
            @XmlElementRef(name = "author", namespace = "http://www.w3.org/2005/Atom", type = JAXBElement.class),
            @XmlElementRef(name = "contributor", namespace = "http://www.w3.org/2005/Atom", type = JAXBElement.class),
            @XmlElementRef(name = "link", namespace = "http://www.w3.org/2005/Atom", type = JAXBElement.class),
            @XmlElementRef(name = "rights", namespace = "http://www.w3.org/2005/Atom", type = JAXBElement.class)
        })
        @XmlAnyElement(lax = true)
        protected List<Object> authorOrCategoryOrContributor;
    
        @XmlAttribute(namespace = "http://www.w3.org/XML/1998/namespace")
        @XmlSchemaType(name = "anyURI")
        protected String base;
    
        @XmlAttribute(namespace = "http://www.w3.org/XML/1998/namespace")
        @XmlJavaTypeAdapter(CollapsedStringAdapter.class)
        @XmlSchemaType(name = "language")
        protected String lang;
    
        @XmlAnyAttribute
        private Map<QName, String> otherAttributes = new HashMap<QName, String>();
    }
    

    TextType

    package org.w3._2005.atom;
    
    import java.util.*;
    import javax.xml.bind.annotation.*;
    import javax.xml.bind.annotation.adapters.*;
    import javax.xml.namespace.QName;
    
    @XmlType(name = "textType", propOrder = {"content"})
    public class TextType {
        @XmlMixed
        @XmlAnyElement(lax = true)
        protected List<Object> content;
    
        @XmlAttribute
        @XmlJavaTypeAdapter(CollapsedStringAdapter.class)
        protected String type;
    
        @XmlAttribute(namespace = "http://www.w3.org/XML/1998/namespace")
        @XmlSchemaType(name = "anyURI")
        protected String base;
    
        @XmlAttribute(namespace = "http://www.w3.org/XML/1998/namespace")
        @XmlJavaTypeAdapter(CollapsedStringAdapter.class)
        @XmlSchemaType(name = "language")
        protected String lang;
    
        @XmlAnyAttribute
        private Map<QName, String> otherAttributes = new HashMap<QName, String>();
    }
    

    UriType

    package org.w3._2005.atom;
    
    import java.util.*;
    import javax.xml.bind.annotation.*;
    import javax.xml.bind.annotation.adapters.*;
    import javax.xml.namespace.QName;
    
    @XmlType(name = "uriType", propOrder = {"value"})
    public class UriType {
        @XmlValue
        @XmlSchemaType(name = "anyURI")
        protected String value;
    
        @XmlAttribute(namespace = "http://www.w3.org/XML/1998/namespace")
        @XmlSchemaType(name = "anyURI")
        protected String base;
    
        @XmlAttribute(namespace = "http://www.w3.org/XML/1998/namespace")
        @XmlJavaTypeAdapter(CollapsedStringAdapter.class)
        @XmlSchemaType(name = "language")
        protected String lang;
    
        @XmlAnyAttribute
        private Map<QName, String> otherAttributes = new HashMap<QName, String>();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
I am trying to understand how to use SyndicationItem to display feed which is
this is what i have right now Drawing an RSS feed into the php,
I have this code to decode numeric html entities to the UTF8 equivalent character.
I want use html5's new tag to play a wav file (currently only supported
In my XML file chapters tag has more chapter tag.i need to display chapters
I am doing a simple coin flipping experiment for class that involves flipping a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.