@ Nonnull public PSDiagnostic readDiagnosticFromXML ( @ Nonnull final IMicroElement eDiagnostic ) { final PSDiagnostic ret = new PSDiagnostic ( ) ; final PSRichGroup aRichGroup = new PSRichGroup ( ) ; eDiagnostic . forAllAttributes ( ( sNS , sAttrName , sVal ) -> { final String sAttrValue = _getAttributeValue ( sVal ) ; if ( sAttrName . equals ( CSchematronXML . ATTR_ID ) ) ret . setID ( sAttrValue ) ; else if ( PSRichGroup . isRichAttribute ( sAttrName ) ) _handleRichGroup ( sAttrName , sAttrValue , aRichGroup ) ; else ret . addForeignAttribute ( sAttrName , sAttrValue ) ; } ) ; ret . setRich ( aRichGroup ) ; eDiagnostic . forAllChildren ( aDiagnosticChild -> { switch ( aDiagnosticChild . getType ( ) ) { case TEXT : ret . addText ( ( ( IMicroText ) aDiagnosticChild ) . getNodeValue ( ) ) ; break ; case ELEMENT : final IMicroElement eElement = ( IMicroElement ) aDiagnosticChild ; if ( CSchematron . NAMESPACE_SCHEMATRON . equals ( eElement . getNamespaceURI ( ) ) ) { final String sLocalName = eElement . getLocalName ( ) ; 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: " + aDiagnosticChild ) ; } } ) ; return ret ; }
Read a &lt ; diagnostic&gt ; element