docs: @SuppressWarnings({"checkstyle:nestedifdepth"})
  	public static int readResources(Element node, XMLResources resources) throws IOException {
  		int nb = 0;
  		if (resources != null) {
  			for (final Element resourceNode : getElementsFromPath(node, NODE_RESOURCES, NODE_RESOURCE)) {
  				try {
  					final String sid = getAttributeValue(resourceNode, ATTR_ID);
  					final long id = XMLResources.getNumericalIdentifier(sid);
  					final String mimeType = getAttributeValue(resourceNode, ATTR_MIMETYPE);
  					String ssource = getAttributeValue(resourceNode, ATTR_URL);
  					if (ssource != null && !"".equals(ssource)) { //$NON-NLS-1$
  						// Read URL resource
  						resources.add(id, new URL(ssource), mimeType);
  						++nb;
  					} else {
  						ssource = getAttributeValue(resourceNode, ATTR_FILE);
  						if (ssource != null && !"".equals(ssource)) { //$NON-NLS-1$
  							// Read File resource
  							final URL url = new URL(ssource);
  							final String path = url.getPath();
  							final StringBuilder b = new StringBuilder();
  							boolean addSlash = false;
  							for (final String elt : path.split("[/]")) { //$NON-NLS-1$
  								try {
  									if (addSlash) {
  										b.append(File.separator);
  									}
  									b.append(URLDecoder.decode(elt, Charset.defaultCharset().name()));
  								} catch (UnsupportedEncodingException e1) {
  									throw new Error(e1);
  								}
  								addSlash = true;
  							}
  							resources.add(id, new File(b.toString()), mimeType);
  							++nb;
  						} else {
  							// Read embedded resource
  							final CDATASection rawData = getChild(resourceNode, CDATASection.class);
  							if (rawData != null) {
  								final byte[] data = parseString(rawData.getData());
  								if (data != null) {
  									resources.add(id, data, mimeType);
  									++nb;
  								}
  							}
  						}
  					}
  				} catch (AssertionError e) {
  					throw e;
  				} catch (IOException e) {
  					throw e;
  				} catch (Throwable e) {
  					throw new IOException(e);
  				}
  			}
  		}
  		return nb;
  	}