private void createXMLBoxFromStandardNode(Node node) { NodeList children = node.getChildNodes(); String value = "<" + node.getNodeName() + ">"; for (int i = 0; i < children.getLength(); i++) { Node child = children.item(i); String name = child.getNodeName(); value += "<" + name + " "; NamedNodeMap map = child.getAttributes(); for (int j = 0; j < map.getLength(); j++) { Node att = map.item(j); value += att.getNodeName() + "=\"" + att.getNodeValue() + "\" "; } value += " />"; } value += "</" + node.getNodeName() + ">"; boxes.add(new XMLBox(value.getBytes())); }
/** * This method reads the contents of the XML box */ public void readXMLBox(int length) throws IOException { if (metadata != null) { byte[] data = new byte[length]; in.readFully(data, 0, length); metadata.addNode(new XMLBox(data)); } }