由于客户的要求,我需要生成一个新的XSD模式来验证向DITA主题文档添加一些信息的XML文档。或多或少的想法是有以下几点:
<?xml version="1.0" encoding="UTF-8"?>
<customdocument>
<custommetadata>
...
</custommetadata>
<topic>
<!-- Here it comes a complete valid DITA topic -->
</topic>
</customdocument>我对XSD的建议如下:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns="http://myNamespace"
targetNamespace="http://myNamespace"
elementFormDefault="qualified">
<xs:include schemaLocation="MetaInfo.xsd"></xs:include>
<xs:include schemaLocation=".\dita-v1.3-os\part3-all-inclusive\all-inclusive-grammars\schema-url\base\xsd\basetopic.xsd"></xs:include>
<xs:element name="customerdocument" type="customerdocumentType"></xs:element>
<xs:complexType name="customerdocumentType">
<xs:sequence>
<xs:element ref="custommetadata" minOccurs="1"></xs:element>
<xs:element ref="topic" minOccurs="1"></xs:element>
</xs:sequence>
</xs:complexType>
</xs:schema>XSD元素来自已经定义的custommetadata (MetaInfo.xsd)。另一方面,topic元素来自\dita-v1.3-os\part3-all-inclusive\all-inclusive-grammars\schema-url\base\xsd\basetopic.xsd (我认为它是DITA主题验证的根XSD )。
我尝试过验证一些文档,包括简单的DITA主题,它工作得很好。但是,对于包括<uicontrol>元素在内的更复杂的DITA主题,验证将失败。
Engine name: Xerces
Severity: error
Description: cvc-complex-type.2.4.a: Invalid content was found starting with element 'uicontrol'. One of '{dl, div, fig, imagemap, image, lines, lq, note, hazardstatement, object, ol, pre, simpletable, sl, table, ul, boolean, cite, keyword, ph, b, i, line-through, overline, sup, sub, tt, u, q, term, text, tm, xref, state, data, sort-as, data-about, foreign, unknown, draft-comment, fn, indextermref, indexterm, required-cleanup}' is expected.
Start location: 12:22
End location: 12:31
URL: http://www.w3.org/TR/xmlschema-1/#cvc-complex-type所以问题是,引用的XSD是否是验证DITA主题的正确入口点?DITA规范1.3包括大约153个XSD文件。
如果能得到一些帮助,我们将不胜感激。
发布于 2019-04-24 19:51:12
您应该尝试使用"schema\technicalContent\xsd\topic.xsd“中的打开项。
https://stackoverflow.com/questions/55811172
复制相似问题