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

  • Home
  • SEARCH
  • 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 961043
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T01:16:39+00:00 2026-05-16T01:16:39+00:00

I have this class defintion: @XmlRootElement public class RssRoot { private String _version; private

  • 0

I have this class defintion:

@XmlRootElement
public class RssRoot {

private String _version;

private String _xmlns_content;

@XmlAttribute()
public String get_version() {
    return _version;
}

@XmlAttribute()
public String get_xmlns_content() {
    return _xmlns_content;
}

public void set_version(String version) {
  _version = version;
 }

 public void set_xmlns_content(String xmlnsContent) {
  _xmlns_content = xmlnsContent;
 }

 public RssRoot() {
  super();

  this._version = "2.0";
  this._xmlns_content = "http://purl.org/rss/1.0/modules/content/";
 }

}

And it generates this xml:

<rssRoot xmlnsContent="http://purl.org/rss/1.0/modules/content/" version="2.0"/>

However, I need to rename xmlnsContent to xmlns:content, and rssRoot, to rss. How can I do this?

I tried with @XmlAttribute(name = "xmlns:content") above the getter and near to the property declaration, but no luck. The thing fails with this message:

Root Exception stack trace:
com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 1 counts of IllegalAnno
tationExceptions
Class has two properties of the same name “_xmlns_content”
this problem is related to the following location: RssRoot

What else can I do?

  • 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-05-16T01:16:39+00:00Added an answer on May 16, 2026 at 1:16 am

    It may be better to use existing libraries for RSS support (such as ROME) instead of creating your own.

    But if you actually want:

    • xmlns:content is not an attribute, it’s a namespace declaration. JAXB adds it to the resulting XML automatically when resulting XML contains elements in that namespace (namespace of elements can be specified using namespace attribute in @XmlElement, @XmlRootElement, etc).

    • To rename rssRoot to rss, write @XmlRootElement(name = "rss").

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this class: Class B { private String D; private String E; }
i have this class public class Image { public string url { get; set;
I have this class: public static class CsvWriter { private static StreamWriter _writer =
I have a class like this public class Definition { public virtual string Name
I have this class which i would like to map: public class Contract {
I have this class: class OriginalClass { string FirstItem; List<string> ListOfSecondItems; } I want
I have this class called SiteAsyncDownload.cs Here's the code: public class SiteAsyncDownloader { WebClient
I have a class set up like this: class Foo { Foo(); private: Bar
Imagine I have this class namespace CommonLibrary { public class Report() { public DateTime
I have a class definition that looks like this: public class SolrObj { [SolrUniqueKey(id)]

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.