php - How to define schematron in xml file to validate? -
i'm newbie in xml stuffs. answer simple struggling couple of days. ofcourse in stackoverflow solution don't know whether have enough knowledge in xml or understand it. so, here solution experts.
well, have xml file, dtd , sch file. using eclipse validate xml against dtd. don't know how validate xml against sch file.
sample xml file
<?xml version="1.0" encoding="utf-8"?> <!doctype sage-hubxml public "-//sage//dtd sage hub xml dtd v1.0 20111101/en" "sage-hubxml.dtd"> <sage-hubxml xmlns="http://www.w3.org/1999/xhtml" xmlns:xi="http://www.w3.org/2001/xinclude" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <body> </body> </sage-hubxml>
in this, have defined dtd file validate. don't know how define sch file validate. simplest way it? , use php validate xml against dtd.
php
$dom = new domdocument; $dom->load('sample.xml'); if ($dom->validate()) { echo "this document valid!\n"; } else{ echo "this document not valid!"; }
so, if can validate xml against sch using php, helpful
updates
in documentation, have mentioned oxygen xml editor,to validate against sch file. need else similar oxygen commerical tool.
i don't think can define schematron file xml schema (or dtd) , validate same way.
you have use php schematron library can process sch files, or transform sch files xslt files, xlst processor validate xml file.
Comments
Post a Comment