请记住,schemaLocation中的模式uri是在Schemas数据库而不是在网络中解决的。
说实话,我认为在MarkLogic中最简单的方法是根本不使用xsi:schemaLocation属性,而是在xqy中显式导入架构(使用import schema
语句),以确保找到它正确。
顺便说一下,约书亚对Schematron的看法是正确的。 validate
语句不执行Schematron验证。但是,MarkLogic确实提供了schematron支持,您可以手动应用它:
https://docs.marklogic.com/schematron
该模式大致如下。首先,将schematron和架构上载到架构数据库中。然后,您需要使用类似以下的命令来编译schematron文件:
xquery version "1.0-ml";
import module namespace schematron = "http://marklogic.com/xdmp/schematron"
at "/MarkLogic/schematron/schematron.xqy";
schematron:put("/schematron.sch")
此后,您将使用导入架构并进行验证以进行架构和schematron验证。像这样:
import schema namespace mods = "http://www.loc.gov/mods/v3" at "/mods-3-6.xsd";
import module namespace schematron = "http://marklogic.com/xdmp/schematron"
at "/MarkLogic/schematron/schematron.xqy";
let $xml := <mods version="3.3" xmlns="http://www.loc.gov/mods/v3">
<titleInfo>
<title>FranUlmer.com -- Home Page</title>
</titleInfo>
<titleInfo type="alternative">
<title>Fran Ulmer,Democratic candidate for Governor,Alaska,2002</title>
</titleInfo>
<name type="personal">
<namePart>Ulmer,Fran</namePart>
</name>
<genre>Website</genre>
<originInfo>
<dateCaptured point="start" encoding="iso8601">20020702 </dateCaptured>
<dateCaptured point="end" encoding="iso8601"> 20021203</dateCaptured>
</originInfo>
<language>
<languageTerm authority="iso639-2b">eng</languageTerm>
</language>
<physicalDescription>
<internetMediaType>text/html</internetMediaType>
<internetMediaType>image/jpg</internetMediaType>
</physicalDescription>
<abstract>Website promoting the candidacy of Fran Ulmer,2002. Includes candidate biography,issue position statements,campaign contact information,privacy policy and campaign news press releases. Site features enable visitors to sign up for campaign email list,volunteer,make campaign contributions and follow links to other internet locations. </abstract>
<subject>
<topic>Elections</topic>
<geographic>Alaska</geographic>
</subject>
<subject>
<topic>Governors</topic>
<geographic>Alaska</geographic>
<topic>Election</topic>
</subject>
<subject>
<topic>Democratic Party (AK)</topic>
</subject>
<relatedItem type="host">
<titleInfo>
<title>Election 2002 Web Archive</title>
</titleInfo>
<location>
<url>http://www.loc.gov/minerva/collect/elec2002/</url>
</location>
</relatedItem>
<location>
<url displayLabel="Active site (if available)">http://www.franulmer.com/</url>
</location>
<location>
<url displayLabel="Archived site">http://wayback-cgi1.alexa.com/e2002/*/http://www.franulmer.com/</url>
</location>
</mods>
return
schematron:validate(
validate strict { $xml},schematron:get("/schematron.sch")
)
HTH!
本文链接:https://www.f2er.com/3150696.html