Home

Load an SDO data graph from XML

 

+

Search Tips   |   Advanced Search

 

In this example we load the accounts.xml file into a data graph and display the content of the data graph on the console. To do this, complete the following steps:

  1. Create a new Java class: In the Enterprise Explorer, right-click the com.xml.rad75.itso.sdo package in and select...

    New | Class

    • Type SDOSample as the class name., and select public static void main(String[] args] so that a main method is generated.

    • Click Finish.

  2. In the Enterprise Explorer, right-click RAD75XMLBankJava and select Properties. In the Properties dialog:

    • Select...

      Java Build Path | Libraries | Add External JARs

      ...and add...

      <SDP7xShared>/plugins.org.eclipse.emf.ecore.change_2.4.0.v200806091234.jar
      Click OK to add the new JAR to the project.

    • Add the sample code to the main method including throws IOException...
      public static void main(String[] args) throws IOException 
      {
          System.out.println("\n--- Printing XML document to System.out ---");
      
          DocumentRoot documentRoot = ItsoResourceUtil.getInstance().load("Accounts.xml");
      
          ItsoResourceUtil.getInstance().save(documentRoot, System.out);
      
          System.out.println("\n\n--- Done ---");
      }
      

    • Add import statements...

      Source | Organize Imports | SDOSample (right-click)

      ...and select...

      Run As | Java Application

      The accounts.xml file is displayed in the Console.