Validating an XML File

Introduction

SCS, like most advertising systems vendors, specifies an XML format for interfaces.

Advertising systems expect valid XML content. If an XML file is not valid, it is rejected; not processed. As vendors, companies, and IT staff interface with an advertising system for the first time, there is an initial period of trial and error. It is in everyone's interest to make that period as short as possible.

You can test and validate XML files yourself. Free tools are available for every operating system.

Example

Let's start with an example. A ROP advertising system creates a file named "ads.xml". We want to determine if that file complies with SCS's XML schema, "product.xsd". Assume that we have a copy of both files. This example will be used throughout the lesson.

xmllint

xmllint is a free program that validates XML files. It is available for Linux, Mac OS X, and Sun/Oracle Solaris.

Valid XML?

To validate the XML file, run:

xmllint --noout ads.xml

The above command checks if the ads.xml file contains well-formed XML. True to the UNIX philosophy, if there are no errors, xmllint reports nothing.

The error message above is quite long. To explain it, in the ads.xml file, on line 10, there is a problem with the "transaction_code" element. The transaction code is W. It should be A, R, S, or N.

Microsoft® XML Notepad

Microsoft® provides a free application called XML Notepad that can validate XML files.

SCS

SCS systems validate all incoming XML files. If an XML file is not valid, then it will be rejected as noted earlier.

Layout-8000 keeps a copy of the XML file and the corresponding issues. Layout-8000 can e-mail the errors to select people. If you have a Layout-8000 system, it may be easier to read this error file than to re-validate the XML file.

Conclusion

If you need to validate an XML file, I encourage you to try one of the free XML validators first. You will get results fast. The more people and companies that are involved in an XML issue, the longer it takes. Save time and do it yourself.

[Trademarks used in this text: Layout-8000 is a trademark of Software Consulting Services, LLC; Microsoft is a registered trademark of Microsoft Corporation in the United States and other countries.]