List of usage examples for org.w3c.dom DOMException NOT_SUPPORTED_ERR
short NOT_SUPPORTED_ERR
To view the source code for org.w3c.dom DOMException NOT_SUPPORTED_ERR.
Click Source Link
From source file:Main.java
/** * Obtains DOMImpementaton interface providing a number of methods for performing * operations that are independent of any particular DOM instance. * * @throw DOMException <code>NOT_SUPPORTED_ERR</code> if cannot get DOMImplementation * @throw FactoryConfigurationError Application developers should never need to directly catch errors of this type. * * @return DOMImplementation implementation *//* w w w . j av a 2s . c o m*/ private static DOMImplementation getDOMImplementation() throws DOMException { //can be made public DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); try { return factory.newDocumentBuilder().getDOMImplementation(); } catch (ParserConfigurationException ex) { throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Cannot create parser satisfying configuration parameters"); //NOI18N } }
From source file:XMLUtil.java
public static Document createDocument(String rootQName) throws DOMException { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); try {/*from ww w .java 2s . c o m*/ return factory.newDocumentBuilder().getDOMImplementation().createDocument(null, rootQName, null); } catch (ParserConfigurationException ex) { throw (DOMException) new DOMException(DOMException.NOT_SUPPORTED_ERR, "Cannot create parser") .initCause(ex); // NOI18N } }
From source file:com.marklogic.dom.NodeImpl.java
/** * {@inheritDoc}// ww w .j a v a2 s .c o m */ public short compareDocumentPosition(Node other) throws DOMException { if (other instanceof NodeImpl) { NodeImpl otherNode = (NodeImpl) other; if (this.tree == otherNode.tree) { if (tree.nodeOrdinal[node] > tree.nodeOrdinal[otherNode.node]) { int ancestor = tree.nodeParentNodeRepID[node]; while (ancestor != Integer.MAX_VALUE && tree.nodeOrdinal[ancestor] >= tree.nodeOrdinal[otherNode.node]) { if (ancestor == otherNode.node) return DOCUMENT_POSITION_CONTAINS | DOCUMENT_POSITION_PRECEDING; ancestor = tree.nodeParentNodeRepID[ancestor]; } return DOCUMENT_POSITION_PRECEDING; } else { int ancestor = tree.nodeParentNodeRepID[otherNode.node]; while (ancestor != Integer.MAX_VALUE && tree.nodeOrdinal[ancestor] <= tree.nodeOrdinal[otherNode.node]) { if (ancestor == node) return DOCUMENT_POSITION_CONTAINED_BY | DOCUMENT_POSITION_FOLLOWING; ancestor = tree.nodeParentNodeRepID[ancestor]; } return DOCUMENT_POSITION_FOLLOWING; } } else { return DOCUMENT_POSITION_DISCONNECTED; } } else { throw new DOMException(DOMException.NOT_SUPPORTED_ERR, null); } }
From source file:com.marklogic.dom.NodeImpl.java
/** Unsupported. */ public Object getUserData(String key) { throw new DOMException(DOMException.NOT_SUPPORTED_ERR, null); }
From source file:com.marklogic.dom.NodeImpl.java
/** Unsupported. */ public Object setUserData(String key, Object data, UserDataHandler handler) { throw new DOMException(DOMException.NOT_SUPPORTED_ERR, null); }
From source file:Main.java
/** * Obtains DOMImpementaton interface providing a number of methods for * performing operations that are independent of any particular DOM * instance.//from w ww . j a v a 2 s. c o m * * @throw DOMException <code>NOT_SUPPORTED_ERR</code> if cannot get * DOMImplementation * @throw FactoryConfigurationError Application developers should never need * to directly catch errors of this type. * * @return DOMImplementation implementation */ private static DOMImplementation getDOMImplementation() throws DOMException { //can be made public DocumentBuilderFactory factory = getFactory(false, false); try { return factory.newDocumentBuilder().getDOMImplementation(); } catch (ParserConfigurationException ex) { throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Cannot create parser satisfying configuration parameters"); //NOI18N } catch (RuntimeException e) { // E.g. #36578, IllegalArgumentException. Try to recover gracefully. throw (DOMException) new DOMException(DOMException.NOT_SUPPORTED_ERR, e.toString()).initCause(e); } }
From source file:DomPrintUtil.java
public TreeWalkerImpl(Node root, int whatToShow, NodeFilter filter, boolean entityReferenceExpansion) throws DOMException { if (null == root) { throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Root can't be a null."); }/*from w w w. j a v a2 s . c o m*/ this.walkerRoot = root; this.current = root; this.whatToShow = whatToShow; this.filter = filter; this.noFilter = (null == filter); this.entitiyReferenceExpansion = entityReferenceExpansion; this.defaultFilter = new WhatToShowNodeFilter(whatToShow); }
From source file:org.structr.web.entity.dom.DOMNode.java
protected void checkIsChild(Node otherNode) throws DOMException { if (otherNode instanceof DOMNode) { Node _parent = otherNode.getParentNode(); if (!isSameNode(_parent)) { throw new DOMException(DOMException.NOT_FOUND_ERR, NOT_FOUND_ERR_MESSAGE); }/*from w w w. j ava 2 s.c o m*/ // validation successful return; } throw new DOMException(DOMException.NOT_SUPPORTED_ERR, NOT_SUPPORTED_ERR_MESSAGE); }
From source file:org.structr.web.entity.dom.DOMNode.java
protected void checkHierarchy(Node otherNode) throws DOMException { // we can only check DOMNodes if (otherNode instanceof DOMNode) { // verify that the other node is not this node if (isSameNode(otherNode)) { throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR, HIERARCHY_REQUEST_ERR_MESSAGE_SAME_NODE); }/*from w ww .j av a 2 s.c o m*/ // verify that otherNode is not one of the // the ancestors of this node // (prevent circular relationships) Node _parent = getParentNode(); while (_parent != null) { if (_parent.isSameNode(otherNode)) { throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR, HIERARCHY_REQUEST_ERR_MESSAGE_ANCESTOR); } _parent = _parent.getParentNode(); } // TODO: check hierarchy constraints imposed by the schema // validation sucessful return; } throw new DOMException(DOMException.NOT_SUPPORTED_ERR, NOT_SUPPORTED_ERR_MESSAGE); }
From source file:com.gargoylesoftware.htmlunit.javascript.host.html.HTMLDocument.java
/** * Implementation of the {@link org.w3c.dom.events.DocumentEvent} interface's * {@link org.w3c.dom.events.DocumentEvent#createEvent(String)} method. The method creates an * uninitialized event of the specified type. * * @see <a href="http://www.w3.org/TR/DOM-Level-2-Events/events.html#Events-DocumentEvent">DocumentEvent</a> * @param eventType the event type to create * @return an event object for the specified type * @throws DOMException if the event type is not supported (will have a type of * DOMException.NOT_SUPPORTED_ERR) */// w ww . j a v a 2 s . c om @JsxFunction public Event createEvent(final String eventType) throws DOMException { Class<? extends Event> clazz = null; clazz = SUPPORTED_DOM2_EVENT_TYPE_MAP.get(eventType); if (clazz == null) { clazz = SUPPORTED_DOM3_EVENT_TYPE_MAP.get(eventType); } if (clazz == null) { if ("Events".equals(eventType) || "KeyEvents".equals(eventType) && getBrowserVersion().hasFeature(EVENT_TYPE_KEY_EVENTS) || "HashChangeEvent".equals(eventType) && getBrowserVersion().hasFeature(EVENT_TYPE_HASHCHANGEEVENT) || "BeforeUnloadEvent".equals(eventType) && getBrowserVersion().hasFeature(EVENT_TYPE_BEFOREUNLOADEVENT) || "PointerEvent".equals(eventType) && getBrowserVersion().hasFeature(EVENT_TYPE_POINTEREVENT) || "PopStateEvent".equals(eventType) || "ProgressEvent".equals(eventType) && getBrowserVersion().hasFeature(EVENT_TYPE_PROGRESSEVENT) || "XMLHttpRequestProgressEvent".equals(eventType) && getBrowserVersion().hasFeature(EVENT_TYPE_XMLHTTPREQUESTPROGRESSEVENT)) { clazz = SUPPORTED_VENDOR_EVENT_TYPE_MAP.get(eventType); } } if (clazz == null) { Context.throwAsScriptRuntimeEx( new DOMException(DOMException.NOT_SUPPORTED_ERR, "Event Type is not supported: " + eventType)); return null; // to stop eclipse warning } try { final Event event = clazz.newInstance(); event.setParentScope(getWindow()); event.setPrototype(getPrototype(clazz)); event.eventCreated(); return event; } catch (final InstantiationException e) { throw Context.reportRuntimeError("Failed to instantiate event: class ='" + clazz.getName() + "' for event type of '" + eventType + "': " + e.getMessage()); } catch (final IllegalAccessException e) { throw Context.reportRuntimeError("Failed to instantiate event: class ='" + clazz.getName() + "' for event type of '" + eventType + "': " + e.getMessage()); } }