Converting EJB Object into XML
All:
Suppose I have an EJB that is named MyDog, it has attributes as follows:
name
breed
weight
age
Is there a way to convert this Object into an XML document? Something like:
<?xml version=\"1.0\" ?>
<MyDog>
<name>Bubba</name>
<breed>Australian Shepherd</breed>
<weight>65 lbs</weight>
<age>6 years old</age>
</MyDog>
I can't find any information on doing this - any ideas, links, etc? There has to be a way to do this, but I can't find it. I'm welcome to any ideas out there!
check JAXB - might be usefull for you: http://java.sun.com/xml/jaxb/index.html
Similar Messages
-
How to convert Java Objects into xml?
Hello Java Gurus
how to convert Java Objects into xml? i heard xstream can be use for that but i am looking something which is good in performance.
really need your help guys.
thanks in advance.There are apparently a variety of Java/XML bindings. Try Google.
And don't be so demanding. -
Converting Document object into XML file
I was wondering how to convert a document object to XML file? I have read the documentation about document and Node but nothing explains the procedure of the conversion. Ive been told that it can be done, but not sure how. I have converted an XML file into Document by parsing DocumentBuilder. Just not sure how to do the reverse. Any help appreciated.
TransformerFactory tf = TransformerFactory.newInstance();
Transformer trans = tf.newTransformer();
trans.transform(new DOMSource(yourDOMsRootNode), new StreamResult(new FileOutputStream(yourFileName)));or something a lot like that. -
How can I convert table object into table record format?
I need to write a store procedure to convert table object into table record. The stored procedure will have a table object IN and then pass the data into another stored procedure with a table record IN. Data passed in may contain more than one record in the table object. Is there any example I can take a look? Thanks.
I'm afraid it's a bit labourious but here's an example.
I think it's a good idea to work with SQL objects rather than PL/SQL nested tables.
SQL> CREATE OR REPLACE TYPE emp_t AS OBJECT
2 (eno NUMBER(4)
3 , ename VARCHAR2(10)
4 , job VARCHAR2(9)
5 , mgr NUMBER(4)
6 , hiredate DATE
7 , sal NUMBER(7,2)
8 , comm NUMBER(7,2)
9 , deptno NUMBER(2));
10 /
Type created.
SQL> CREATE OR REPLACE TYPE staff_nt AS TABLE OF emp_t
2 /
Type created.
SQL> Now we've got some Types let's use them. I've only implemented this as one public procedure but you can see the principles in action.
SQL> CREATE OR REPLACE PACKAGE emp_utils AS
2 TYPE EmpCurTyp IS REF CURSOR RETURN emp%ROWTYPE;
3 PROCEDURE pop_emp (p_emps in staff_nt);
4 END emp_utils;
5 /
Package created.
SQL> CREATE OR REPLACE PACKAGE BODY emp_utils AS
2 FUNCTION emp_obj_to_rows (p_emps IN staff_nt) RETURN EmpCurTyp IS
3 rc EmpCurTyp;
4 BEGIN
5 OPEN rc FOR SELECT * FROM TABLE( CAST ( p_emps AS staff_nt ));
6 RETURN rc;
7 END emp_obj_to_rows;
8 PROCEDURE pop_emp (p_emps in staff_nt) is
9 e_rec emp%ROWTYPE;
10 l_emps EmpCurTyp;
11 BEGIN
12 l_emps := emp_obj_to_rows(p_emps);
13 FETCH l_emps INTO e_rec;
14 LOOP
15 EXIT WHEN l_emps%NOTFOUND;
16 INSERT INTO emp VALUES e_rec;
17 FETCH l_emps INTO e_rec;
18 END LOOP;
19 CLOSE l_emps;
20 END pop_emp;
21 END;
22 /
Package body created.
SQL>Looks good. Let's see it in action...
SQL> DECLARE
2 newbies staff_nt := staff_nt();
3 BEGIN
4 newbies.extend(2);
5 newbies(1) := emp_t(7777, 'APC', 'CODER', 7902, sysdate, 1700, null, 40);
6 newbies(2) := emp_t(7778, 'J RANDOM', 'HACKER', 7902, sysdate, 1800, null, 40);
7 emp_utils.pop_emp(newbies);
8 END;
9 /
PL/SQL procedure successfully completed.
SQL> SELECT * FROM emp WHERE deptno = 40
2 /
EMPNO ENAME JOB MGR HIREDATE SAL COMM
DEPTNO
7777 APC CODER 7902 17-NOV-05 1700
40
7778 J RANDOM HACKER 7902 17-NOV-05 1800
40
SQL> Cheers, APC -
Converting Array Objects into ArrayCollections
Hi,
I am facing problem with converting Array Objects into ArrayCollections. How can i convert Array Objects into ArrayCollections. If any one knows how can we do that Pl reply.
Thanks in advance to all
Regards
subbareddy.pHi Bhasker,
thanks for u r reply. Here i attached screen shot of my server "data.result".
My proxy varaible contains
My object varaible "obj" contains
After parsing the result my arraycollection contains, (i mean after converting Object to Array to ArrayCollection) the below information. For information Pl find the attached arraycollection.png image. In the attached image my arraycollection name is "users".
Here i pasted the code that i used to convert "ObjectProxy" to "ArrayCollection"
var proxy:ObjectProxy = ObjectProxy(data.result);
var obj:Object = proxy.object_proxy::object;
var arrycoll:Array = ArrayUtil.toArray(obj);
model.users = new ArrayCollection(arrycoll);
Regards
sss -
WD(ABAP) - How to convert PDF object to XML
I know there is a way available to converting PDF object to XML in JAVA. However how to achieve this goal in ABAP?
In Web Dynpro ABAP, I can bind a context attribute to the pdfSource property of interactive form element. There also should be method to able to convert the binary content of this attribute to XML format, right? Does anyone know it?
Your help would be greatly appreciated.Hi all,
As an extension to Fred's question, is it possible to later use the generated XML data and present it in a PDF template? It used to be possible using the FDF format, but Adobe seem to have discontinued that.
My basic requirement is to send the form data to a third party in XML format and for them to be able to view it in human-readable format, preferably using a PDF as a template.
Is this possible?
Thanks,
Jonathan -
Converting webi reports into Xml
Hi all ,
Can we convert the BO Edge 3.1 Webi reports into XML Format?
Pls suggest me a solution and if we can convert, pls describe the procedure to be followed inorder to convert the reports into xml files?
Thanks in advance,
Thanks & regards,
Amrita.BHello,
While this is not possible (directly) for the entire report, you could do one of the following:
1. If you're on SP2 (or higher), you could publish Webi Report Content as a web service. There is more information in the pdf at http://help.sap.com/businessobject/product_guides/boexir31SP2/en/xi31_sp2_webi_rich_en.pdf (pg 304) .
2. Use QAAWS to publish queries used in the report as web services.
Best,
Srinivas -
Convert gzip files into XML format
We have a requirement where we receive gzip files. These files are zipped file containing base64 binary format csv files. We would have to convert these files into XML format. Please let me know any of the following.
1. Is there any Xpath query or XSL function (somthing similar like doTranslateFromNative() ) to convert from gzip files to XML format.
2. If we need to unzip the zipfile outside fusion, then java code piece to unzip the gzip file. I guess after that we can use the usual doTranslateFromNative() function to translate to XML format, since after unzipping the gzip file, they are base64 binary formats.
Thanks in advance,
TomsThere is an option to do pre-processing and post processing of Files when using File adapter. You need to create a valve which will first do pre processing and send the output to FileAdapter.
You can get more information here:
http://docs.oracle.com/cd/E23943_01/integration.1111/e10231/adptr_file.htm#CACDHGGG
under section: 4.2.14 Pre-Processing and Post-Processing of Files
Essentially you will use Java to unzip the file first and then the unzipped content will be passed to the adapter. -
How to convert .stl file into .xml file. Subtitles to IMPORT INTO FCPro
I have a subtitles file which was created in dvd studio pro. I exported that file and made a .stl file (which can be opened with TextEdit).
I need to import that file into FCP to then make a quicktime file w/subs to be exported.
I'm trying to use TitleExchange which tells you you CAN convert .stl files into .xml (FCPro type of file) but when I try to import the .stl subtitle file into TitleExchange to be converted to .xml I get the following error:
Can't make "" into type boolean. (-1700)
Can someone help?
Thanks!!!
PaulaCan anyone help me?
I absolutely need to import the subtitles into Final Cut and re-writing all of them manually would take forever.
Please let me know if there is any program I need to use.
Thanks for all tips
Paula -
How to convert Xls file into Xml file
Hi,
I am trying to convert Xls file into Xml but there is no any direct procedure for it
Pls help me out to convert Xls file into Xml file
Thanks
Anushreeyou will require to write a module in your file adapter for the same.
ref: /people/sap.user72/blog/2005/07/04/read-excel-instead-of-xml-through-fileadapter as mentioned in the earlier post.
Else you can also use Conversion Agent to read the same.
Ref: http://help.sap.com/saphelp_nw04/helpdata/en/43/4c38c4cf105f85e10000000a1553f6/content.htm -
How to convert database table into xml file
Hi.
How to convert database table into XML file in Oracle HTML DB.
Please let me know.
Thanks.This not really a specific APEX question... but I search the database forum and found this thread which I think will help
Exporting Oracle table to XML
If it does not I suggest looking at the database forum or have a look at this document on using the XML toolkit
http://download-east.oracle.com/docs/html/B12146_01/c_xml.htm
Hope this helps
Chris -
API for converting a Java object into XML?
Do you know of any Java API that I could use to convert a Java
object into its equivalent XML representation?
For example if I have a class called "Foo" with variables va, vb
and I have an instance of Foo with va having the value 1 and vb
having the value 2, I would like be able to generate the
following XML fragment:
<Foo>
<va>1</va>
<vb>2</vb>
</Foo>
Thanks,
-- Rob
nullRob Tan (guest) wrote:
: Do you know of any Java API that I could use to convert a Java
: object into its equivalent XML representation?
: For example if I have a class called "Foo" with variables va,
vb
: and I have an instance of Foo with va having the value 1 and
vb
: having the value 2, I would like be able to generate the
: following XML fragment:
: <Foo>
: <va>1</va>
: <vb>2</vb>
: </Foo>
: Thanks,
: -- Rob
There is none that I know of.
Oracle XML Team
http://technet.oracle.com
Oracle Technology Network
null -
Convert jsp page into xml or dom for search
Hello everyone,
I have to build an application that searches for message beans in all jsp page. I did it the traditional way, using scanner and string methods. Its working but its not perfect. So i want to convert all my jsp page into xml format and then process them. My jsp pages are quite complicated. I used some jars that convert them into jspx . But its not working. Please help
Thanks in advanceWell its like this.I need to develop a program that reads all the message bean keys.. We have lots of struts webapps. All messages in the jsp pages have been externalised and internationalised. Now i have to build a program that given a webapp path prints out all the message bean keys used in the webapp. I have developed the program using the Plexus Directory scanner to filter all the jsp pages and java util Scanner to read line by line and used String functions to search for keys.
Now thats not the best soultion. The best way, imo, is to cinvert the jsp into xml pages and then we can parse the xml pages easily. The' problem is to find a way to convert the jsp pages(jstl +javascript) into xml.
Can you help me out?
Thanks -
Convert an Object into a String
Good day to everyone. I am trying to do a little coding in which a user will input his desired username. I want to check the database if the desired username of the current user is existing, so there'll be no duplication. I'm using JPA for the model and JSF for the controller and view.
Here's my Model.
@Entity
public class WebUser implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
private String lastName;
private String firstName;
private String middleName;
private String username;
private String password;
public Long getId() {
return id;
public void setId(Long id) {
this.id = id;
@Override
public int hashCode() {
int hash = 0;
hash += (id != null ? id.hashCode() : 0);
return hash;
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof WebUser)) {
return false;
WebUser other = (WebUser) object;
if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
return false;
return true;
@Override
public String toString() {
return "web.model.WebUser[id=" + id + "]";
public String getLastName() {
return lastName;
public void setLastName(String lastName) {
this.lastName = lastName;
public String getFirstName() {
return firstName;
public void setFirstName(String firstName) {
this.firstName = firstName;
public String getMiddleName() {
return middleName;
public void setMiddleName(String middleName) {
this.middleName = middleName;
public String getUsername() {
return username;
public void setUsername(String username) {
this.username = username;
public String getPassword() {
return password;
public void setPassword(String password) {
this.password = password;
}The controller and jsp are auto-generated from Netbeans. My question is, how will I convert the 'WebUser' object into a String so I can compare the value from input text to the value in the database?
Here is my validation method inside WebUserController.java
public void validateUsername(FacesContext facesContext, UIComponent component, Object value) throws ValidatorException {
String newUsername = (String) value;
System.out.println("new user name: " +newUsername);
System.out.println("component: " +component);
int webUserSize;
StringBuffer sb = new StringBuffer();
//webUsers.toString();
if ((webUsers == null) || (webUsers != null)) {
System.out.println("web users null");
List<WebUser> allWebUsers = getWebUsers();
webUserSize = allWebUsers.size();
System.out.println("all web users: " +allWebUsers);
System.out.println("size " +webUserSize);
for(int i=1; i<=webUserSize; ++i) {
sb.append(allWebUsers);
System.out.println("username: " +sb.append(allWebUsers));
}Honestly I'm new to java and having a hard time with this one. Hope someone can help me. Thanks a lot.
I know my code is a mess. :(Thanks for the help guys! I used the "unique constraint" annotation of JPA and my problem is solved.
Here's the code:
@Entity
@Table(
name="WebUser",
uniqueConstraints={@UniqueConstraint(columnNames={"username"})}
public class WebUser implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
private String lastName;
private String firstName;
private String middleName;
private String username;
private String password;
public Long getId() {
return id;
public void setId(Long id) {
this.id = id;
@Override
public int hashCode() {
int hash = 0;
hash += (id != null ? id.hashCode() : 0);
return hash;
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof WebUser)) {
return false;
WebUser other = (WebUser) object;
if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
return false;
return true;
@Override
public String toString() {
//return "web.model.WebUser[id=" + id + "]";
return "web.model.User[username=" + username +"]";
public String getLastName() {
return lastName;
public void setLastName(String lastName) {
this.lastName = lastName;
public String getFirstName() {
return firstName;
public void setFirstName(String firstName) {
this.firstName = firstName;
public String getMiddleName() {
return middleName;
public void setMiddleName(String middleName) {
this.middleName = middleName;
public String getUsername() {
return username;
public void setUsername(String username) {
this.username = username;
public String getPassword() {
return password;
public void setPassword(String password) {
this.password = password;
}Thanks again guys! -
How can convert HTML file into xml file?
Hi,
I am receving one HTML file as an input and i want to convert that receiving(html file) into .xml file.Is there any converter (tools)to do this.Pls if any give me the details with regard.
Regards,
mahesh.Use the HTMLEditorKit to parse the html file.
this kit is having the callback methods which
are called wenever the tag appears in the HTML
stream.
Maybe you are looking for
-
SAP and Adobe (Flex)
Hello , I would like to know how to start working with SAP BW and Adobe ( Flex). Is needed that Java Engine to be installed for the server? Is there a document how to link the 2 worlds (SAP , Adobe - Flex) ? I would like to know what resources are n
-
I replaced my hard drive and reloaded itunes. Now it won't open and I get a message that the file itunes library.itl cannot be read because it was created by a newer version of itunes. What do I do?
-
Can't find resource bundle -- this has to be a WL bug
Has anyone successfully used ResourceBundle to return a custom Object instead of a string? I can get the .properties file to work, but I want to return Objects, not strings. As far as I can see, WebLogic 5.1 SP10 simply does not allow this to happen.
-
Error during production order released
The profile selected for the capacity availability is not suitable error comes during po released. Pls tell me how to resolve it
-
Hello all I'm trying to put sudo to work with LDAP. I found a web page (http://sudo.p8ra.de/sudo/readme_ldap.html) with information about this technique and I want to check if someone had implemented this and if its working. Our environment is: - Sol