Skip to content

Commit

Permalink
Using attribute group for rich attrs
Browse files Browse the repository at this point in the history
  • Loading branch information
phax committed Dec 29, 2021
1 parent b3ec9e7 commit 94a3fc4
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 17 deletions.
29 changes: 12 additions & 17 deletions ph-schematron-api/src/main/resources/schemas/svrl.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,7 @@
<xs:attribute name="context" type="xs:string" use="required"/>
<xs:attribute name="role" type="xs:NMTOKEN"/>
<xs:attribute name="flag" type="xs:NMTOKEN"/>
<!-- [ph] if 'allowForeignElements' is enabled the following three can occur: -->
<xs:attribute name="see" type="xs:string" use="optional"/>
<xs:attribute name="icon" type="xs:string" use="optional"/>
<xs:attribute name="fpi" type="xs:string" use="optional"/>
<xs:attributeGroup ref="svrl:attlist.rich"/>
</xs:complexType>
</xs:element>
<!-- only references are reported, not the diagnostic -->
Expand All @@ -83,12 +80,7 @@
<xs:element ref="svrl:text" minOccurs="0" maxOccurs="1"/>
</xs:sequence>
<xs:attribute name="diagnostic" use="required" type="xs:NMTOKEN"/>
<xs:attribute ref="xml:lang" use="optional" />
<xs:attribute ref="xml:space" use="optional" />
<!-- [ph] if 'allowForeignElements' is enabled the following three can occur: -->
<xs:attribute name="see" type="xs:string" use="optional"/>
<xs:attribute name="icon" type="xs:string" use="optional"/>
<xs:attribute name="fpi" type="xs:string" use="optional"/>
<xs:attributeGroup ref="svrl:attlist.rich"/>
</xs:complexType>
</xs:element>
<!-- only failed assertions are reported -->
Expand Down Expand Up @@ -131,9 +123,7 @@
<xs:complexType>
<xs:complexContent>
<xs:extension base="svrl:rich-text">
<xs:attribute name="see"/>
<xs:attribute name="icon"/>
<xs:attribute name="fpi"/>
<xs:attributeGroup ref="svrl:attlist.rich"/>
</xs:extension>
</xs:complexContent>
</xs:complexType>
Expand Down Expand Up @@ -178,16 +168,21 @@
<xs:any namespace="##local" processContents="skip"/>
</xs:choice>
</xs:group>
<xs:attributeGroup name="attlist.rich">
<xs:attribute ref="xml:lang" use="optional" />
<xs:attribute ref="xml:space" use="optional" />
<!-- [ph] if 'allowForeignElements' is enabled the following three can occur: -->
<xs:attribute name="see" type="xs:string" use="optional"/>
<xs:attribute name="icon" type="xs:string" use="optional"/>
<xs:attribute name="fpi" type="xs:string" use="optional"/>
</xs:attributeGroup>
<xs:attributeGroup name="attlist.assert-and-report">
<!-- [ph] changed from ID to NCName for real-life handling -->
<xs:attribute name="id" type="xs:NCName"/>
<xs:attribute name="location" use="required"/>
<xs:attribute name="test" use="required"/>
<xs:attribute name="role" type="xs:NMTOKEN"/>
<xs:attribute name="flag" type="xs:NMTOKEN"/>
<!-- [ph] if 'allowForeignElements' is enabled the following three can occur: -->
<xs:attribute name="see" type="xs:string" use="optional"/>
<xs:attribute name="icon" type="xs:string" use="optional"/>
<xs:attribute name="fpi" type="xs:string" use="optional"/>
<xs:attributeGroup ref="svrl:attlist.rich"/>
</xs:attributeGroup>
</xs:schema>
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,16 @@ public void onFiredRule (@Nonnull final PSRule aRule,
aRetRule.setId (aRule.getID ());
if (aRule.hasLinkable ())
aRetRule.setRole (aRule.getLinkable ().getRole ());
final PSRichGroup aRich = aRule.getRich ();
if (aRich != null)
{
aRetRule.setLang (aRich.getXmlLang ());
if (aRich.hasXmlSpace ())
aRetRule.setSpace (aRich.getXmlSpace ().getID ());
aRetRule.setIcon (aRich.getIcon ());
aRetRule.setSee (aRich.getSee ());
aRetRule.setFpi (aRich.getFPI ());
}
m_aSchematronOutput.getActivePatternAndFiredRuleAndFailedAssert ().add (aRetRule);
}

Expand Down

0 comments on commit 94a3fc4

Please sign in to comment.