Posted to tcl by aspect at Wed Jul 30 02:59:32 GMT 2014view raw

  1. # using example documents from http://msdn.microsoft.com/en-us/library/ms256129%28v=vs.110%29.aspx
  2.  
  3. % package require xml
  4. 3.3
  5. % set xsd [dom::parse [readfile po.xsd]]
  6. doc3
  7. % set xml [dom::parse [readfile po.xml]]
  8. doc4
  9. % set badxml [dom::parse [readfile badpo.xml]]
  10. doc5
  11. % $xsd schema compile
  12. % $xsd schema validate $xml
  13. % $xsd schema validate $badxml
  14. {schemas-validation error 1871 ::dom::doc5::node0 25 {Element '{http://tempuri.org/po.xsd}productName': This element is not expected. Expected is ( {http://tempuri.org/po.xsd}item ).
  15. } 0 0}
  16.