@ Nonnull public PSPattern readPatternFromXML ( @ Nonnull final IMicroElement ePattern ) { final PSPattern ret = new PSPattern ( ) ; final PSRichGroup aRichGroup = new PSRichGroup ( ) ; ePattern . forAllAttributes ( ( sNS , sAttrName , sVal ) -> { final String sAttrValue = _getAttributeValue ( sVal ) ; if ( sAttrName . equals ( CSchematronXML . ATTR_ABSTRACT ) ) ret . setAbstract ( StringParser . parseBool ( sAttrValue ) ) ; else if ( sAttrName . equals ( CSchematronXML . ATTR_ID ) ) ret . setID ( sAttrValue ) ; else if ( sAttrName . equals ( CSchematronXML . ATTR_IS_A ) ) ret . setIsA ( sAttrValue ) ; else if ( PSRichGroup . isRichAttribute ( sAttrName ) ) _handleRichGroup ( sAttrName , sAttrValue , aRichGroup ) ; else ret . addForeignAttribute ( sAttrName , sAttrValue ) ; } ) ; ret . setRich ( aRichGroup ) ; ePattern . forAllChildElements ( ePatternChild -> { if ( CSchematron . NAMESPACE_SCHEMATRON . equals ( ePatternChild . getNamespaceURI ( ) ) ) { if ( ePatternChild . getLocalName ( ) . equals ( CSchematronXML . ELEMENT_INCLUDE ) ) ret . addInclude ( readIncludeFromXML ( ePatternChild ) ) ; else if ( ePatternChild . getLocalName ( ) . equals ( CSchematronXML . ELEMENT_TITLE ) ) ret . setTitle ( readTitleFromXML ( ePatternChild ) ) ; else if ( ePatternChild . getLocalName ( ) . equals ( CSchematronXML . ELEMENT_P ) ) ret . addP ( readPFromXML ( ePatternChild ) ) ; else if ( ePatternChild . getLocalName ( ) . equals ( CSchematronXML . ELEMENT_LET ) ) ret . addLet ( readLetFromXML ( ePatternChild ) ) ; else if ( ePatternChild . getLocalName ( ) . equals ( CSchematronXML . ELEMENT_RULE ) ) ret . addRule ( readRuleFromXML ( ePatternChild ) ) ; else if ( ePatternChild . getLocalName ( ) . equals ( CSchematronXML . ELEMENT_PARAM ) ) ret . addParam ( readParamFromXML ( ePatternChild ) ) ; else _warn ( ret , "Unsupported Schematron element '" + ePatternChild . getLocalName ( ) + "' in " + ret . toString ( ) ) ; } else ret . addForeignElement ( ePatternChild . getClone ( ) ) ; } ) ; return ret ; }
Read a &lt ; pattern&gt ; element