@ Nonnull public PSDir readDirFromXML ( @ Nonnull final IMicroElement eDir ) { final PSDir ret = new PSDir ( ) ; eDir . forAllAttributes ( ( sNS , sAttrName , sVal ) -> { final String sAttrValue = _getAttributeValue ( sVal ) ; if ( sAttrName . equals ( CSchematronXML . ATTR_VALUE ) ) ret . setValue ( EDirValue . getFromIDOrNull ( sAttrValue ) ) ; else ret . addForeignAttribute ( sAttrName , sAttrValue ) ; } ) ; eDir . forAllChildren ( aDirChild -> { switch ( aDirChild . getType ( ) ) { case TEXT : ret . addText ( ( ( IMicroText ) aDirChild ) . getNodeValue ( ) ) ; break ; case ELEMENT : final IMicroElement eElement = ( IMicroElement ) aDirChild ; if ( CSchematron . NAMESPACE_SCHEMATRON . equals ( eElement . getNamespaceURI ( ) ) ) { _warn ( ret , "Unsupported Schematron element '" + eElement . getLocalName ( ) + "'" ) ; } else ret . addForeignElement ( eElement . getClone ( ) ) ; break ; case COMMENT : // Ignore comments break ; default : _warn ( ret , "Unsupported child node: " + aDirChild ) ; } } ) ; return ret ; }
Read a &lt ; dir&gt ; element