Washington State University World Class. Face to Face. Campuses WSU Home WSU Search my WSU

Validate Respondent Pool XML

From skylightwiki

Jump to: navigation, search

How to validate the XML document before importing:

  • XML Editor - Some popular XML editors recommended are: Altova XML Spy and oXygen XML Editor. Both of these tools provide real-time document validation. This process should be as simple as opening the document in the XML editor, then saving it, or finding a "Validate XML" button if available. Normally the text will underline or highlight where there is an invalid statement.
  • Automated - If you have an automated system which generates an XML file, you can use built-in validation tools/classes of your automated engine (if they are available). In most automation processes, using the built-in tools are an advantage for validation, but there could be another separate automated process that does validation on your XML. No human intervention is needed, other than the physical import process needed for Skylight.
  • Skylight support - You can contact CTLT to help you with validation if you are having trouble or unable to use the above methods.

Simple common causes of invalid XML:

  • Malformed XML
  • Missing XML declaration
  • Illegal characters
  • XML format does not match required format

[ Malformed XML ]

This is an example of an XML snippet missing a proper <respondent> closing tag:

<respondent email="student01@wsu.edu" completed-survey="False">
     <respondent-info-list />
<respondent>

[ Missing XML declaration ]

This is an example of an XML declaration that should be in the first line of the XML document:

<?xml encoding='UTF-8'?>

[ Illegal characters ]

This XML snipped contains illegal characters including '&', '&nbsp;', and '<' characters:

<respondent-pool name="T & L 541" delivery-type="1" completion-url="">
	<description>&nbsp;&nbsp;T & L 541 is < 4 credits.</description>
	<respondent-pool-info-list>
             <key>Credits</key>
             <value>3</value
        </respondent-pool-info-list>
</respondent-pool>

Use this notation for these basic supported characters:

< = &lt;

> = &lt;

' = &apos;

" = &quot;

& = &amp;

Handling Individual Ampersand Characters:

If you have text that contains the common ampersand character such as:

Salt & Pepper

You must replace this with the proper HTML escape character, like this:

Salt &amp; Pepper

Hopefully this can be a simple process of locating each occurence and fixing it. But if there are hundreds or thousand of these stand-alone (surrounded by white space for example) ampersands, this could be unmanageable without using a program to HTML-Encode this special characters. A simple find and replace routine may work for you, but is not ideal due to other html entities that could already exist in your XML. This could corrupt your XML data.

HTML Entities:

If you are using other special characters besides these like the " " escape for a non-breaking space, then you'll have to append a DOCTYPE declaraion to the top of your XML file:

<?xml encoding='UTF-8'?>
<!DOCTYPE nbsp [<!ENTITY nbsp "&#160;">]> 

Another option is to use HTML entities directly in your XML excluding a DOCTYPE declaration all together. For example, if you wanted 3 spaces in a row you could do something like this:


<description>&#160;&#160;&#160;No description yet.<description>

Here is a reference chart for HTML entities: http://www.webmaster-toolkit.com/html-entity-chart.shtml


[ XML format does not match required format ]

You must follow the exact format and structure for the XML. Mixing and matching tags is a sure-fire way for non-conforming XML.

This is an example of an invalid XML file do to incorrect structure (<pool> is not a supported tag)

<pool>
    <respondent-pool name="T &amp; L 541" delivery-type="1" completion-url="">
	<description>T &amp; L 541<description>
	<respondent-pool-info-list>
             <description>None<description>
             <key>Credits</key>
             <value>3</value
        </respondent-pool-info-list>
     </respondent-pool>
</pool>
Review description.
Please review this description against the application.
Personal tools