如何使用xml schema和libxml2库对多个xml文件中的数据关系进行验证

我想用xml schema对一个已有的xml文件进行验证,不光是验证xml文件的格式,也包括xml文件中的数据关系。比如,有两个xml文件

<?xml version="1.0" encoding="UTF-8"?>
<Channel Id="1">
        <Destination Name="A" />
        <Source Name="B"/>
</Channel>

<?xml version="1.0" encoding="UTF-8"?>
<Channel Id="2">
        <Destination Name="B"/>
        <Source Name="A" />
</Channel>

这里要求,A是1号Channel的目的地,那么就一定要是2号Channel的源,对于B来说也是这样的。能否使用libxml2库中的函数以及xml schema来验证这两个xml文件中的数据关系呢?需要使用那些接口函数呢?请教

(由于其他原因,这两个xml文件不能合并成为一个xml文件)