I\'m trying to use XML Includes to help manage a large XML structure that needs to be usable by both humans and machines.
But am experiencing a myriad of problems wh
As skaffman already pointed out, XML Schema and XInclude are not compatible.
The validation error message from xmllint states this clearly:
main.xml:9: element include: Schemas validity error : Element '{http://www.w3.org/2001/XInclude}include': This element is not expected. Expected is ( {http://www.example.com/main}child ).
main.xml fails to validate
To quote the W3C Recommendation: "XInclude defines no relationship to the augmented infosets produced by applying an XML schema. Such an augmented infoset can be supplied as the input infoset, or such augmentation might be applied to the infoset resulting from the inclusion."
Thus you should first construct the whole XML file by applying the XIncludes, and validate this file afterwards.
Edit: You can use xmllint with --xinclude to validate main.xml.