Mapping java classes to XML files

Hi Friends !!
Please I need your help.
Does somebody out there know any framework or API that helps me to map Java classes to XML files.
Something like:
public class Test {
    public int x;
    public int y;
    public int sum(){}
}to something like:
<?xml version="1.0" encoding="UTF-8"?>
<class>
<className>Test</className>
bla
bla
bla
</class>
Any tips?
Thanks in advance
Cleverson

JAXB will create classes from an XML schema, SAX is a parser library and JAXP is a library of XML a bunch of XML tools.
I don't care for JAXB too much. I would skip it and go right to the JAX-RPC spec (WebServices).

Similar Messages

  • Ignore some fields while saving a Java class into XML

    Hi!
    I've seen in this forum that there is an easy way of saving Java classes to XML files using Castor. I want to save some Java classes into XML, but not all the fields of the class. For example, I want to ignore all lists. Is there any easy way to do something like this:
    class Java2XML{
              public static void makeXML(Object object)
                        for all fields in object
                                  if field extends List, ignore
                                  else, include field in XML
    }Thanks in advance!

    You can add a managed bean by:
    - manually adding a definition in the faces config source tab.
    - creating a bean in the overview tab of the faces-config editor.
    So yes, you can edit the faces-config manually.
    I hope this answer your question,
    Regards,
    Koen Verhulst

  • Any tools for converting java class to xml schema ?

    Hi,
    Are there any tools out there that can convert my java class to xml schema. How such tools take care of java collections like HashTable, ArrayList etc. in my class structure. I am not interested in writing any configuration files(like jaxb configuration files, jibx binding xml files etc.) for serving this purpose and the can be able to give me xml schema from the java classes. Please suggest ...
    I am not sure even JAXB 2.0 allows me to do this without writing any jaxb configuration files or annotations in my java class which is not there in JDK 1.4.2
    Thanks & Regards,
    Kr.

    Hi,
    You can convert the EDI file to XML in any of the ways
    1) Using third party seeburger adapters
    2) Conversion agent
    3) Stylus studio.
    I think using java code it will be very difficult.
    Thnx
    Chirag

  • Serializing Java Objects to XML files

    Hi,
    We looking for SAP library which can serialize Java Objects into XML files.
    Can you point us were to find it ?
    We have found such open source library called "XStream" at the following link
    http://www.xml.com/pub/a/2004/08/18/xstream.html
    Is it allowed to use that library inside SAP released software ?
    Thanks
    Orit

    How about https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/webcontent/uuid/83f6d2fb-0c01-0010-a2ba-a2ec94ba08f4 [original link is broken] [original link is broken]? Depends on your use cases...
    Both are supported in SAP NW CE 7.1.
    HTH!
    -- Vladimir

  • Using Custom Java Class - WorkflowRegistry.xml

    I am using a custom java class in workflow. While executing I am getting errot -
    com.waveset.util.WavesetException: Class com.LdapGroupMod is not a WorkflowApplication
    It seems from documentation that I need to add this in workflowregistry.xml file. I added the same like given below -
    <WorkflowApplication name='Workflow Name'
    class='com.LdapGroupMod'>
    <Comments>Nothing Here</Comments>
    </WorkflowApplication>Even tried restaring the application server but I am still getting same error. Any idea what needs to be done here? or I am missing smething?

    Well the first thing would be to read the workflowRegistry.xml file. The header talks about internal and external applications and so on. The crucial part is that any application registered must implement the WorkflowApplication interface (which I guess your class dont do)
    I gave up. I am totally baffled by the documentation. I admit it.
    What I did was to create an Script action in an Activity where the script used Xpress to invoke my class. It seems to work.

  • Generation of java classes from XML Schema.

    Hi All,
    I am working with JWSDP-2.0 but got stucked.:
    To generate Java classes from an XML Schema with the JAXB ,I need to have following jar file in thils location with this JWSDP-2.0
    <JWSDP>/jaxb/lib/jaxb-api.jar
    <JWSDP>/jaxb/lib/jaxb-impl.jar
    <JWSDP>/jaxb/lib/jaxb-libs.jar
    <JWSDP>/jaxb/lib/jaxb-xjc.jar
    <JWSDP>/jwsdp-shared/lib/namespace.jar
    <JWSDP>/jwsdp-shared/lib/jax-qname.jar
    <JWSDP>/jwsdp-shared/lib/relaxngDatatype.jar
    And here I m not finding as jaxb-libs.jar,namespace.jar and jax-qname.jar on respective location.
    If I m putting these left jar file from another place it is not generating all the classes as at least in number it should be 45 but it is generating merely 5 classes.
    Can any one help me regarding this.
    Regards.
    Shelly.

    These JAXB JAR files are for JAXB 1.0.
    For JAXB 2.0 the following JAR files are required.
    C:\Sun\jwsdp-2.0\jaxb\lib\jaxb-api.jar
    C:\Sun\jwsdp-2.0\jaxb\lib\jaxb-impl.jar
    C:\Sun\jwsdp-2.0\jaxb\lib\jaxb-xjc.jar
    C:\Sun\jwsdp-2.0\jwsdp-shared\lib\activation.jar
    C:\Sun\jwsdp-2.0\sjsxp\lib\jsr173_api.jar
    C:\Sun\jwsdp-2.0\sjsxp\lib\sjsxp.jar

  • Errors generating Java classes from XML schema

    I received the following errors when generating Java classes from the schema located at: http://imsproject.org/xsd/ims_qti_rootv1p1.xsd and http://imsproject.org/xsd/ims_xml.xsd
    XML Spy v4 claims that the schema is well-formed and valid. Could this be a problem with the class generators, or is XML Spy not telling the truth?
    Thanks.
    D:\IMS_QTI\Java>java -classpath .;lib/xmlparserv2.jar;lib/xschema.jar;lib/classgen.jar oracle.xml.classgen.oracg -schema ims_qti_rootv1p1.xs
    d -outputDir src\com\icld\qti -package com.icld.qti -comment
    file:/D:/IMS_QTI/Java/ims_qti_rootv1p1.xsd<Line 235, Column 21>: XSD-2209: (Error) Duplicated definition for: 'attr.view'
    file:/D:/IMS_QTI/Java/ims_qti_rootv1p1.xsd<Line 303, Column 21>: XSD-2209: (Error) Duplicated definition for: 'grp.labels'
    file:/D:/IMS_QTI/Java/ims_qti_rootv1p1.xsd<Line 1834, Column -12236>: XSD-2209: (Error) Duplicated definition for: 'qtimetadatafield'
    file:/D:/IMS_QTI/Java/ims_qti_rootv1p1.xsd<Line 1834, Column -9642>: XSD-2209: (Error) Duplicated definition for: 'typeofsolutionType'
    file:/D:/IMS_QTI/Java/ims_qti_rootv1p1.xsd<Line 2252, Column -3019>: XSD-2026: (Error) Invalid attribute 'use' in element 'attribute'
    Error: Schema Class Generator failed to generate classes. oracle.xml.parser.schema.XSDException: Duplicated definition for: 'attr.view'

    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Jinyu Wang ([email protected]):
    Which version are you using? I can't reproduce the error with 9.0.2B version.<HR></BLOCKQUOTE>
    Thanks for having a look at the problem. I am using the 9.0.2.0B version with Java 2 Standard Edition Build 1.3.1-b24. The classgen -version option returns 9.0.2.0b-beta - and xmlparserv2.jar and xschema.jar are from the same distribution. Running the corresponding DTD from the same source work fine - I'm just havinf this problem with the XSD. Anything else I should look at?

  • Java Classes & web.xml

    Is it possible for a Java Class to read or extract a parameter stored in web.xml file?

    Yes, you need XML Parser.
    (Ex: Alpha Works).

  • Where I can find the java class about xml

    I need transfer a xml file to oracle use Java. I find a Java program can do it, but the java progran need a class(oracle.xml.sql.dml.*) and I don't find it.
    I use Kawa 4.01a and Java 1.3.
    I need people tell me where I can find the class.
    Thanks
    Chih-Ping Yang

    Go to: http://technet.oracle.com/tech/xml/oracle_xsu/
    Select [Software] from the tab on the top
    and download OracleXML SQL Utility.
    If you're using Oracle8.1.5, download version
    111. If using Oracle8.1.6, download XSU12.
    Unzip the archive file.
    Under the lib directory, there should be
    a jar file. This jar file contains the class
    you're looking for.
    You do not need to unzip this file. Just set
    it in your CLASSPATH.

  • Writing a formatter in java to display XML file in an organized display

    i have to write a formatter that reads in an XML file and outputs something..like a text file that displays the XML content. Normally when you open XML in text file, all u say is one line in which all the content is displayed..i want to wirte a program that will read in the XML and output a text file which shows the XML content in the same way like wen u view it on a browser..
    thanks

    ok here you go....this is rough and probably buggy.
    Needs some real testing and refactoring and still does not work with
    <! and
    <?
    tags, but for simple XML it should do about what you want.
    import java.io.BufferedReader;
    import java.io.FileReader;
    public class XMLParse
        private static String OPEN_TAG = "OPEN_TAG";
        private static String CLOSE_TAG = "CLOSE_TAG";
        private static String SLASH = "SLASH";
        private static String LETTER = "LETTER";
        private static String SLASH_LETTER = "SLASH_LETTER";
        private static String GET_VALUE = "GET_VALUE";
        private static int INDENT_LEVEL = 4;
        public static void main(String[] args) throws Exception
            FileReader file = new FileReader( "props/test.xml" );
            BufferedReader fileInput = new BufferedReader( file );
            StringBuffer sb = new StringBuffer();
            String s;
            while ( (s = fileInput.readLine()) != null )
                sb.append( s );
            parseXmlString( sb.toString() );
        public static void printIndent(int x)
            for ( int i = 0; i < x * INDENT_LEVEL; i++ )
                System.out.print( " " );
        public static void print(String s)
            System.out.println( s );
        public static boolean isWhiteSpace(char c)
            boolean isWhite = false;
            if ( c == '\n' || c == '\t' || c == ' ' )
                isWhite = true;
            return isWhite;
        public static void parseXmlString(String s)
            char[] chars = s.toCharArray();
            int indentLevel = -1;
            String state = "";
            String latestTag = "";
            for ( int i = 0; i < chars.length; i++ )
                char c = chars;
    if ( state.equalsIgnoreCase( GET_VALUE ) || !isWhiteSpace( c ) )
    switch ( c )
    case '<':
    if ( state.equalsIgnoreCase( GET_VALUE ) )
    printIndent( indentLevel + 1 );
    print( "*" + latestTag );
    state = OPEN_TAG;
    latestTag = "";
    break;
    state = OPEN_TAG;
    latestTag = "";
    break;
    case '>':
    if ( state.equalsIgnoreCase( SLASH ) )
    indentLevel--;
    printIndent( indentLevel + 1 );
    print( "+-" + latestTag );
    state = CLOSE_TAG;
    break;
    if ( state.equalsIgnoreCase( SLASH_LETTER ) )
    printIndent( indentLevel + 1 );
    print( "-" + latestTag );
    state = CLOSE_TAG;
    break;
    printIndent( indentLevel );
    print( "+" + latestTag );
    state = CLOSE_TAG;
    break;
    case '/':
    if ( state.equalsIgnoreCase( OPEN_TAG ) )
    indentLevel--;
    state = SLASH;
    break;
    default:
    if ( state.equalsIgnoreCase( OPEN_TAG ) )
    indentLevel++;
    latestTag += c;
    state = LETTER;
    break;
    if ( state.equalsIgnoreCase( CLOSE_TAG ) )
    latestTag = "";
    latestTag += c;
    state = GET_VALUE;
    break;
    if ( state.equalsIgnoreCase( LETTER ) )
    latestTag += c;
    state = LETTER;
    break;
    if ( state.equalsIgnoreCase( SLASH ) )
    latestTag += c;
    state = SLASH_LETTER;
    break;
    if ( state.equalsIgnoreCase( SLASH_LETTER ) )
    latestTag += c;
    state = SLASH_LETTER;
    break;
    if ( state.equalsIgnoreCase( GET_VALUE ) )
    latestTag += c;
    state = GET_VALUE;
    break;

  • Sending Idocs from SAP-R/3 to XI, bundle and map them to one XML-file

    Hi All,
    We need to send IDoc's (DEBMAS06) from R/3 to XI and  bundle and map them to a single xml-file. Please help us with your suggestions on how to proceed using a simple solution (probably need of BPM).
    Regards,
    Theo

    Hi Theo,
    there is an example in SAP Library: <a href="http://help.sap.com/saphelp_nw04/helpdata/en/08/16163ff8519a06e10000000a114084/frameset.htm">Collecting and Bundling Messages - One Interface</a>. Plz post us your detailed quetions.
    Regards,
    Udo

  • How to convert java class to dll file for using in Microsoft Technology(.n)

    hey hemmj !!!!!!
    nice replying , first of all i d like to say thanks for response me so frequently..... i like such type of guy... i d never forget ur online support.
    hey buddy, i ve a problem with applet application...
    i m working on java chat server build on swing applet. As it is chat server, it is divided into two parts, one is server application and other is client application. I want to run this server app on the client server and the basic thing with this site is that it is running on .net platform(Microsoft). and the other app ll running on the client machine or end user. Now the problem is that this site would run only if the server app ll be run on server. This server app ll open the socket of server, which ll listen the request of the user...... So, the requirement is to convert this java sever class file into dll file and register this dll file with the IIS server.So, It run and stop with the IIS server.
    I ve already search the way to convert the java class file into dll file. This is possible in such way........... below code is for the java class file...
    import java.net.*;
    import java.io.*;
    import java.util.*;
    public class chatServer
    public static void main(String args[]) throws Exception
                        ServerSocket sersoc=new ServerSocket(1234);// Any port number above 1000 should do
    // as most ports below 1000 are used by system
    Vector socvec=new Vector();
    String data="";int i,j=0;
    BufferedReader in;
    //System.out.println("Listening of port " + sersoc.getLocalPort());
    //System.out.println("Waiting for connections...");
    while(true)
    Socket soc=sersoc.accept();
    socvec.addElement(soc);
    chatServerReadThread csrt=new chatServerReadThread(socvec, soc);
    in=new BufferedReader(new InputStreamReader(soc.getInputStream()));
    PrintStream out=new PrintStream(soc.getOutputStream());
    out.println("Connected to chat server");
    out.flush();
    data= in.readLine();
    for(i=0;i<socvec.size();i++)
    soc=(Socket)socvec.elementAt(i);
    out=new PrintStream(soc.getOutputStream());
    out.println(data + " connected");
    out.flush();
    //System.out.println(data + " connected");
    csrt.start(); // error is comming from here..... plz help me.
    class chatServerReadThread extends Thread
    Vector socvec;
    PrintStream out;
    chatServerReadThread(Vector socvec, Socket soc)
    this.socvec=socvec;
    try
    out=new PrintStream(soc.getOutputStream());
    }catch(Exception e){}
    public void run()
    try
    String data;
    Socket soc;
    BufferedReader in;
    while(true)
    for(int i=0;i<socvec.size();i++)
    soc=(Socket)socvec.elementAt(i);
    in=new BufferedReader(new InputStreamReader(soc.getInputStream()));
    if(in.ready())
    try
    data=in.readLine();
    if(data.charAt(0) == ']')
    data = in.readLine() + " exited";
    //System.out.println(data);
    socvec.removeElement(soc);
    for(int e=0;e<socvec.size();e++)
    soc=(Socket)socvec.elementAt(e);
    out=new PrintStream(soc.getOutputStream());
    out.println(data);
    out.flush();
    else
    for(int e=0;e<socvec.size();e++)
    soc=(Socket)socvec.elementAt(e);
    out=new PrintStream(soc.getOutputStream());
    out.println(data);
    out.flush();
    }catch(Exception e){socvec.removeElement(soc);}
    }catch(Exception e){e.printStackTrace();}
    first i ve made the jar file of this class
    jar cvf chatServer.jar chatServer.classafter getting the jar chatServer.jar. I ve opened the .net dos prompt and
    type this command which ll make dll file automatically....
    > jbimp /t:library chatServer.jar
    And you'll see the following output:
    Microsoft (R) Java-language bytecode to MSIL converter version 1.1.4322.0
    for Microsoft (R) .NET Framework version 1.1.4322
    Copyright (C) Microsoft Corp 2000-2002. All rights reserved.
    Created chatServer.dll
    I cant get the problem origin from where it is comming, when i tried to convert it into .dll file it shown an error that, it did not recongnized the method in first class
    public static void chatServerReadThread.start() method
    is not recognized by .net dos prompt commnad. But when i omit this method it gets created the .dll file. This start method is basically the default method of thread class that run the thread from the same class..
    By vewing the code u can visulize the thing,, i ve marked the code from where the error is comming.
    Plz do it as soon as possible, i ll waiting for ur reply......
    I ll be really thanking u for that....
    Thanx and regards
    Niraj Kumar Singh

    I wonder if this will work:
    jbimp /t:exe chatServer.jar
    Your chatServer is an application that can be started from the commandline.
    A dll is a library to be used in com, com+, other executables or ....

  • Java classes and MySql Files

    Hello,
    There is a way to distribute the Mysql db files with yout java application without need to install Mysql in the computer, like in access, you just copy the .mdb file with your java class and create a conection to it.
    Thank You

    No. If you want to do that you should just use Access. mySQL files will not work without the mySQL server.

  • Virtual-mapping in jrun-web.xml file for CFIDE is not working

    I have put virtual-mapping for my web root into jrun-web.xml
    file. It looks like this:
    <virtual-mapping>
    <resource-path>/*</resource-path>
    <system-path>E:/WebSites/mywebroot</system-path>
    </virtual-mapping>
    So I need give virtual-mapping for my CFIDE too. It looks
    like this:
    <virtual-mapping>
    <resource-path>/CFIDE/*</resource-path>
    <system-path>E:/Apps/JRun4/servers/myserver/cfusion-ear/cfusion-war/CFIDE</system-path>
    </virtual-mapping>
    It is now working for me. When I use following url:
    http://localhost:8002/CFIDE/administrator
    I am getting "HTTP 404 - File not found". I have set it for
    other servers they are working on same server. What I did wrong
    this time?
    Thanks ahead.
    Mikenj

    Hi John,
    i did some some changes in Account dimension in my Planning Dev server. When i was migrating it to QA using LCM in shared services it is howing this error: Import failed for the following reason - Error parsing the deployment xml.
    First i define migration in Dev for export and the migration was successful.Then i went into QA shared services and started migration, i got this error for importing.
    Could you help me out on this?
    Regards,
    Shilpa

  • Java Tree's & XML Files ??

    Hi ye's -
    Listen I'm a little stuck - and need yer help ??? If ye's can .........please -
    The problem is this -
    I have a Massive XML File containing all the different Categories, Tags, Tag Descriptions, Indicators and valid Subfields, Repeatable Subfields.
    Now - I need to build a Tree to illustrate all this information - however within my code I don't want to Compare it against the elements int the XML file since I'll have tonnes of different elements, making my code enormous -
    Is there a way I can code in java to loop through the XML file and build up my Tree as it goes along ????
    Here is a sample of the code I was using - but surely theres an easier way ? Can't keep continuing like this ;o(
    Lorraine
    public void parseDomTreeMarc(Element rootElement)
    NodeList BiblioTags = rootElement.getChildNodes();
    DefaultMutableTreeNode Category = null;
    DefaultMutableTreeNode Tag = null;
    for(int i = 0; i < BiblioTags.getLength(); i++)
         if(BiblioTags.item(i).getNodeName().compareTo("Title") == 0)
              NodeList CategoriesList = BiblioTags.item(i).getChildNodes();
              Category = new DefaultMutableTreeNode(CategoriesList.item(i).getNodeValue());
              for(int j = 0; j < CategoriesList.getLength(); j++)
                   if(CategoriesList.item(j).getNodeName().compareTo("TagValue") == 0)
                        NodeList TagList = CategoriesList.item(j).getChildNodes();
                        for(int k = 0; k < TagList.getLength(); k++)
                             switch(TagList.item(k).getNodeType())
                                  case Node.TEXT_NODE:
                                  if(TagList.item(k).getNodeValue().compareTo("") != 0)
                                       Tag = new DefaultMutableTreeNode(TagList.item(k).getNodeValue());
                                       Category.add(Tag);
                             if(TagList.item(k).getNodeName().compareTo("TitleDescription") == 0)
                                       etc...
                                       doing same piece of code for all elements more or less ...
         //Create Marc Tree
    final JTree marcTree = new JTree(Category);
    marcTree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
    JScrollPane treeView1 = new JScrollPane(marcTree);
    this.getContentPane().add(treeView1, new XYConstraints(10, 350, 223, 197));

    Have emailed a jar file of sample code to the email address shown in your profie. Let me know if there's a better address to send it to
    Good luck!

Maybe you are looking for

  • How can I make an AAC version of a song?

    How can I make an AAC version of a song? All I see is "Create an MP3 Version". I do not want to pay for a shorter version of a song that I already have! Why is APPLE doing this to us?!?!?! GREED, that's why!!  #venting 

  • Acc Assignment Release

    Hi, We have release procedure setup for PO, but  also need to have release procedure triggered for any changes in PO for G/L account. Should we maintain this a seperate characterisitic and assign to class. Thanks....

  • CS3 Datagrid Component

    There has to be some way to get an html link to work in a CS3 Datagrid. I can't find anything on html links using Flash CS3 and Actionscript 3, which seems pretty remarkable to me. I'm surprised Adobe didn't code the datagrid to recognize when an htm

  • Opportunity team history

    Hello, I have a question regarding opportunity team. Here is the thing. 1. I am on an opportunity with Owner = Bryan 2. I change the owner to John 3. In the opportunity team i see Bryan AND John. 4. There is no way to delete (even manually) the previ

  • Please give me Answers of below questions.

    Hi , 1) How to define size of the cube? 2) How to define structure properties of the Bw objects? like as infoobjects,ods,cube,multiprovider,infosets like that... 3) What is diff between infoprovider & Data provider and multi cube & multiprovider? 4)