schematron

Which Schematron version does libxml2 implement?

。_饼干妹妹 提交于 2019-12-11 13:44:25
问题 Libxml2 comes with a Schematron module. Since Schematron evolved quite a bit I am wondering what version the libxml2 implementation roughly matches. 回答1: From a quick look at the source code, libxml2 uses the namespace http://purl.oclc.org/dsdl/schematron which means ISO Schematron (2006). But there's a TODO comment saying divergences between the draft and the ISO proposed standard :-( There don't seem to be any changes to the source code that address this. So it's possible that libxml2 only

How do I write this Schematron validation test for XML snippet?

一曲冷凌霜 提交于 2019-12-11 05:53:11
问题 I have an XML snippet as such: <AAA> <Field name="a"/> <Field name="b"/> <Field name="x"/> <User id="x" id2="f"/> <User id="y"/> </AAA> <AAA> <Field name="r"/> <Field name="z"/> </AAA> I need rule such that if the User tag exists, it should check to see if the Attribute values of id and id2 exist under the name Attribute of a Field. So in the first AAA tag, it will validate and give 2 errors because "f" doesn't exist as a field name and neither does "y" . The AAA tags don't always have User

schematron report issue with python lxml

六月ゝ 毕业季﹏ 提交于 2019-12-11 03:11:26
问题 I'm validating xml documents with the lxml schematron module. It works well but I can't display the validation report, which is set as a property. I can't find how to process it as an XML tree. Here the snippet of the code I use: xdoc = etree.parse("mydoc.xml") # schematron code removed for clarity f = StringIO.StringIO('''<schema>...</schema>''') sdoc = etree.parse(f) schematron = isoschematron.Schematron(sdoc, store_schematron=True, store_xslt=True, store_report=True) if schematron.validate

Validate an XML against a Schematron using PHP

坚强是说给别人听的谎言 提交于 2019-12-10 19:15:44
问题 There are a lot of resources about Schematron... however I cant find anything related or an example on how to validate an xml against a Schematront .sch file. Anyone? I already found 1 or 2 very old classes that return errors... so if anyone knows how to do this, please help. 回答1: I use the 'ANT' option.. Build.xml <project name="myName" default="all" basedir="."> <taskdef name="schematron" classname="com.schematron.ant.SchematronTask" classpath="lib/ant-schematron-2010-04-14.jar;lib/saxon9he

How to perform schematron validation using Saxon java library command line tool?

此生再无相见时 提交于 2019-12-07 12:24:42
问题 Very basic question- I've a xml file and I want to validate it against a schematron file. How do I do it using Saxon command line? As per commandline reference I don't see any option to specify schematron file. 回答1: Expanding on the previous answer because I needed to do this and it didn't give enough info (and since my script is already doing a dozen XSL transforms - what's four more?) Based on this website an XML file can be validated against a schematron through a series of XSL

Identify xml text elements with Schematron

笑着哭i 提交于 2019-12-06 17:39:17
Is it possible to make a rule in XPath which identifies xml elements like this one: <A>something...<A> ? I am using Schematron and I need to specify that some elements must not have children like the one in the example, that's why I need to identify them. Thanks in advance For the following input: <?xml version="1.0" encoding="utf-8"?> <root> <a>Only Text</a> <a><b>Child node</b></a> <a><b>Child node</b>Mixed content</a> </root> These Schematron rules should do what you want: <?xml version="1.0" encoding="UTF-8"?> <iso:schema xmlns:iso="http://purl.oclc.org/dsdl/schematron"> <iso:pattern id=

Validating XSD Schema with Schematron and xsltproc

强颜欢笑 提交于 2019-12-06 14:20:36
I'm having difficulty validating an SXD schema combined with Schematron. Following the steps described in this guide I've incorporated schematron between the <xs:appinfo> tags in an XSD document as follows: <?xml version="1.0" encoding="UTF-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:element name="Test"> <xs:annotation> <xs:appinfo> <sch:pattern name="Testing schematron" xmlns:sch="http://purl.oclc.org/dsdl/schematron"> <sch:rule context="Test"> <sch:assert test="@Attribute1">Attribute 1 exists</sch:assert> </sch:rule> </sch:pattern> </xs:appinfo> </xs:annotation> <xs

Validate XML with Schematron in PHP 5

与世无争的帅哥 提交于 2019-12-06 07:12:36
问题 I have a problem with validating XML with schematron. In my code I load the XML and XSL as DOMDocument objects and I try to transform: $domSche = new DOMDocument(); $domSche->loadXML($message); $domXSLSche = new DOMDocument(); $domXSLSche->load("CI-SIS_StructurationCommuneCDAr2.xsl"); $xsltsche = new XSLTProcessor(); $xsltsche->importStylesheet($domXSLSche); $XSLValid = $xsltsche->transformToXml($domSche); But the function returns this error: XSLTProcessor::transformToXml(): No stylesheet

Using SAXON 9.5 (nuget) with Schematron

核能气质少年 提交于 2019-12-06 07:01:54
问题 I am running this code: string path = AppDomain.CurrentDomain.BaseDirectory; // Uri schemaUri = new Uri(@"file:\\" + path + @"\sch\patient.sch"); Uri totransformEE = new Uri(@"file:\\" + path + @"\po\po-schema.sch"); Uri transformER = new Uri(@"file:\\" + path + @"\xsl\conformance1-5.xsl"); /////////////////////////////// // Crate Schemtron xslt to be applied /////////////////////////////// // Create a Processor instance. Processor processor = new Processor(); // Load the source document

How to perform schematron validation using Saxon java library command line tool?

为君一笑 提交于 2019-12-06 01:56:58
Very basic question- I've a xml file and I want to validate it against a schematron file. How do I do it using Saxon command line? As per commandline reference I don't see any option to specify schematron file. Expanding on the previous answer because I needed to do this and it didn't give enough info (and since my script is already doing a dozen XSL transforms - what's four more?) Based on this website an XML file can be validated against a schematron through a series of XSL transformations. Since I also needed information on how to combine with saxon - here are the modifications for saxon,