rootNode = index.getContentAsDOM(); Element rootElem = ((Element)rootNode); NodeList nl = rootElem.getChildNodes();
n = index.getContentAsDOM(); if (n instanceof Document) { doc=(Document)n; root=doc.getDocumentElement(); } else if (n instanceof Element) { doc = n.getOwnerDocument(); root=(Element)n; } nl = root.getChildNodes();
	public void testDOMUpdate() {		try {			XMLResource index = (XMLResource) rootColl.getResource(name);			{				System.out.println("Retrieving initial content:");				String content = (String) index.getContent();				System.out.println(content);			}			Node rootNode = index.getContentAsDOM();			Document doc = rootNode.getOwnerDocument();			Element schemaNode = doc.createElement("schema");			schemaNode.setAttribute("targetNamespace", "targetNamespace");			schemaNode.setAttribute("resourceName", "filename");						rootNode.appendChild(schemaNode);			index.setContentAsDOM(rootNode);			rootColl.storeResource(index);				System.out.println("Retrieving modified content:");			index = (XMLResource) rootColl.getResource(name);			String content = (String) index.getContent();			System.out.println(content);			rootNode = index.getContentAsDOM();			Element rootElem = ((Element)rootNode);			NodeList nl = rootElem.getChildNodes();			for (int i = 0; i < nl.getLength(); i++) {				System.out.println(nl.item(i).getNodeName());			}		} catch(Exception e) {						fail(e.getMessage());		}				}