private void setupResources(List<ResourceType> resources)
			throws ParsingException {
		if (resources.size() != 1) {
			// TODO
			throw new ParsingException(
					"XACML 2.0 support for multiple resources not yet supported");
		}
		ResourceType resource = resources.get(0);
		mapAttributes(resource.getAttribute(), resourceMap);

		// make sure there resource-id attribute was included
		if (!resourceMap.containsKey(RESOURCE_ID)) {
			System.err.println("Resource must contain resource-id attr");
			throw new ParsingException("resource missing resource-id");
		} else {
			// make sure there's only one value for this
			Set<AttributeType> set = resourceMap.get(RESOURCE_ID);
			if (set.size() > 1) {
				System.err.println("Resource may contain only one "
						+ "resource-id Attribute");
				throw new ParsingException("too many resource-id attrs");
			} else {
				resourceId = new StringAttribute("THIS SHOULD NEVER BE NEEDED. BLAME MAARTEN IF THIS GIVES AN ERROR"); // vuile performantie verbetering
//				try {
//					// keep track of the resource-id attribute
//					AttributeType attr = set.iterator().next();
//					resourceId = AttributeValue.convertFromJAXB(
//							attr.getAttributeValue(),
//							new URI(attr.getDataType()));
//				} catch (URISyntaxException ex) {
//					throw new RuntimeException(ex);
//				}
			}
		}

		// see if a resource-scope attribute was included
		if (resourceMap.containsKey(RESOURCE_SCOPE)) {
			Set<AttributeType> set = resourceMap.get(RESOURCE_SCOPE);

			// make sure there's only one value for resource-scope
			if (set.size() > 1) {
				System.err.println("Resource may contain only one "
						+ "resource-scope Attribute");
				throw new ParsingException("too many resource-scope attrs");
			}

			AttributeType attr = set.iterator().next();
			AttributeValueType attrValue = attr.getAttributeValue().get(0); // TODO:
																			// XACML2
																			// can
																			// have
																			// multiple
																			// AttributeValues
																			// in
																			// an
																			// Attribute

			// scope must be a string, so throw an exception otherwise
			if (!attr.getDataType().equals(StringAttribute.identifier))
				throw new ParsingException("scope attr must be a string");

			String value = attrValue.getContent().get(0).toString();

			if (value.equals("Immediate")) {
				scope = SCOPE_IMMEDIATE;
			} else if (value.equals("Children")) {
				scope = SCOPE_CHILDREN;
			} else if (value.equals("Descendants")) {
				scope = SCOPE_DESCENDANTS;
			} else {
				System.err.println("Unknown scope type: " + value);
				throw new ParsingException("invalid scope type: " + value);
			}
		} else {
			// by default, the scope is always Immediate
			scope = SCOPE_IMMEDIATE;
		}
	}