Video Screencast Help
Symantec to Separate Into Two Focused, Industry-Leading Technology Companies. Learn more.
Endpoint Management Community Blog

Workflow Tutorial: Creating Dynamic XML Schema

Created: 25 Mar 2008 • Updated: 25 Mar 2008 • 4 comments
Craig Walker's picture
0 0 Votes
Login to vote

You can't avoid 'em - interactions. Everywhere you go you interact with others. This might not help your social life but it will help! In this tutorial, the reader should learn the common interactions of projects with web data protocols.

Prerequisites: A preexisting XML file.

Objective: Create a project which allows the user to enter data into an XML file.

Estimated time to complete: 15-20 minutes

Step 1: Create a New Project

Create a new Decision Only project at the main screen of Workflow Designer:

Step 2: Setup Your Project

To begin setting up your project, click the Import Components button on your main project model. Click the Create Integration Library button, and enter "XMLSchemaDefinitionLib" in the Library Name field. Click the OK button.

In the Dynamic Type Creation Selection window, select XML Schema Type Generator and click OK:

This will launch the Generator Wizard. The first step requires you to enter an incoming data file. This file will dictate the different fields for your XML File.

Enter an input file in the File Name field of the first step:

Click the Next >> button to continue to the second step.

The second step will simply display the source of the input file:

Click the Next >> button to continue to the final step. Click the Finish button in the last step. The last step allows you to customize the names of the components you are creating using the Generator wizard. For this tutorial, however, we will simply use the default.

The following window will appear:

Click the OK button to accept changes.

Step 3: Complete Specification of Your Project

To complete specification of your project, drag and drop an Add New Data component from the Data category of your toolbox to your project model. Link the new component to your StartComponent and EndComponent as shown below:

We must also specify input data for the project, allowing the user to enter data at execution time. Select the Input Data entry in the Project Info box on the left-hand side of the screen:

Click the Add button to create a new variable. Enter the name "dsPubs" in the Namefield, and set its Type to "dsPubs." Return to the main model of your project by selecting the Model: Primary tab at the top of the screen.

Step 4: Specify Your AddNewData Component

In the main model of the component, right-click on the Add New Data component and select Edit Component. The Edit Component window should appear:

Select dsPubs for the Data Type field. Enter "dsPubs" as the Variable Name under the Output Variables section. This will specify our newly-created input variable as the output variable for the AddNewData component.

Click the ... button to the right of the Value field. In the window which appears, click the ... button to the right of the Items field:

Click the Add button to create a new "dsPubs" type. Click the OK button three times to return to your main project model.

Step 5: Run and Test Your Project

Run your project by selecting the Debug button from the toolbar. The Debug button looks like a bug with a green arrow over it.

In the window which appears, double-click on the blue Execute link. Your project will ask you for input data:

Click the ... button to the right of the ds Pubs field. Then, click the ... button to the right of the Items field. In the Edit Object window, enter some vital information, including the "city," "country," "pub_id," "pub_name," and "state" for the newly-created ficticious publisher.

Click the OK button three times. Your project will begin to execute:

The data you entered will then be added to the input file you specified (in this example, "PurchaseOrder.xsd.")

Finished!

Comments 4 CommentsJump to latest comment

Steve Wayment's picture

In the video you mentioned some tools that would help generate an XML schema.  Are there any suggestions for which tool to use? 

Thank you.

0
Login to vote
Zymer's picture

What video?

Also, I used http://www.freeformatter.com/xsd-generator.html and found that it worked for my XML file perfectly.

0
Login to vote
scottwed's picture

I typically use Visual Studio's editor.  Open the XML file, then select XML > Generate Schema.
I haven't used it recently, but there's also the command line equivalent here:
http://msdn.microsoft.com/en-us/library/x6c1kb0s%28VS.80%29.aspx

I think both of them are included in the free Express Edition of Visual Studio, but I can't confirm.
Both are fairly good at creating a schema definition file, but they aren't perfect.  They can make mistakes when it comes to the number of times a child-node can appear, if your sample xml only has one occurence of a node.

This also used to be a capability of XML Spy, but it's a very expensive editor, and I haven't used it in several years.

Scott Wedekind

+1
Login to vote
Steve Wayment's picture

I tried the Visual Studio Express versions, but I could not figure out how to edit the XML files.  I did find several references that mentioned Microsoft removing the XML tools from the Express versions after 2005. 

However, I found that MS Access works wonderfully if you first import the data and then export it again.  It creates a modified version of your original XML file and the XDS schema.  I was also able to use a transform file to easily convert Lotus Notes "readviewentries" XML to a recognizable format.

0
Login to vote