XInclude Schema/Namespace Validation?

后端 未结 4 1128
遥遥无期
遥遥无期 2021-01-19 14:07

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

4条回答
  •  醉酒成梦
    2021-01-19 14:53

    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.

提交回复
热议问题