@Override
	protected void generateTheory(InputStream ins) throws ParserException {
		try {
			if (null == theoryUnmarshaller) theoryUnmarshaller = XjcUtilities.getTheoryUnmarshaller();

			Theory cTheory = (Theory) theoryUnmarshaller.unmarshal(ins);

			theory = new spindle.core.dom.Theory();
			ruleCounter = 0;

			theory.setDescription(cTheory.getDescription());

			List<Object> factOrRule = cTheory.getFactOrRule();
			for (Object obj : factOrRule) {
				if (obj instanceof CtRule) {
					spindle.core.dom.Rule newRule = generateRule((CtRule) obj);
					if (newRule.getLabel().startsWith(TEMP_RULE_LABEL)) addPendingRule(newRule);
					else theory.addRule(newRule);
				} else if (obj instanceof CtLiteral) {
					spindle.core.dom.Rule newRule = generateFact((CtLiteral) obj);
					if (newRule.getLabel().startsWith(TEMP_RULE_LABEL)) addPendingRule(newRule);
					else theory.addFact(newRule);
				} else {
					throw new ParserException("unknown class in fact or rule: " + obj.getClass().getName());
				}
			}

			generateSuperiority(cTheory.getSuperiority());
			generateModeConversionRules(cTheory.getConvert());
			generateModeConflictRules(cTheory.getConflict());
			generateModeExclusionRules(cTheory.getExclude());
			generateLiteralVariablePair(cTheory.getLiteralVariable());
			generateLiteralBooleanFunctionPair(cTheory.getLiteralBooleanFunction());
		} catch (Exception e) {
			theory = null;
			throw new ParserException(e);
		}
	}