Home Search

DriveWorks Pro 23
XML Document (Advanced)

Send Feedback

XML Document (Advanced)

This Document type is used to export data directly in to a XML document from the DriveWorks Project.

An XML (Extensible Markup Language) is a format commonly used for inter-operation between different systems.

XML
Document

To Add an XML Document (Advanced):

In DriveWorks Administrator open the Project the Document is to be added to and go to Stage4: Output Rules then Documents - Files

  1. Click the "Add" button on the Command Bar.
  2. Choose XML Document (Advanced) from the list in the Create a New Document wizard.
  3. Give the new Document a name.
  4. Click "Next" and browse for the master XML Document, click "Open" and "Finish".

    See Examples below for basic XML file structure.

To Edit an XML Document (Advanced):

  1. The XML editor will open immediately after an XML Document (Advanced) has been added.

    If this has been closed:

    Select the document to be edited from Stage 4. Output Rules > Documents - Files, and click the Edit button.

  2. To edit the File properties of the document click the expand button next to the Options heading.
  3. The Master File is the location of the XML Document. If the location of the Document changes then it will need re-browsing to using the "Browse..." button.
  4. The Document Name is the name given to the newly created Document. Click the "Build..." button to give the Document a name.
    The Document Name must include a file extension.

    Valid extensions are:

    • xml - will save the document as an xml file.
    • html - will convert the xml into valid html.

    The Document can be deleted if it is not required by making the result of the Document Name return Delete.

    The Document Name will need to be unique if the Document is created in the same location for each Specification, otherwise existing Documents will be overwritten.

  5. The Document Path is the location where the driven document will be stored. Click the "Build..." button to set the Document Path.

    Please see Info: Where To Store DriveWorks Data for information on where to store the data associated to a DriveWorks implementation.

    If the Document Path is not set then the file will be created in the Specification Folder.

  6. The document can also be hidden from the Document List in the Specification Explorer by checking the Hide from Document list option.
  7. To build a rule for an Element check an item in the tree view and click the "Build..." button. If no elements are present but the Document contains them click the "Refresh" button.
  8. At any point a preview can be created by clicking the Preview button on the Command Bar.

Examples:

#Master DocumentDriveWorks InputExpected Output
1
<cubes>   
    <cube> 
        <height/>
        <width/>
        <depth/>
    </cube>  
</cubes>
Values assigned to height, width and depth elements, for example:
  • height = HeightReturn
  • width = DWVariableHeight
  • depth = 1
<?xml version="1.0" encoding="UTF-8"?>  
<cubes>   
    <cube> 
        <height>3</height> 
        <width>2</width> 
        <depth>1</depth> 
    </cube>  
</cubes>
2
<cubes>   
    <cube> 
        <height/>
        <width/>
        <depth/>
    </cube>  
</cubes>
Values driven from a Simple Table to the 'cube' node
  • cube = DWLookupCubeDims

Example of the Simple Table named CubeDims.

ABC
1HeightWidthDepth
2123
<?xml version="1.0" encoding="UTF-8"?>  
<cubes>   
    <cube> 
        <Height>1</Height> 
        <Width>2</Width> 
        <Depth>3</Depth> 
    </cube>  
</cubes>
3
<cubes>   
    <cube></cube>  
</cubes>
Values driven from a Simple Table to the 'cube' node
  • cube = DWLookupCubeDims

Example of the Simple Table named CubeDims.

ABC
1HeightWidthDepth
2123
The child nodes are automatically created based on the column headers
<?xml version="1.0" encoding="UTF-8"?>  
<cubes>   
    <cube> 
        <Height>1</Height> 
        <Width>2</Width> 
        <Depth>3</Depth> 
    </cube>  
</cubes>
4
<cubes>   
    <cube> 
        <height/>
        <width/>
        <depth/>
    </cube>  
</cubes>
Values driven from a Simple Table to the 'cube' node
  • cube = DWLookupCubeDims

Example of the Simple Table named CubeDims.

ABC
1HeightWidthDepth
2123
3456
4789
<?xml version="1.0" encoding="UTF-8"?>  
<cubes>   
    <cube> 
        <Height>1</Height> 
        <Width>2</Width> 
        <Depth>3</Depth> 
    </cube>
    <cube> 
        <Height>4</Height> 
        <Width>5</Width> 
        <Depth>6</Depth> 
    </cube>  
    <cube> 
        <Height>7</Height> 
        <Width>8</Width> 
        <Depth>9</Depth> 
    </cube>    
</cubes>
5
<cubes>   
     <cube> 
        <height/>
        <width/>
        <depth/>
    </cube> 
</cubes>
Values driven from a Simple Table to the 'cube' node where the table has the incorrect quantity of columns.
  • cube = DWLookupCubeDims

Example of the Simple Table named CubeDims.

ABCD
1HeightWidthDepthColor
2123Green
The additional column is added as a new child node of cube
<?xml version="1.0" encoding="UTF-8"?>  
<cubes>   
    <cube> 
        <Height>1</Height> 
        <Width>2</Width> 
        <Depth>3</Depth>
        <Color>Green</Color>  
    </cube>  
</cubes>
6
<cubes>   
     <cube> 
        <height/>
        <width/>
        <depth/>
    </cube> 
</cubes>
Values driven from a Simple Table to the 'cube' node with incorrect column headers
  • cube = DWLookupCubeDims

Example of the Simple Table named CubeDims.

ABC
1RadiusDiameterVolume
22420
The cubes child nodes are removed from the master Document and replaced with the headers of the table.
<?xml version="1.0" encoding="UTF-8"?>  
<cubes>   
    <cube> 
        <Radius>2</Radius> 
        <Diameter>4</Diameter> 
        <Volume>20</Volume>
    </cube>  
</cubes>
7
<cubes>   
     <cube> 
        <height/>
        <width/>
        <depth/>
    </cube> 
</cubes>
Values driven from a Calculation Table to the 'cube' node that contains a nested Simple Table.
  • cube = DWCalcSizes

Example of the Calculation Table named Sizes.

DepthWidthDiameterTable
1123DWLookupCubeDims

Example of the Simple Table named CubeDims.

ABC
1RadiusDiameterVolume
22420
<?xml version="1.0" encoding="UTF-8"?>  
<cubes>   
    <cube> 
        <Depth>1</Depth> 
        <Width>2</Width> 
        <Diameter>3</Diameter>  
        <Table> 
            <Radius>2</Radius> 
            <Diameter>4</Diameter> 
            <Volume>20</Volume>
        </Table> 
    </cube>  
</cubes>
8
<cubes>   
   <cube width="" depth="" height=""/>
</cubes>
Values from individual Variables assigned to height, width, depth nodes as well as a value applied to the cube node. The cubes child nodes are removed from the master Document and replaced with the headers of the table.
<?xml version="1.0" encoding="UTF-8"?>  
<cubes>   
   <cube width="3" depth="1" height="3"/> 
</cubes>
9
<cubes>   
     <cube> 
        <height/>
        <width/>
        <depth/>
    </cube> 
</cubes>
Elements can be deleted when the value returns "Delete".
  • height = HeightReturn
  • width = "Delete"
  • depth = 1

Or from a Table:

ABC
1HeightWidthDepth
23Delete1
<?xml version="1.0" encoding="UTF-8"?>  
<cubes>   
    <cube> 
        <height>3</height>
        <depth>1</depth> 
    </cube>  
</cubes>

For any external application reading an XML file, the above is all that is required. If an XML file is to be displayed in a web browser, it will require a transform file to accompany the file. The transform file tells the browser how to display the XML.

XSL files must exist in the same location as the XML file it is used to display.

When requiring a XSL transform file to display a driven XML file, create a new Document for output and use the Copied File option.

Select the XSL file to use and build a rule that will place it in the same location as the XML file being driven. Exactly the same procedure for any static image files used in the XML can be adopted.

The XML Document (Advanced) is triggered in the Specification Flow by the Release Documents task.