/** * Gets the document URI from a Document instance if possible. * * @param doc the Document * @return the URI or null */ protected String getDocumentURI(Document doc) { String docURI = null; if (doc instanceof AbstractDocument) { AbstractDocument level3Doc = (AbstractDocument)doc; docURI = level3Doc.getDocumentURI(); } return docURI; }
/** * <b>DOM</b>: Implements {@link * org.w3c.dom.Document#getElementById(String)}. */ public Element getElementById(String id) { return getChildElementById(getDocumentElement(), id); }
/** * Deeply exports this node to the given document. * @param n The clone node. * @param d The destination document. */ protected Node deepExport(Node n, Document d) { throw createDOMException(DOMException.NOT_SUPPORTED_ERR, "import.document", new Object[] {}); }
public void updateIdEntry(Element e, String oldId, String newId) { if ((oldId == newId) || ((oldId != null) && (oldId.equals(newId)))) return; removeIdEntry(e, oldId); addIdEntry(e, newId); }
/** * Get the list of child nodes of this node in the fully flattened tree. */ public NodeList getXblChildNodes() { return ownerDocument.getXBLManager().getXblChildNodes(this); }
case MutationEvent.ADDITION: if (((AbstractAttr)node).isId()) ownerDocument.addIdEntry(this, newv); attrAdded(node, newv); break; ownerDocument.updateIdEntry(this, oldv, newv); attrModified(node, oldv, newv); break; ownerDocument.removeIdEntry(this, oldv); attrRemoved(node, oldv); if (doc.getEventsEnabled() && !oldv.equals(newv)) { DOMMutationEvent ev = (DOMMutationEvent) doc.createEvent("MutationEvents"); ev.initMutationEventNS(XMLConstants.XML_EVENTS_NAMESPACE_URI, "DOMAttrModified",
/** * Creates a SVG Document instance. * @param uri The document URI. * @param inp The document input stream. * @exception IOException if an error occured while reading the document. */ public Document createDocument(String uri, InputStream inp) throws IOException { Document doc; InputSource is = new InputSource(inp); is.setSystemId(uri); try { doc = super.createDocument (SVGDOMImplementation.SVG_NAMESPACE_URI, "svg", uri, is); if (uri != null) { ((SVGOMDocument)doc).setParsedURL(new ParsedURL(uri)); } AbstractDocument d = (AbstractDocument) doc; d.setDocumentURI(uri); d.setXmlStandalone(isStandalone); d.setXmlVersion(xmlVersion); } catch (MalformedURLException e) { throw new IOException(e.getMessage()); } return doc; }
/** * Clones an SVG DOM document. This is used for making SVG production thread-safe when the * SVG document is cached and re-used. * @param doc the SVG DOM to be cloned * @return the cloned SVG DOM */ public static Document cloneSVGDocument(Document doc) { Document clonedDoc = DOMUtilities.deepCloneDocument(doc, doc.getImplementation()); if (clonedDoc instanceof AbstractDocument) { ((AbstractDocument)clonedDoc).setDocumentURI(((AbstractDocument)doc).getDocumentURI()); } return clonedDoc; }
/** * Gets the boolean value. */ public boolean getBooleanValue() { if (resultType != BOOLEAN_TYPE) { throw createXPathException (XPathException.TYPE_ERR, "xpath.invalid.result.type", new Object[] {(int) resultType}); } return booleanValue; }
/** * Creates an exception with the appropriate error message. */ public XPathException createXPathException(short type, String key, Object[] args) { try { return new XPathException(type, formatMessage(key, args)); } catch (Exception e) { return new XPathException(type, key); } }
/** * <b>DOM</b>: Implements {@link SVGSVGElement#getElementById(String)}. */ public Element getElementById(String elementId) { return ownerDocument.getChildElementById(this, elementId); }
throw createDOMException(DOMException.NOT_SUPPORTED_ERR, "adopt.document", new Object[] {}); case Node.DOCUMENT_TYPE_NODE: throw createDOMException(DOMException.NOT_SUPPORTED_ERR, "adopt.document.type", new Object[] {}); throw createDOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.node", parent.removeChild(n); adoptNode1((AbstractNode) n); return n;
attr = (AbstractAttr) nnm.item(i); if (attr.getSpecified()) { adoptNode1(attr); fireUserDataHandlers(UserDataHandler.NODE_ADOPTED, n, null); return; adoptNode1((AbstractNode) m);
/** * Creates a DOMError object with the given parameters. */ protected DOMError createDOMError(String type, short severity, String key, Object[] args, Node related, Exception e) { try { return new DocumentError(type, severity, getCurrentDocument().formatMessage(key, args), related, e); } catch (Exception ex) { return new DocumentError(type, severity, key, related, e); } }
/** * Sets the document type node. */ public void setDoctype(DocumentType dt) { if (dt != null) { appendChild(dt); ((ExtendedNode)dt).setReadonly(true); } }
/** * Get the first element that precedes the current node in the * xblParentNode's xblChildNodes list. */ public Element getXblPreviousElementSibling() { return ownerDocument.getXBLManager().getXblPreviousElementSibling(this); }
case MutationEvent.ADDITION: if (node.isId()) ownerDocument.addIdEntry(this, newv); attrAdded(node, newv); break; ownerDocument.updateIdEntry(this, oldv, newv); attrModified(node, oldv, newv); break; ownerDocument.removeIdEntry(this, oldv); attrRemoved(node, oldv); if (doc.getEventsEnabled() && !oldv.equals(newv)) { DOMMutationEvent ev = (DOMMutationEvent) doc.createEvent("MutationEvents"); ev.initMutationEventNS(XMLConstants.XML_EVENTS_NAMESPACE_URI, "DOMAttrModified",
/** * Creates a SVG Document instance. * @param uri The document URI. * @param r The document reader. * @exception IOException if an error occured while reading the document. */ public Document createDocument(String uri, Reader r) throws IOException { Document doc; InputSource is = new InputSource(r); is.setSystemId(uri); try { doc = super.createDocument (SVGDOMImplementation.SVG_NAMESPACE_URI, "svg", uri, is); if (uri != null) { ((SVGOMDocument)doc).setParsedURL(new ParsedURL(uri)); } AbstractDocument d = (AbstractDocument) doc; d.setDocumentURI(uri); d.setXmlStandalone(isStandalone); d.setXmlVersion(xmlVersion); } catch (MalformedURLException e) { throw new IOException(e.getMessage()); } return doc; }
/** * Gets the number value. */ public double getNumberValue() { if (resultType != NUMBER_TYPE) { throw createXPathException (XPathException.TYPE_ERR, "xpath.invalid.result.type", new Object[] {(int) resultType}); } return numberValue; }
/** * Creates an exception with the appropriate error message. */ public XPathException createXPathException(short type, String key, Object[] args) { try { return new XPathException(type, formatMessage(key, args)); } catch (Exception e) { return new XPathException(type, key); } }