Validate an XSD Schema?

前端 未结 5 894
無奈伤痛
無奈伤痛 2021-01-31 15:50

I\'m writing an XML schema (an XSD) to describe the format our partners should send us data in.

And I\'m having a hard time finding a tool that can validate the XSD sche

5条回答
  •  暗喜
    暗喜 (楼主)
    2021-01-31 16:39

    cd /the/dir/with/your/schema
    curl -O https://www.w3.org/2012/04/XMLSchema.xsd
    xmllint.exe --noout --schema XMLSchema.xsd 
    

    In *nix (including git-bash or similar on Windows), if the schema is valid then $? == 0 else $? == 1. I'm sure there is some powershell equivalent ...

    This came from a comment by @AlexanderKjäll to an answer by @lavinio elsewhere here. I added my own comment to say @AlexanderKjäll should add this as an answer. However (for me atleast), it wasn't quite correct since it won't work using the remote file URI. And thus my answer. If you upvote this could you please upvote their comment.

提交回复
热议问题