Naming Fields

Every field in an input file - including fields in the same region and row - can have its own field element name. All field element names ( <field> is the default) include the namespace prefix if one was specified.

Field names are determined by two properties - Element Name Source and Field Element Name. The Element Name Source indicates the origin of the field name used in the XML output when converting the input file. The Field Element Name property specifies the actual value used to name the <field> element.

There are three values for the Element Name Source property:

  • User-Supplied - Specifies that you will supply names for the <field> element, which you do using the Field Element Name property. (The default value of the Field Element Name property is field.) If you use other values for the Element Name Source property, Stylus Studio provides the values for the Field Element Name property.
  • User-Supplied is the default setting for the Element Name Source property.

  • From First Row - You can use this setting to take <field> element names from the first row. Consider the following input file:

Make:Model:Year
               
BMW:R1150RS:2004
               
MZ:Scorpion:1995
               
Ducati:ST2:1997
               

            

If you set Element Name Source to From First Row, the XML output uses Make, Model, and Year for the <field> element names, as shown here:

<?xml version="1.0" encoding="utf-8"?>
               
<root>
               
	<row>
               
		<Make>BMW</Make>
               
		<Model>R1150RS</Model>
               
		<Year>2004</Year>
               
	</row>
               
	<row>
               
		<Make>MZ</Make>
               
		<Model>Scorpion</Model>
               
		<Year>1995</Year>
               
	</row>
               
	<row>
               
		<Make>Ducati</Make>
               
		<Model>ST2</Model>
               
		<Year>1997</Year>
               
	</row>
               
</root>
               

            

Note

 

In the event that the first row has fewer names than there are fields in one or more subsequent lines in the file, Stylus Studio names the extra fields <fieldn >, where n is the field number relative to other fields in the row.

  • WS-EDI Standard - This setting allows rows and fields to be named based on the WS-EDI Standard. See http://www.ws-edi.org for more information on this standard.
To provide user-supplied field names:
1. Display the Properties window if it is not already displayed (click View > Properties on the Stylus Studio menu).
2. Place the cursor anywhere in the field you want to name.

The Field Element Name property displays the current value for the field.

3. Type the new name in the Field Element Name property and press Enter.
To specify alternate sources for field names:
1. Display the Properties window if it is not already displayed (click View > Properties on the Stylus Studio menu).
2. Select the field name source you want to use from the Element Name Source drop-down list.
3. Press Enter.
 
Free Stylus Studio XML Training: