List of usage examples for org.w3c.dom DOMException INVALID_ACCESS_ERR
short INVALID_ACCESS_ERR
To view the source code for org.w3c.dom DOMException INVALID_ACCESS_ERR.
Click Source Link
From source file:Main.java
/** * Serialise the supplied W3C DOM subtree. * * @param nodeList The DOM subtree as a NodeList. * @param format Format the output.// ww w . j av a2 s . c o m * @param writer The target writer for serialization. * @throws DOMException Unable to serialise the DOM. */ public static void serialize(NodeList nodeList, boolean format, Writer writer) throws DOMException { if (nodeList == null) { throw new IllegalArgumentException("null 'subtree' NodeIterator arg in method call."); } try { TransformerFactory factory = TransformerFactory.newInstance(); Transformer transformer; if (format) { try { factory.setAttribute("indent-number", new Integer(4)); } catch (Exception e) { // Ignore... Xalan may throw on this!! // We handle Xalan indentation below (yeuckkk) ... } } transformer = factory.newTransformer(); transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes"); if (format) { transformer.setOutputProperty(OutputKeys.INDENT, "yes"); transformer.setOutputProperty("{http://xml.apache.org/xalan}indent-amount", "4"); } int listLength = nodeList.getLength(); // Iterate through the Node List. for (int i = 0; i < listLength; i++) { Node node = nodeList.item(i); if (isTextNode(node)) { writer.write(node.getNodeValue()); } else if (node.getNodeType() == Node.ATTRIBUTE_NODE) { writer.write(((Attr) node).getValue()); } else if (node.getNodeType() == Node.ELEMENT_NODE) { transformer.transform(new DOMSource(node), new StreamResult(writer)); } } } catch (Exception e) { DOMException domExcep = new DOMException(DOMException.INVALID_ACCESS_ERR, "Unable to serailise DOM subtree."); domExcep.initCause(e); throw domExcep; } }
From source file:org.exist.dom.ElementImpl.java
/** * Constructor for the ElementImpl object * * @param nodeName Description of the Parameter *///ww w . j a va 2 s . c om public ElementImpl(QName nodeName, SymbolTable symbols) throws DOMException { super(Node.ELEMENT_NODE, nodeName); this.nodeName = nodeName; if (symbols.getSymbol(nodeName.getLocalName()) < 0) { throw new DOMException(DOMException.INVALID_ACCESS_ERR, "Too many element/attribute names registered in the database. No of distinct names is limited to 16bit. Aborting store."); } }
From source file:org.structr.web.entity.dom.DOMNode.java
protected void checkReadAccess() throws DOMException { if (securityContext.isVisible(this) || isGranted(Permission.read, securityContext)) { return;//from w ww .ja v a 2s .c o m } throw new DOMException(DOMException.INVALID_ACCESS_ERR, INVALID_ACCESS_ERR_MESSAGE); }