Salesforce

How Do I Create an XML View? (Magic xpa 3.x)

« Go Back

Information

 
Created ByKnowledge Migration User
Approval Process StatusPublished
Objective
Description

How Do I Create an XML View? (Magic xpa 3.x)

The XML view is the key to working with XML in Magic xpa. Once the XML view is created, you can work with the XML document much as you would any other Data Source in Magic xpa.

Prerequisite: You need to have:

Creating an XML View

  1. Open up a line in the Data repository (F4, or Edit->Create Line).

  2. Set the Database column to a database that has a Data Source type of XML File.

  3. Get the schema information by selecting Options->Get Definition (F9). A file selection dialog box will open, which allows you to select the schema .xsd file.

    When you select the .xsd file, the Name, and Data source name fields will default to the first element in the schema, which in this example is “Productions”.

  4. The View tab will be filled in automatically from the information in the .xsd.

    You might see only the complex elements (The ones with the ‘+’ icon). To show the simple elements also, select Right-Click->Show Simple. In the picture below, we are showing the simple elements (and the menu changes to Hide Simple).


  5. Since we want to create a view into the Title element, we move to the Title element, and select Right-click->Include in View.




    Now, you have a sub-element that is linked to the root element by the NodeId and ParentId.

  6. Change the Data Source Name to reflect the name of the actual XML document that will hold the data. It’s a good idea to use logical names or relative paths rather than hard-coding the path name.

  7. Change the Name to anything you like, to reflect what you want to call this XML view.

    Now you can access the TitleList much as you would any other data source.

Note: You will need to create one XML view for each repeating element in the XML document (see How Do I Access a Certain Compound in an XML File?). Also, you need to initialize the root element before you can write to the XML document (see How Do I Create an XML Doc from Scratch?).

Creating several XML Views

  1. Go to the title (#) of the Data repository and open the Get Definition screen (F9, or Options->Get Definition).

  2. Switch to the XML tab.

  3. Set the Database to a database that has a Data Source type of XML File.

  4. Select the schema and click OK.
    The new views will be added to the Data repository (and optionally the programs will be added to the Program repository).

See also

The Online and Rich Client Samples projects (program XM03 and RXM03)

Reference
Attachment 
Attachment