How to get an object of choice from XML data using XMLBean?

I have xml schema and I have generated a jar to represent my schema using XMLBean. I also have few xml data files, these are valid xml for generated schema. Now I want to write a utility which takes xml file as input and returns an object of my choice (Assuming this Object type is available in the jar) as output and vice versa. Some thing like this –
1. Object getObjectFromXML(File xmldatafile, Class classname)
xmldatafile = presents the source of XML data
classname = an object of this class type as output filled from the xml data.
2. String getXMLStrFromObject(Object)
Pass Object and get XML as String output
Any pointer?
Thanks,

Hi! Maybe have a look at the documentation for XmlObject.Factory.parse(). It should allow you what you need to do.
Cheers,
G.

Similar Messages

  • How to Get and Update properties values from XML tag Using Xquery or PL Sql

    Hi
    I have this tag
    <Solicitud Pais = "1">
    How i can get Pais value?
    How i can update Pais Value?
    Y can use Xquery funtions or PL SQL for this?
    Thak's
    Angel

    How i can get Pais value? ExtractValue
    How i can update Pais Value?UpdateXML
    Y can use Xquery funtions or PL SQL for this?Yes
    Without knowing more about your requirements, where information resides, or even a version of Oracle, that is the best I'll do.

  • How To get getServletContext() object inside JSP from  Eclipse  IDE

    Dear friends,
    I can access methods in getServletContext class from Netbeans in my JSP web project using the following steps.
    String path=getServletContext().getRealPath("\mypath");
    . But In Eclipse when i try to build,it says that "can not find method -getServletContext()".
    How to get this object in my JSP Scriptlet From Eclipse IDE? Plz help me?

    use Expression Language instead.
    I would.
    http://java.sun.com/j2ee/1.4/docs/tutorial/doc/JSPIntro7.html
    regards,i

  • How to get value object (entity abject) from ViewObject?

    How to get data from ViewObject in the form of value object? I know BC4J creates entity object for database table/view (looks like value object) but I did not find api to get entity object from ViewObject.
    Thanks.

    BC4J provides an implementation of the value object design pattern for you, so you don't have to waste time writing your own.
    I wrote a whitepaper illustrating how to take advantage of this at:
    Implement Collections of Value Objects for MVC Apps with BC4J
    This allows clients (like a servlet, a JSP, a Swing client, etc.) to get value objects from the collection of value objects that BC4J supports.
    However, if you are writing code inside your view object implementation class and want to access the entity object, just call the accessor that we generate into your view row implementation class for you. For example, for a VO named EmployeeView that uses an entity object named Employee, there will be a private accessor method getEmployee() that will give you the entity.

  • How to get name of the month from current date.

    Hi,
       How to get the name of the month from current date.
    Thanks,
    Senthil

    Sethil,
    Use your date(let us say Date1) instead of sy-datum.
    CALL FUNCTION 'MONTH_NAMES_GET'
    EXPORTING
    LANGUAGE = SY-LANGU
    IMPORTING
    RETURN_CODE =
    TABLES
    MONTH_NAMES = itab_month
    EXCEPTIONS
    MONTH_NAMES_NOT_FOUND = 1
    OTHERS = 2
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    READ TABLE itab_month
    WITH KEY MNR = date1+4(2).
    itab_month-LTX will contain the value you are looking for
    Good luck
    Raghava

  • How to get First Occurnece of SubString from any string using SharePoint Designer Workflow in SharePoint Online 2013(Office 365)

    Hello All,
    I am facing Problem in SharePoint Designer Workflow. The Problem is that while replacing some subtstring with Space from a string which contains item like {Test, Test, Test, Test}, It replaces all items.
    Below two line we are using in Workflow.
    Can any body suggest some soultion for Finding first ouucrence of ", " so that we can replace only first value from string not all. When String values are different then getting proper values but if String values are same with comma
    seperated then it replace all values.
    Please some body help and your help will be heighly appriciable.
    Thanks in Advance.
    Thanks,
    Vivek Kumar Pandey   

    Have you tried to use Regular Expressions instead of Replace?
    This post is my own opinion and does not necessarily reflect the opinion or view of Slalom.

  • How to get Operating System Space Info from Oracle database using SQL

    Our oracle databases are installed on Unix operating system. Currently our DBA wrote a view to get space info of table spaces and He is requesting me to add Operating system level(file system) drive space info to the same report.
    Can you please let me know the easiest way to get this information to sql table so that it can be used for reporting purposes?

    You should be able to create a shell script with the OS commands to generate the information for the mount points that you want to access in Oracle, then read it in as an external table using the preprocessor feature of external tables:
    http://download.oracle.com/otndocs/products/database/enterprise_edition/utilities/pdf/xtables_preproc11g_1009.pdf

  • Fetch 1-n relation data from XML Data using XMLTable

    Dear All,
    Following query is running fine.
    with t as (select XMLType('<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">
       <env:Header/>
       <env:Body>
          <nm:CustomerCRMByIDResponse xmlns:nm="http://sap.com/xi/CRM/Global2" xmlns:prx="urn:sap.com:proxy:DCT:/1SAI/TAS57DF0B317943DEAE3C49:702">
             <MessageHeader/>
             <BusinessPartner>
                <InternalID>2200117598</InternalID>           
                <AddressInformation>
                   <UUID>51471396-9ae8-3cc0-e100-80000a031a28</UUID>
                                        <DefaultIndicator>true</DefaultIndicator>
                   <Address>
                      <PostalAddress>
                         <CountryCode>DE</CountryCode>
                         <CountryName>Country Name</CountryName>
                      </PostalAddress>
                      <Telephone>
                         <Number>
                            <SubscriberID>0711/123456</SubscriberID>
                            <ExtensionID>0</ExtensionID>
                            <CountryCode>DE</CountryCode>
                            <CountryDiallingCode>+49</CountryDiallingCode>
                            <CountryName languageCode="de">Country Name</CountryName>
                         </Number>
                         <UsageDeniedIndicator>false</UsageDeniedIndicator>
                         <MobilePhoneNumberIndicator>false</MobilePhoneNumberIndicator>
                         <SMSEnabledIndicator>false</SMSEnabledIndicator>
                         <DefaultIndicator>true</DefaultIndicator>
                      </Telephone>
                      <Telephone>
                         <Number>
                            <SubscriberID>0711/999999</SubscriberID>
                            <CountryCode>DE</CountryCode>
                            <CountryDiallingCode>+49</CountryDiallingCode>
                            <CountryName languageCode="de">Country Name</CountryName>
                         </Number>
                         <UsageDeniedIndicator>false</UsageDeniedIndicator>
                         <MobilePhoneNumberIndicator>true</MobilePhoneNumberIndicator>
                         <SMSEnabledIndicator>true</SMSEnabledIndicator>
                         <DefaultIndicator>false</DefaultIndicator>
                      </Telephone>
                      <Facsimile>
                         <Number>
                            <SubscriberID>0711/999888</SubscriberID>
                            <ExtensionID>99</ExtensionID>
                            <CountryCode>DE</CountryCode>
                            <CountryDiallingCode>+49</CountryDiallingCode>
                            <CountryName languageCode="de">Country Name</CountryName>
                         </Number>
                         <UsageDeniedIndicator>false</UsageDeniedIndicator>
                         <DefaultIndicator>true</DefaultIndicator>
                      </Facsimile>
                      <EMail>
                         <URI>[email protected]</URI>
                         <UsageDeniedIndicator>false</UsageDeniedIndicator>
                         <DefaultIndicator>true</DefaultIndicator>
                      </EMail>
                      <EMail>
                         <URI>[email protected]</URI>
                         <UsageDeniedIndicator>false</UsageDeniedIndicator>
                         <DefaultIndicator>false</DefaultIndicator>
                      </EMail>
                      <Web>
                         <URI>www.xyz.com</URI>
                         <UsageDeniedIndicator>false</UsageDeniedIndicator>
                         <DefaultIndicator>true</DefaultIndicator>
                      </Web>
                   </Address>
                </AddressInformation>
                <AddressInformation>
                   <UUID>514a519b-39a2-4890-e100-80000a031a28</UUID>
                                        <DefaultIndicator>false</DefaultIndicator>
                   <Address>
                      <PostalAddress>
                         <CountryCode>AT</CountryCode>
                         <CountryName>Österreich</CountryName>
                      </PostalAddress>
                   </Address>
                </AddressInformation>
             </BusinessPartner>
          </nm:CustomerCRMByIDResponse>
       </env:Body>
    </env:Envelope>') xml_data from dual)
    SELECT xmlresponse.*
    FROM t, XMLTable(Xmlnamespaces('http://www.w3.org/2003/05/soap-envelope' AS "env",
                                                                      'http://sap.com/xi/CRM/Global2' AS "nm",
                                                                      'urn:sap.com:proxy:DCT:/1SAI/TAS57DF0B317943DEAE3C49:702' AS "prx"
                                            'for $BusinessPartner in /env:Envelope/env:Body/nm:CustomerCRMByIDResponse/BusinessPartner                 
                        return $BusinessPartner'
                                            PASSING xml_data
                                            COLUMNS
                                            Internalid Varchar2(4000) Path 'InternalID' 
                                            ) xmlresponse;As you can see, one "BusinessPartner" can have multiple "AddressInformation"
    and one "AddressInformation" can have multiple "Telephone".
    Can someone suggest me how can I extract both InternalID & UUID in one query? For above example output should look as follows..
    InternalID UUID
    2200117598 51471396-9ae8-3cc0-e100-80000a031a28
    2200117598 514a519b-39a2-4890-e100-80000a031a28Thank you very much in advance.
    Regards,
    Hari

    Here is a basic example of one method to achieve what you need
    SELECT xmlresponse.Internalid, xml2.uuid
      FROM t,
           XMLTable(Xmlnamespaces('http://www.w3.org/2003/05/soap-envelope' AS "env",
                                  'http://sap.com/xi/CRM/Global2' AS "nm"
                    '/env:Envelope/env:Body/nm:CustomerCRMByIDResponse/BusinessPartner'
                    PASSING xml_data
                    COLUMNS
                    Internalid   Varchar2(20) Path 'InternalID',
                    addrinfoxml  XMLType      PATH 'AddressInformation'
                   ) xmlresponse,
           XMLTable('/AddressInformation'
                    PASSING xmlresponse.addrinfoxml
                    COLUMNS
                    UUID         Varchar2(80) Path 'UUID'
                   ) xml2;Changes:
    I removed one of namespaces as you only need to include those included in an XPath statement.
    I shortened your datatypes.
    I went for the simple XMLTable joined to an XMLTable approach, instead of a single XMLTable using a FLWOR statement.
    You can include the addrinfoxml column to your SELECT list to see the data being passed between the two if you want.
    Addition:
    Here's one approach for a single XMLTable.
    SELECT xmlresponse.*
      FROM t,
           XMLTable(Xmlnamespaces('http://www.w3.org/2003/05/soap-envelope' AS "env",
                                  'http://sap.com/xi/CRM/Global2' AS "nm"
                    'for $BP in /env:Envelope/env:Body/nm:CustomerCRMByIDResponse/BusinessPartner
                      for $ai in $BP /AddressInformation
                       return <e>{$BP/InternalID}{$ai/UUID}</e>'
                    PASSING xml_data
                    COLUMNS
                    Internalid   Varchar2(20) Path 'InternalID',
                    UUID         Varchar2(80) Path 'UUID'
                   ) xmlresponse;Edited by: A_Non on Mar 25, 2013 9:41 AM
    Added in XQuery solution

  • How to get POF object's field value from query result

    hi,all:
    I want to get field value from the query result, my code is below
    Set setResults = cache.entrySet(createFilter("homeAddress.state = 'MA'"));
    for (Iterator iter = setResults.iterator(); iter.hasNext(); )
    Contact c=(Contact)iter.next();
    System.out.println ("firstame####=" + c.getFirstName());
    * but I get error*
    Exception in thread "main" java.lang.ClassCastException: com.tangosol.util.ConverterCollec
    tions$ConverterEntrySet$ConverterEntry cannot be cast to com.oracle.handson.Contact
    at com.oracle.handson.QueryExample.printResults(QueryExample.java:159)
    at com.oracle.handson.QueryExample.query(QueryExample.java:86)
    at com.oracle.handson.QueryExample.main(QueryExample.java:43)
    who can tell me how to get POF object's field value from query result

    Hi,
    If you look at the Java Doc for the entrySet method here http://download.oracle.com/docs/cd/E15357_01/coh.360/e15725/com/tangosol/util/QueryMap.html#entrySet_com_tangosol_util_Filter_ you will see that it returns a Set of Map.Entry instances so you need to do this...
    Set setResults = cache.entrySet(createFilter("homeAddress.state = 'MA'"));
    for (Iterator iter = setResults.iterator(); iter.hasNext(); )
        Map.Entry entry = iter.next();
        Contact c=(Contact)entry.getValue();
        System.out.println ("firstame####=" + c.getFirstName());
    }JK

  • How to get the byte[] size dynamically from the StreamMessage object

    Hi all,
    Using JMS, I am receiving the FDF file as StreamMessage from the queue and attaching it to the PDF file which is present in the local system.
    For that, I have written the code as follows:
    {color:#0000ff} Message msg = jmsTemplate.receive();
    if(msg !=null && msg instanceof StreamMessage)
    StreamMessage message = (StreamMessage) msg;{color}
    {color:#ff6600}//hardcoded the byte array size value
    {color}{color:#0000ff} byte[] bytes = new byte[{color:#ff0000}856{color}];
    System.out.println("read msg="+message.readBytes(bytes));{color}
    {color:#0000ff}PdfReader pdfreader = new PdfReader("D:\\Managing_Workflows_No_Comment.pdf");
    PdfStamper stamp = new PdfStamper(pdfreader, new FileOutputStream("D:\\12345.pdf"));
    FdfReader fdfreader = new FdfReader(bytes);
    stamp.addComments(fdfreader);
    {color} {color:#0000ff} stamp.close();
    {color}{color:#000000}The above code is working fine except with the hardcoded of {color:#ff0000}byte array{color}{color:#ff0000} size value{color} which is given in {color:#ff0000}RED{color} in color.
    Can anybody know, {color:#000000}*how to get the byte[] size dynamically from the StreamMessage*{color} object ?
    Any help would be highly beneficial for me !!!!
    Thanks and Regards,
    Ganesh Kumar{color}

    When you create your stream message you could add an property to your message, something like streamSize that would contain the number of bytes in your stream message. Then you could get this property from the message before declaring your array.
    Tom

  • How to get password as string back from encrypted password byte array.

    Hi All,
    I am storing encrypted password and enc key in the database.(Code included encryptPassword method for encryption and validatePassword method for validating of password). Problem is that for some reason i need to show user's password to the user as a string as he/she entered. But i am not able to convert the encrypted password from D/B to original String.
    Tell me if any body know how to get the string password back from the encrypted password byte array after seeing my existing encryption code.
    //********* Code
    private Vector encryptPassword(byte[] arrPwd)
    try
    // parameter arrPwd is the password as entered by the user and to be encrypted.
    byte[] encPwd = null;
    byte[] key = null;
    /* Generate a key pair */
    KeyPairGenerator keyGen = KeyPairGenerator.getInstance("DSA", "SUN");
    SecureRandom random = SecureRandom.getInstance("SHA1PRNG", "SUN");
    keyGen.initialize(1024, random);
    KeyPair pair = keyGen.generateKeyPair();
    PrivateKey priv = pair.getPrivate();
    PublicKey pub = pair.getPublic();
    /* Create a Signature object and initialize it with the private key */
    Signature dsa = Signature.getInstance("SHA1withDSA", "SUN");
    dsa.initSign(priv);
    /* Update and sign the data */
    dsa.update(arrPwd, 0, 12);
    /* Now that all the data to be signed has been read in, generate a signature for it */
    encPwd = dsa.sign();
    /* Now realSig has the signed password*/
    key = pub.getEncoded();
    Vector vtrPwd = new Vector(2);
    vtrPwd.add(encPwd);
    vtrPwd.add(key);
    return vtrPwd;
    catch (Exception e)
    private boolean validatePassword(byte[] arrPwd,byte[] encPwd,byte[] key) throws RemoteException
    try
    // arrPwd is the byte array of password entered by user.
    // encPwd is the encrypted password retreived from D/B
    // key is the array of key through which the password was encrypted and stored.
    X509EncodedKeySpec KeySpec = new X509EncodedKeySpec(key);
    KeyFactory keyFactory = KeyFactory.getInstance("DSA", "SUN");
    PublicKey pubKey = keyFactory.generatePublic(KeySpec);
    /* Encrypt the user-entered password using the key*/
    Signature sig = Signature.getInstance("SHA1withDSA", "SUN");
    sig.initVerify(pubKey);
    /* Update and sign the password*/
    sig.update(arrPwd, 0, 12);
    return sig.verify(encPwd);
    catch (Exception e)
    Help upto any extent would be appreciated.
    Thanx
    Moti Singh

    Hi All,
    I am storing encrypted password and enc key in the
    database.(Code included encryptPassword method for
    encryption and validatePassword method for validating
    of password). Problem is that for some reason i need
    to show user's password to the user as a string as
    he/she entered. But i am not able to convert the
    encrypted password from D/B to original String.No, you are not encrypting the password in your code, you are merely signing it.
    Tell me if any body know how to get the string
    password back from the encrypted password byte array
    after seeing my existing encryption code.It is impossible to retrieve the original text out of a signature.
    You should read up on some encryption basics in order to understand the difference between signing and encrypting. Then you can find examples of how to encrypt something here: http://java.sun.com/j2se/1.4/docs/guide/security/jce/JCERefGuide.html.
    Actually there is one class specifically for keeping keys secure, KeyStore http://java.sun.com/j2se/1.4/docs/api/java/security/KeyStore.html
    - Daniel

  • How to get the Newly added fileds from Oracle to BW

    Hi ,
    We have created the view in the DB side and extracted the data to BW side. After that in the DB side they have added new filed. I want to extract the data for that filed also. But that filed is not displaying in the data source itself. We have deleted the sources system assignment to that particular info source and generated the data source in the source system side, and then also I an unable to get the newly added filed in the data source. We are extracting the data from the ORACLE data base. Please let me know the steps how to get the newly added filed in the data source.
    Thanks,
    Visu

    Hi Yadav,
    yes i have alreday created the info objects in the BW side. In the Oracle DB i can see the fileds in the data sources. Newly added filed is not displaying where as previous all fileds are displaying in the oracle DBside.
    Thanks,
    Visu

  • How to get current/present version guid from CRMD_ORDERADM_H ?

    Hi,
    Can any one tell me  how to get the current version guid value from CRMD_ORDERADM_H table for Business Object type 'BUS2000113' .
    For example for one contract if we have more than one version then how to get the latest version guid from this table?
    If I use FM ' BBP_PD_CTR_GETDETAIL'  and in version table how to know which one is the latest/current version?
    Need information for versions.
    Thanks a lot.
    Kevin.

    Hello Kevin,
           In FM  <b>' BBP_PD_CTR_GETDETAIL'</b> look at version table <b>E_VERSION</b> - Here you can check 'VERSION_' or there is another field 'CREATED_AT' - by using these you will get latest version.
    Regards,
    Shiv

  • How to get Request object and LDAP user

    Hi All,
    How to get Request object, coz i want to see the out put of this code
    IUser myUser = request.getUser();
    String uid=myUser.getUid();
    I want to get only LDAP user from the server, for that i am having  code but i think this code is returning me all user from the server.
    com.sap.security.api.IUser user = null;
    try {
          IUserFactory userFactory = UMFactory.getUserFactory();
         IUserSearchFilter searchFilter = userFactory.getUserSearchFilter();
    ISearchResult searchResult = userFactory.searchUsers(searchFilter);
       int count = 0;
        List list = new ArrayList();
         while (searchResult.hasNext()) {
                      count++;
                       String uniqueid = (String) searchResult.next();
                        user = userFactory.getUser(uniqueid);
                        list.add(user.getUniqueName());
    This code is giving me all user from the server LDAP and as well as portal user.
    But i want only LDAP.
    Please help me out. It's urgent.
    Regards,
    Deepak

    Hi
    use the following code
    //Request
    IWDRequest = WDProtocolAdapter.getProtocolAdapter().getRequestObject();
    //User
    IWDClientUser = WDClientUser.getCurrentUser();
    Regards
    Ayyapparaj

  • How to get rid of the other from the MacBook Air Memory?

    How to get rid of the other from the MacBook Air Memory? I reviewed my newly purchased MBA ear;y 2014 i7 8GB RAM and there was 24+ GB of "Other". I have Yosemite. I have restored to factory with no luck. is there a memory cleaner or process to eliminate what is not needed in Other? I know some files there are settings, and such but not 24+ GB worth is such of stuff.

    About “Other”:
    http://support.apple.com/en-us/HT202867
    Go step by step and test.
    1. Start up in Safe Mode.
        http://support.apple.com/kb/PH11212
    2. Backup your computer.
    3. Empty Trash.
       http://support.apple.com/kb/PH13806
    4. Disk space / Time Machine ?/ Local Snapshots
      Local backups
       http://support.apple.com/kb/ht4878
    5. Delete old iOS Devices Backup.
        iTunes > Preferences > Devices
        Highlight the old Backups , press “Delete Backup” and then “OK”.
        http://support.apple.com/kb/HT4946?viewlocale=en_US&locale=en_US
    6. Re-index Macintosh HD.
        This will take a while. Wait until it is finished.
        System Preferences > Spotlight > Privacy
        http://support.apple.com/kb/ht2409
    7.Try OmniDiskSweeper. This will give the storage size details of the items.
       https://www.omnigroup.com/more
       Select Macintosh HD and click  “Sweep Selected Drive” at the bottom.
       Be careful. Delete only the files that can be safely  deleted. If you are not sure about any file, don’t touch it.
    8. Move iTunes, iPhoto and iMovie media folders to an external drive.
        iTunes
        http://support.apple.com/en-us/HT201562
        iPhoto
        http://support.apple.com/kb/PH2506
        iMovie
        http://support.apple.com/kb/ph2289

Maybe you are looking for

  • Problem connecting MBP 17" to 37" LCD Philips

    Hi all, I recently bought a new Philips flat TV LCD model, the top-range for their 37 inches production (3ms panel, one of the fastest). This tv has 3 HDMI connections , and should support PC connections (it's a full hd , with support for 1080p conne

  • How the sales orders in CRM replicated to ECC??????????

    Hello gurus I am implementing CRM with integration with ERP, I would like to know if I have more than one type of sales documents in CRM and I want to replicate them to ECC do I have to have the same number of the sales document types in ECC or only

  • SNP Purchase Reqs transfer problem

    Hi, during the SNP Purchase requisitions immediate transfer, the pur reqs are not transferred from a specific location(although this location and products in it are active), pur reqs are transferred without any problem in other locations/products. ho

  • Restart phone when lock screen in magnify mode and cant see keys

    whe I try to unlock phone it changes to a magnified screen.  How do I do a reset when I can't see the bar to slide for power off?

  • Best way to use disks

    Hello everyone, I have just bought one of the new Imacs, and am about to install Logic, Omnisphere, Garageband Expansion Packs etc. I have 640G of disk space, so I have room for all of these on the internal drive, but what I was wondering is, should