示例#1
0
 /**
  * Parses XML from the given text and generates CLUE game data.
  *
  * @param ccgXML XML text to parse
  * @return the generated CLUE game data
  */
 public static ClueGameData readFromString(String ccgXML) {
   try {
     XMLTag rootTag = XMLReader.parseXML(ccgXML);
     return readFromXMLRootTag(rootTag);
   } catch (XMLException ex) {
     Messenger.error(ex, "Invalid XML: " + ccgXML, "CCG String Read Error");
     return null;
   }
 }
示例#2
0
  /**
   * Parses XML from a given file and generates CLUE game data.
   *
   * @param gameFile XML file to parse
   * @return the generated CLUE game data
   */
  public static ClueGameData readFromFile(File gameFile) {
    if (gameFile == null) return null;

    try {
      XMLTag rootTag = XMLReader.parseXMLFile(gameFile);
      return readFromXMLRootTag(rootTag);
    } catch (XMLException ex) {
      Messenger.error(
          ex, "Corrupted or invalid XML Custom Clue Game file: " + gameFile, "CCG File Read Error");
      return null;
    }
  }