9 Replies Latest reply on Sep 29, 2019 5:36 AM by Bakhed

    Read XML file in ADF VO object


      HI, I want to read XML file as data file  (with Fixed column format )  to VO object and update to DB .

        • 1. Re: Read XML file in ADF VO object
          Timo Hahn

          User, tell us your jdev version, please!


          What is the problem?

          What have you tried yourself?



          • 2. Re: Read XML file in ADF VO object

            Parse XML using a parser (DOM or SAX) or JAXB unmarshalling, and extract XML element data, and store in database. ADF is not needed as most parsing, extraction could be performed with a Java application, but storing in database could make use of ADF VO.


            The same question is answered with more detail in a different post "How to pass a xml data file to an adf application app module".

            • 3. Re: Read XML file in ADF VO object

              H| Timo,  I have Jdev ,


              1. The issue is User want to upload his XML file to Oracle data base (ALL colums and and index will be fixed in table and file nodes).  

              so what i want to its there any native mechanism that we can update file to vo and commit .

              2. Or i have to loop through file line by line and read node .


              some where is see VO.inserxml that not clear to me.


              • 4. Re: Read XML file in ADF VO object
                Timo Hahn

                There is no native way built into the ADF business components. However, you can easily read the xml file and insert the data into the db (as dvohra21 mentioned). Or you look at Tutorial: Powerful and Easy ADF Data Control for XML Data - Part 1 [ARTICLE] and use a data control to read the data for you and use normal data control methods (first, next, ...) to get the data to insert in into the DB using another VO.



                • 5. Re: Read XML file in ADF VO object

                  But some where oracle doc its mentioned vo.insertXml|() but its not clear .. so i thought might be possible instead travels rows and columns.

                  • 6. Re: Read XML file in ADF VO object
                    Timo Hahn

                    Then provide a link to the doc, please!



                    • 8. Re: Read XML file in ADF VO object
                      Timo Hahn

                      Well, I find the doc pretty clear. You can write the content of a VO as XML or you can read data into a VO using XML. The format needed to read data into a VO is the same you get when you write data from the VO into an XML file.

                      If the XML you get is not in this canonical format, you can use XSLT to transform the XML first before reading it into the VO.


                      So, the first step would be to write out some rows of the VO as XML using the writeXML method. Then you see the format. Next thing to do is to transform the XML you get into this format. Once this is done, you can read data into the VO by using the readXML method.



                      • 9. Re: Read XML file in ADF VO object

                        Ok thanks Timo its workig as shown below


                        void Read_XML() {

                                DCBindingContainer bindings = (DCBindingContainer)BindingContext.getCurrent().getCurrentBindingsEntry();

                                DCIteratorBinding iter = bindings.findIteratorBinding("Scm_AppParameterVO1Iterator");

                                ViewObject  vo = iter.getViewObject();

                                try {

                                    String filepath="/ABSXML/1.xml";        

                                    DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();

                                    DocumentBuilder builder = factory.newDocumentBuilder();

                                    Document document = builder.parse(new File(filepath));


                                   Element root = document.getDocumentElement();

                                    vo.readXML(root, 0);          

                                    OperationBinding obd = (OperationBinding) bindings.getOperationBinding("Commit");

                                    Object result = obd.execute();

                                    if (!obd.getErrors().isEmpty()) {



                                    else {




                                }catch (Exception e) {System.err.println(e);}



                        as XML file only the node  should math the VO attributes.