next up previous
Next: XML command specifications Up: A command interpreter for Previous: Outputting XML using DOM


Outputting XML Conventions

For the first project, again for the sake of brevity and ease of grading, your output will be a series of elements in response to commands, each of which is a reaction to an issued command.

General <success> Output
This is an example of the form (in the exact output order) of a general <success> tag. All tags will be present even if there are no parameters or outputs.

<success>
    <command name=``name1''/>
    <parameters>
        <param1 value=``value1''/>
        <param2 value=``value2''/>
    </parameters>
    <output/>
</success>

General <error> Output
This is the form (in the exact output order) of a general <error> tag. The <parameters> tag will always be present even if there are no parameters to the command. In each command there may be several errors listed if several errors occur in a command you will only output the error of highest priority. For more information see XML Input specification for each command.

<error type=``error1''>
    <command name=``name1''/>
    <parameters>
        <param1 value=``value1''/>
        <param2 value=``value2''/>
    </parameters>
</error>

General <fatalError> Output
This is the form of a General <fatalError> tag. This is used when there is a problem with the entire document (i.e. the input file is invalid XML or does not conform to the schema)
<fatalError />

General <undefinedError> Output
This is the form of a general <undefinedError> tag. This is a default error that will be used if there is an error that is not specified in the spec and is discovered post freezing.

<undefinedError />

General sorting of <city>
Ordering of <city> tags that are contained within the <output> tag is in increasing asciibetical order of the city's name according to the java.lang.String.compareTo() method unless a different method for sorting is specified within the command's specification.

The testing of your messages won't be as stringent as the fact that you reported a success in the first place. More precise information about what the messages are for each command is contained in the Input section of this document.

The root element for output will be <results>. The final XML, at a minimum, should look like this:

<results>
    <success ... />
    <success ... />
    <success ... />
    <error ... />
    <success ... />
    ...
    <success ... />
</results>


next up previous
Next: XML command specifications Up: A command interpreter for Previous: Outputting XML using DOM
MM Hugue 2019-05-28