@ Nonnull public PSAssertReport readAssertReportFromXML ( @ Nonnull final IMicroElement eAssertReport ) { final PSAssertReport ret = new PSAssertReport ( eAssertReport . getLocalName ( ) . equals ( CSchematronXML . ELEMENT_ASSERT ) ) ; final PSRichGroup aRichGroup = new PSRichGroup ( ) ; final PSLinkableGroup aLinkableGroup = new PSLinkableGroup ( ) ; eAssertReport . forAllAttributes ( ( sNS , sAttrName , sVal ) -> { final String sAttrValue = _getAttributeValue ( sVal ) ; if ( sAttrName . equals ( CSchematronXML . ATTR_TEST ) ) ret . setTest ( sAttrValue ) ; else if ( sAttrName . equals ( CSchematronXML . ATTR_FLAG ) ) ret . setFlag ( sAttrValue ) ; else if ( sAttrName . equals ( CSchematronXML . ATTR_ID ) ) ret . setID ( sAttrValue ) ; else if ( sAttrName . equals ( CSchematronXML . ATTR_DIAGNOSTICS ) ) ret . setDiagnostics ( sAttrValue ) ; else if ( PSRichGroup . isRichAttribute ( sAttrName ) ) _handleRichGroup ( sAttrName , sAttrValue , aRichGroup ) ; else if ( PSLinkableGroup . isLinkableAttribute ( sAttrName ) ) _handleLinkableGroup ( sAttrName , sAttrValue , aLinkableGroup ) ; else ret . addForeignAttribute ( sAttrName , sAttrValue ) ; } ) ; ret . setRich ( aRichGroup ) ; ret . setLinkable ( aLinkableGroup ) ; eAssertReport . forAllChildren ( aAssertReportChild -> { switch ( aAssertReportChild . getType ( ) ) { case TEXT : ret . addText ( ( ( IMicroText ) aAssertReportChild ) . getNodeValue ( ) ) ; break ; case ELEMENT : final IMicroElement eElement = ( IMicroElement ) aAssertReportChild ; if ( CSchematron . NAMESPACE_SCHEMATRON . equals ( eElement . getNamespaceURI ( ) ) ) { final String sLocalName = eElement . getLocalName ( ) ; if ( sLocalName . equals ( CSchematronXML . ELEMENT_NAME ) ) ret . addName ( readNameFromXML ( eElement ) ) ; else if ( sLocalName . equals ( CSchematronXML . ELEMENT_VALUE_OF ) ) ret . addValueOf ( readValueOfFromXML ( eElement ) ) ; else if ( sLocalName . equals ( CSchematronXML . ELEMENT_EMPH ) ) ret . addEmph ( readEmphFromXML ( eElement ) ) ; else if ( sLocalName . equals ( CSchematronXML . ELEMENT_DIR ) ) ret . addDir ( readDirFromXML ( eElement ) ) ; else if ( sLocalName . equals ( CSchematronXML . ELEMENT_SPAN ) ) ret . addSpan ( readSpanFromXML ( eElement ) ) ; else _warn ( ret , "Unsupported Schematron element '" + sLocalName + "'" ) ; } else ret . addForeignElement ( eElement . getClone ( ) ) ; break ; case COMMENT : // Ignore comments break ; default : _warn ( ret , "Unsupported child node: " + aAssertReportChild ) ; } } ) ; return ret ; }
Read an &lt ; assert&gt ; or a &lt ; report&gt ; element