473,439 Members | 1,729 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,439 software developers and data experts.

How to add xml schema attributes into the java object using JAXB?

Hi,

I have to add xml schema attributes into the java object.
Such as, my java object is User. This User object will be
represented as XML using JAXB. I generated XML
from User object successfully using JAXB. But I want to add xml schema attributes such as
Expand|Select|Wrap|Line Numbers
  1. <User 
  2.     xmlns="http://testws/rest/schema"        
  3.     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
  4.     xsi:schemaLocation="http://testws/rest/user UserSchema.xsd">
  5.  
  6. </User>
How do I add xmlns, xmlns:xsi, xsi:schemaLocation attributes in the User (root) element, using JAXB?
I tried with @xmlSchema annotation but it threw the following error:
Package annotations must be in file package-info.java

I would be grateful, if someone help me to solve this issue.
Jul 20 '10 #1
0 1756

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: sarith sutha | last post by:
Hi Need a help on the above topic, how to pass a java object as parameter to the java stored procedure .Code snippets will be greatly appreciated , i came across udf/udts etc but still not able...
2
by: timothy ma and constance lee | last post by:
Do anyone know how to popluate xml file to a java object?
2
by: Eshrath | last post by:
Hi, What I am trying to do: ======================= I need to form a table in html using the xsl but the table that is formed is quite long and cannot be viewed in our application. So we are...
2
by: Eyal | last post by:
Hey, I would appriciate if anyone can help on this one: I have a java object/inteface having a method with a boolean parameter. As I'm trying to call this method from a javascript it fails on...
0
by: aruna.hcu | last post by:
using jaxb i need to parse an xml file by DOM and get values into a java bean
1
by: incunix | last post by:
Trying to run a standalone program I downloaded and know works (I have spoken to the developer on the team etc...). The url where to find it is http://pyxida.sourceforge.net/ I initially...
2
by: mostafijur | last post by:
Hello I need to convert database attributes into Records using PHP. For example My database attributes are like : C like structure: struct Info {
3
by: Marc Hebert | last post by:
I'm trying to figure out if something is possible to specify and constrain using a schema. I'll explain using an example. sample xml: <person name="John" age="32"/> <person name="Julie"...
6
by: gjain12 | last post by:
Hi all, I have created a java object that contains some xml tags. When I print it using obj.toString(), it displays some hashed value something like objecttype@12345. But I want to display the...
4
by: javatoil260309 | last post by:
Hi all, I have using JAXB to generate XML from a XSD file. So far so good. But i noticed that all the URL's (namespaces in the xsd) are not present in the generated xml. TO be precise my XSD file...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.