Пример #1
0
 // Read a single field name & type, plus any enum/factor/level info
 private PMMLParser pDataField() {
   HashMap<String, String> attrs = expect("DataField").attrs();
   String name = attrs.get("name");
   _types.put(name, DataTypes.parse(attrs.get("dataType")));
   if (peek() == '/') return expect("/>");
   expect('>');
   ArrayList<String> str = new ArrayList();
   while (skipWS().expect('<').peek() != '/') str.add(pDataFieldValue());
   String[] ss = str.toArray(new String[0]);
   Arrays.sort(ss, null);
   _enums.put(name, ss);
   return expect("/DataField>");
 }
Пример #2
0
 // Any number of attributes, or '/' or '>'
 public HashMap<String, String> attrs() {
   HashMap<String, String> attrs = null;
   while (true) {
     int b = skipWS().peek();
     if (b == '/' || b == '>') return attrs;
     if (attrs == null) attrs = new HashMap();
     String attr = token();
     String val = skipWS().expect('=').str();
     attrs.put(attr, val);
   }
 }