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.
If there are errors, xmllint reports something like:
ads.xml:10: parser error : Opening and ending tag mismatch: ad line 9 and transaction_code transaction_code>N</transaction_code> ^ ads.xml:15: parser error : Opening and ending tag mismatch: product line 5 and ad </ad> ^ ads.xml:17: parser error : Extra content at the end of the document </prd:product> ^
Complies with XML schema?
To determine if the XML file complies with an XML schema, run:
xmllint --noout --schema product.xsd ads.xml
The above command checks if the ads.xml file contains valid XML, and also complies with the XML schema in product.xsd. The XML file must meet both requirements in order to be accepted by SCS systems.
If there are no errors, xmllint reports:
ads.xml validates
If there are errors, xmllint reports something like:
ads.xml:10: element transaction_code: Schemas validity error : Element 'transaction_code' [ST 'transcodeType', facet 'enumeration']: The value 'W' is not an element of the set {'A', 'R', 'S', 'N'}. ads.xml fails to validate
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.]
Comments
0 comments
Please sign in to leave a comment.