bufr/src/main/java/ucar/nc2/iosp/bufr/tables/CodeFlagTables.java
static private void init(Map<Short, CodeFlagTables> table) {
    String filename = BufrTables.RESOURCE_PATH + CodeFlagFilename;
    try (InputStream is = CodeFlagTables.class.getResourceAsStream(filename)) {
      SAXBuilder builder = new SAXBuilder();
      org.jdom2.Document tdoc = builder.build(is);
      org.jdom2.Element root = tdoc.getRootElement();

      List<Element> elems = root.getChildren();
      for (Element elem : elems) {
        String fxyS = elem.getChildText("FXY");
        String desc = elem.getChildText("ElementName_en");

        short fxy = Descriptor.getFxy2(fxyS);
        CodeFlagTables ct = table.get(fxy);
        if (ct == null) {
          ct = new CodeFlagTables(fxy, desc);
          table.put(fxy, ct);
          // System.out.printf(" added %s == %s %n", ct.id, desc);
        }

        String line = elem.getChildText("No");
        String codeS = elem.getChildText("CodeFigure");
        String value = elem.getChildText("EntryName_en");

        if ((codeS == null) || (value == null)) continue;
        if (value.toLowerCase().startsWith("reserved"))  continue;
        if (value.toLowerCase().startsWith("not used")) continue;

        int code;
        if (codeS.toLowerCase().contains("all")) {
          code = -1;
        } else try {
          code = Integer.parseInt(codeS);
        } catch (NumberFormatException e) {
          log.debug("NumberFormatException on line " + line + " in " + codeS);
          continue;
        }
        ct.addValue((short) code, value);
      }

    } catch (IOException|JDOMException e) {
      log.error("Can't read BUFR code table " + filename, e);
    }
  }
static private void init(Map<Short, CodeFlagTables> table) {
    String filename = BufrTables.RESOURCE_PATH + CodeFlagFilename;
    try (InputStream is = CodeFlagTables.class.getResourceAsStream(filename)) {
      SAXBuilder builder = new SAXBuilder();
      org.jdom2.Document tdoc = builder.build(is);
      org.jdom2.Element root = tdoc.getRootElement();

      List<Element> elems = root.getChildren();
      for (Element elem : elems) {
        String fxyS = elem.getChildText("FXY");
        String desc = elem.getChildText("ElementName_en");

        short fxy = Descriptor.getFxy2(fxyS);
        CodeFlagTables ct = table.get(fxy);
        if (ct == null) {
          ct = new CodeFlagTables(fxy, desc);
          table.put(fxy, ct);
          // System.out.printf(" added %s == %s %n", ct.id, desc);
        }

        String line = elem.getChildText("No");
        String codeS = elem.getChildText("CodeFigure");
        String value = elem.getChildText("EntryName_en");

        if ((codeS == null) || (value == null)) continue;
        if (value.toLowerCase().startsWith("reserved"))  continue;
        if (value.toLowerCase().startsWith("not used")) continue;

        int code;
        if (codeS.toLowerCase().contains("all")) {
          code = -1;
        } else try {
          code = Integer.parseInt(codeS);
        } catch (NumberFormatException e) {
          log.debug("NumberFormatException on line " + line + " in " + codeS);
          continue;
        }
        ct.addValue((short) code, value);
      }

    } catch (IOException|JDOMException e) {
      log.error("Can't read BUFR code table " + filename, e);
    }
  }
static private void init ( Map < Short , CodeFlagTables > table ) { String filename = BufrTables . RESOURCE_PATH + CodeFlagFilename ; try ( InputStream is = CodeFlagTables . class . getResourceAsStream ( filename ) ) { SAXBuilder builder = new SAXBuilder ( ) ; org . jdom2 . Document tdoc = builder . build ( is ) ; org . jdom2 . Element root = tdoc . getRootElement ( ) ; List < Element > elems = root . getChildren ( ) ; for ( Element elem : elems ) { String fxyS = elem . getChildText ( "FXY" ) ; String desc = elem . getChildText ( "ElementName_en" ) ; short fxy = Descriptor . getFxy2 ( fxyS ) ; CodeFlagTables ct = table . get ( fxy ) ; if ( ct == null ) { ct = new CodeFlagTables ( fxy , desc ) ; table . put ( fxy , ct ) ; // System.out.printf(" added %s == %s %n", ct.id, desc);
 } String line = elem . getChildText ( "No" ) ; String codeS = elem . getChildText ( "CodeFigure" ) ; String value = elem . getChildText ( "EntryName_en" ) ; if ( ( codeS == null ) || ( value == null ) ) continue ; if ( value . toLowerCase ( ) . startsWith ( "reserved" ) ) continue ; if ( value . toLowerCase ( ) . startsWith ( "not used" ) ) continue ; int code ; if ( codeS . toLowerCase ( ) . contains ( "all" ) ) { code = - 1 ; } else try { code = Integer . parseInt ( codeS ) ; } catch ( NumberFormatException e ) { log . debug ( "NumberFormatException on line " + line + " in " + codeS ) ; continue ; } ct . addValue ( ( short ) code , value ) ; } } catch ( IOException | JDOMException e ) { log . error ( "Can't read BUFR code table " + filename , e ) ; } }
/*
<Exp_CodeFlagTables_E>
<No>837</No>
<FXY>002119</FXY>
<ElementName_E>Instrument operations</ElementName_E>
<CodeFigure>0</CodeFigure>
<EntryName_E>Intermediate frequency calibration mode (IF CAL)</EntryName_E>
<Status>Operational</Status>
</Exp_CodeFlagTables_E>

<BUFRCREX_19_1_1_CodeFlag_en>
<No>2905</No>
<FXY>020042</FXY>
<ElementName_en>Airframe icing present</ElementName_en>
<CodeFigure>2</CodeFigure>
<EntryName_en>Reserved</EntryName_en>
<Status>Operational</Status>
</BUFRCREX_19_1_1_CodeFlag_en>

<BUFRCREX_22_0_1_CodeFlag_en>
<No>3183</No>
<FXY>020063</FXY>
<ElementName_en>Special phenomena</ElementName_en>
<CodeFigure>31</CodeFigure>
<EntryName_en>Slight coloration of clouds at sunrise associated with a tropical disturbance</EntryName_en>
<Status>Operational</Status>
</BUFRCREX_22_0_1_CodeFlag_en>
/ * <Exp_CodeFlagTables_E > <No > 837< / No > <FXY > 002119< / FXY > <ElementName_E > Instrument operations< / ElementName_E > <CodeFigure > 0< / CodeFigure > <EntryName_E > Intermediate frequency calibration mode ( IF CAL ) < / EntryName_E > <Status > Operational< / Status > < / Exp_CodeFlagTables_E >