473,753 Members | 6,868 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

39 New Member
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:schemaLocat ion 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 1817

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

Similar topics

0
6437
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 to achieve the result. Thankx in advance.
2
3680
by: timothy ma and constance lee | last post by:
Do anyone know how to popluate xml file to a java object?
2
3231
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 writing one object in C# which will take the entire table tag contents and renders. Ie., we need to pass "<table>………… <thead>……</thead>. <tr>.<td> <td>..<tr>.<td> <td> </table>" content to
2
6928
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 a type mismatch. It is positively because of the boolean(java primitive)parameter. It goes fine if I change this parameter to int or String. This inteface has a lot more methods which works fine, it is just the
0
1558
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
7325
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 downloaded the standalone version and tried to get it working on two nodes after altering the config file but I keep getting the error: "Could not deserialize java object: java.io.StreamCorruptedException: invalid type code: 92" I then decided to...
2
1575
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
1675
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" age="25"/> In my schema, I'd love to be able to place different restrictions on the attribute 'age' based on the value of 'name'... so in this example, I might want to enforce that any entry where name="John"
6
4368
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 exact value that it contains. Does anybody know how to do this? Thanks
4
3377
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 contains 4 namespaces ( which includes "http://www.w3.org/2001/XMLSchema" and 3 others), but my generated xml shows only 1 namespace. How do i resolve this issue?. Any help will be appreciated. Thanks in advance.
0
9072
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9653
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9451
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9421
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8328
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6869
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4942
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2872
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2284
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.