ph-schematron/src/main/java/com/helger/schematron/pure/exchange/PSReader.java
@Nonnull
  public PSActive readActiveFromXML (@Nonnull final IMicroElement eActive)
  {
    final PSActive ret = new PSActive ();
    eActive.forAllAttributes ( (sNS, sAttrName, sVal) -> {
      final String sAttrValue = _getAttributeValue (sVal);
      if (sAttrName.equals (CSchematronXML.ATTR_PATTERN))
        ret.setPattern (sAttrValue);
      else
        ret.addForeignAttribute (sAttrName, sAttrValue);
    });

    eActive.forAllChildren (aActiveChild -> {
      switch (aActiveChild.getType ())
      {
        case TEXT:
          ret.addText (((IMicroText) aActiveChild).getNodeValue ());
          break;
        case ELEMENT:
          final IMicroElement eElement = (IMicroElement) aActiveChild;
          if (CSchematron.NAMESPACE_SCHEMATRON.equals (eElement.getNamespaceURI ()))
          {
            final String sLocalName = eElement.getLocalName ();
            if (sLocalName.equals (CSchematronXML.ELEMENT_DIR))
              ret.addDir (readDirFromXML (eElement));
            else
              if (sLocalName.equals (CSchematronXML.ELEMENT_EMPH))
                ret.addEmph (readEmphFromXML (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: " + aActiveChild);
      }
    });
    return ret;
  }
@Nonnull
  public PSActive readActiveFromXML (@Nonnull final IMicroElement eActive)
  {
    final PSActive ret = new PSActive ();
    eActive.forAllAttributes ( (sNS, sAttrName, sVal) -> {
      final String sAttrValue = _getAttributeValue (sVal);
      if (sAttrName.equals (CSchematronXML.ATTR_PATTERN))
        ret.setPattern (sAttrValue);
      else
        ret.addForeignAttribute (sAttrName, sAttrValue);
    });

    eActive.forAllChildren (aActiveChild -> {
      switch (aActiveChild.getType ())
      {
        case TEXT:
          ret.addText (((IMicroText) aActiveChild).getNodeValue ());
          break;
        case ELEMENT:
          final IMicroElement eElement = (IMicroElement) aActiveChild;
          if (CSchematron.NAMESPACE_SCHEMATRON.equals (eElement.getNamespaceURI ()))
          {
            final String sLocalName = eElement.getLocalName ();
            if (sLocalName.equals (CSchematronXML.ELEMENT_DIR))
              ret.addDir (readDirFromXML (eElement));
            else
              if (sLocalName.equals (CSchematronXML.ELEMENT_EMPH))
                ret.addEmph (readEmphFromXML (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: " + aActiveChild);
      }
    });
    return ret;
  }
@ Nonnull public PSActive readActiveFromXML ( @ Nonnull final IMicroElement eActive ) { final PSActive ret = new PSActive ( ) ; eActive . forAllAttributes ( ( sNS , sAttrName , sVal ) -> { final String sAttrValue = _getAttributeValue ( sVal ) ; if ( sAttrName . equals ( CSchematronXML . ATTR_PATTERN ) ) ret . setPattern ( sAttrValue ) ; else ret . addForeignAttribute ( sAttrName , sAttrValue ) ; } ) ; eActive . forAllChildren ( aActiveChild -> { switch ( aActiveChild . getType ( ) ) { case TEXT : ret . addText ( ( ( IMicroText ) aActiveChild ) . getNodeValue ( ) ) ; break ; case ELEMENT : final IMicroElement eElement = ( IMicroElement ) aActiveChild ; if ( CSchematron . NAMESPACE_SCHEMATRON . equals ( eElement . getNamespaceURI ( ) ) ) { final String sLocalName = eElement . getLocalName ( ) ; if ( sLocalName . equals ( CSchematronXML . ELEMENT_DIR ) ) ret . addDir ( readDirFromXML ( eElement ) ) ; else if ( sLocalName . equals ( CSchematronXML . ELEMENT_EMPH ) ) ret . addEmph ( readEmphFromXML ( 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: " + aActiveChild ) ; } } ) ; return ret ; }
Read an &lt;active&gt; element

@param eActive
The source micro element. Never <code>null</code>.
@return The created domain object. May not be <code>null</code>.
Read an &lt ; active&gt ; element