Output for Example 2: Validating with schemaLocation (C-C++)
This topic shows the expected output for the following examples:
When you build and run any of these examples, their output should appear as follows:
Validation succeeded for sl-valid.xml
=====================================
<?xml version="1.0"?>
<catalog xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
xsi:schemaLocation='urn:book sl.xsd'>
<x:book xmlns:x='urn:book' id="bk101">
<x:author>Gambardella, Matthew</x:author>
<x:title>XML Developer's Guide</x:title>
<x:genre>Computer</x:genre>
<x:price>44.95</x:price>
<x:publish_date>2000-10-01</x:publish_date>
<x:description>An in-depth look at creating applications with
XML.</x:description>
</x:book>
</catalog>
Validation failed on sl-notValid.xml
====================================
Reason: Element '{urn:book}cost' is unexpected according to content model of parent element '{urn:book}book'.
Expecting: {urn:book}price.
Source: <x:cost>44.95</x:cost>
Line: 10
This is because the correct and valid name for the element in use at this location in the XML documents is <x:price/>
, not <x:cost/>
.