/** * Checks the validity of a node to add. */ protected void checkNode( Node arg ) { if ( isReadonly() ) { throw createDOMException ( DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.node.map", new Object[]{} ); } if ( getOwnerDocument() != arg.getOwnerDocument() ) { throw createDOMException( DOMException.WRONG_DOCUMENT_ERR, "node.from.wrong.document", new Object[]{(int) arg.getNodeType(), arg.getNodeName()} ); } if ( arg.getNodeType() == ATTRIBUTE_NODE && ( (Attr)arg ).getOwnerElement() != null ) { throw createDOMException( DOMException.WRONG_DOCUMENT_ERR, "inuse.attribute", new Object[]{arg.getNodeName()} ); } }
/** * Checks the validity of a node to add. */ protected void checkNode( Node arg ) { if ( isReadonly() ) { throw createDOMException ( DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.node.map", new Object[]{} ); } if ( getOwnerDocument() != arg.getOwnerDocument() ) { throw createDOMException( DOMException.WRONG_DOCUMENT_ERR, "node.from.wrong.document", new Object[]{new Integer( arg.getNodeType() ), arg.getNodeName()} ); } if ( arg.getNodeType() == ATTRIBUTE_NODE && ( (Attr)arg ).getOwnerElement() != null ) { throw createDOMException( DOMException.WRONG_DOCUMENT_ERR, "inuse.attribute", new Object[]{arg.getNodeName()} ); } }
/** * Checks the validity of a node to add. */ protected void checkNode( Node arg ) { if ( isReadonly() ) { throw createDOMException ( DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.node.map", new Object[]{} ); } if ( getOwnerDocument() != arg.getOwnerDocument() ) { throw createDOMException( DOMException.WRONG_DOCUMENT_ERR, "node.from.wrong.document", new Object[]{(int) arg.getNodeType(), arg.getNodeName()} ); } if ( arg.getNodeType() == ATTRIBUTE_NODE && ( (Attr)arg ).getOwnerElement() != null ) { throw createDOMException( DOMException.WRONG_DOCUMENT_ERR, "inuse.attribute", new Object[]{arg.getNodeName()} ); } }
/** * <b>DOM</b>: Implements {@link * org.w3c.dom.Element#removeAttributeNode(Attr)}. */ public Attr removeAttributeNode(Attr oldAttr) throws DOMException { if (oldAttr == null) { return null; } if (attributes == null) { throw createDOMException(DOMException.NOT_FOUND_ERR, "attribute.missing", new Object[] { oldAttr.getName() }); } String nsURI = oldAttr.getNamespaceURI(); return (Attr)attributes.removeNamedItemNS(nsURI, (nsURI==null ? oldAttr.getNodeName() : oldAttr.getLocalName())); }
/** * <b>DOM</b>: Implements {@link * org.w3c.dom.Element#removeAttributeNode(Attr)}. */ public Attr removeAttributeNode(Attr oldAttr) throws DOMException { if (oldAttr == null) { return null; } if (attributes == null) { throw createDOMException(DOMException.NOT_FOUND_ERR, "attribute.missing", new Object[] { oldAttr.getName() }); } String nsURI = oldAttr.getNamespaceURI(); return (Attr)attributes.removeNamedItemNS(nsURI, (nsURI==null ? oldAttr.getNodeName() : oldAttr.getLocalName())); }
/** * <b>DOM</b>: Implements {@link * org.w3c.dom.Element#removeAttributeNode(Attr)}. */ public Attr removeAttributeNode(Attr oldAttr) throws DOMException { if (oldAttr == null) { return null; } if (attributes == null) { throw createDOMException(DOMException.NOT_FOUND_ERR, "attribute.missing", new Object[] { oldAttr.getName() }); } String nsURI = oldAttr.getNamespaceURI(); return (Attr)attributes.removeNamedItemNS(nsURI, (nsURI==null ? oldAttr.getNodeName() : oldAttr.getLocalName())); }
/** * Checks the validity of a node to be inserted. * @param n The node to be inserted. */ protected void checkChildType(Node n, boolean replace) { switch (n.getNodeType()) { case ELEMENT_NODE: // fall-through is intended case PROCESSING_INSTRUCTION_NODE: case COMMENT_NODE: case TEXT_NODE: case CDATA_SECTION_NODE: case ENTITY_REFERENCE_NODE: case DOCUMENT_FRAGMENT_NODE: break; default: throw createDOMException (DOMException.HIERARCHY_REQUEST_ERR, "child.type", new Object[] { new Integer(getNodeType()), getNodeName(), new Integer(n.getNodeType()), n.getNodeName() }); } }
/** * <b>DOM</b>: Implements * {@link org.w3c.dom.Element#setIdAttribute(String,boolean)}. */ public void setIdAttribute(String name, boolean isId) throws DOMException { AbstractAttr a = (AbstractAttr) getAttributeNode(name); if (a == null) { throw createDOMException(DOMException.NOT_FOUND_ERR, "attribute.missing", new Object[] { name }); } if (a.isReadonly()) { throw createDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.node", new Object[] { name }); } updateIdEntry(a, isId); a.isIdAttr = isId; }
/** * <b>DOM</b>: Implements * {@link org.w3c.dom.Element#setIdAttribute(String,boolean)}. */ public void setIdAttribute(String name, boolean isId) throws DOMException { AbstractAttr a = (AbstractAttr) getAttributeNode(name); if (a == null) { throw createDOMException(DOMException.NOT_FOUND_ERR, "attribute.missing", new Object[] { name }); } if (a.isReadonly()) { throw createDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.node", new Object[] { name }); } updateIdEntry(a, isId); a.isIdAttr = isId; }
/** * <b>DOM</b>: Implements * {@link org.w3c.dom.Element#setIdAttribute(String,boolean)}. */ public void setIdAttribute(String name, boolean isId) throws DOMException { AbstractAttr a = (AbstractAttr) getAttributeNode(name); if (a == null) { throw createDOMException(DOMException.NOT_FOUND_ERR, "attribute.missing", new Object[] { name }); } if (a.isReadonly()) { throw createDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.node", new Object[] { name }); } updateIdEntry(a, isId); a.isIdAttr = isId; }
/** * Checks the validity of a node to be inserted. * @param n The node to be inserted. */ protected void checkChildType(Node n, boolean replace) { switch (n.getNodeType()) { case ELEMENT_NODE: // fall-through is intended case PROCESSING_INSTRUCTION_NODE: case COMMENT_NODE: case TEXT_NODE: case CDATA_SECTION_NODE: case ENTITY_REFERENCE_NODE: case DOCUMENT_FRAGMENT_NODE: break; default: throw createDOMException (DOMException.HIERARCHY_REQUEST_ERR, "child.type", new Object[] {(int) getNodeType(), getNodeName(), (int) n.getNodeType(), n.getNodeName() }); } }
/** * Creates a new AbstractElement object. * @param name The element name for validation purposes. * @param owner The owner document. * @exception DOMException * INVALID_CHARACTER_ERR: if name contains invalid characters, */ protected AbstractElement(String name, AbstractDocument owner) { ownerDocument = owner; if (owner.getStrictErrorChecking() && !DOMUtilities.isValidName(name)) { throw createDOMException(DOMException.INVALID_CHARACTER_ERR, "xml.name", new Object[] { name }); } }
/** * Creates a new AbstractElement object. * @param name The element name for validation purposes. * @param owner The owner document. * @exception DOMException * INVALID_CHARACTER_ERR: if name contains invalid characters, */ protected AbstractElement(String name, AbstractDocument owner) { ownerDocument = owner; if (owner.getStrictErrorChecking() && !DOMUtilities.isValidName(name)) { throw createDOMException(DOMException.INVALID_CHARACTER_ERR, "xml.name", new Object[] { name }); } }
/** * Creates a new AbstractElement object. * @param name The element name for validation purposes. * @param owner The owner document. * @exception DOMException * INVALID_CHARACTER_ERR: if name contains invalid characters, */ protected AbstractElement(String name, AbstractDocument owner) { ownerDocument = owner; if (owner.getStrictErrorChecking() && !DOMUtilities.isValidName(name)) { throw createDOMException(DOMException.INVALID_CHARACTER_ERR, "xml.name", new Object[] { name }); } }
/** * <b>DOM</b>: Implements * {@link org.w3c.dom.Element#setIdAttributeNS(String,String,boolean)}. */ public void setIdAttributeNS( String ns, String ln, boolean isId ) throws DOMException { if ( ns != null && ns.length() == 0 ) { ns = null; } AbstractAttr a = (AbstractAttr)getAttributeNodeNS( ns, ln ); if (a == null) { throw createDOMException(DOMException.NOT_FOUND_ERR, "attribute.missing", new Object[] { ns, ln }); } if (a.isReadonly()) { throw createDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.node", new Object[] { a.getNodeName() }); } updateIdEntry(a, isId); a.isIdAttr = isId; }
/** * <b>DOM</b>: Implements * {@link org.w3c.dom.Element#setIdAttributeNS(String,String,boolean)}. */ public void setIdAttributeNS( String ns, String ln, boolean isId ) throws DOMException { if ( ns != null && ns.length() == 0 ) { ns = null; } AbstractAttr a = (AbstractAttr)getAttributeNodeNS( ns, ln ); if (a == null) { throw createDOMException(DOMException.NOT_FOUND_ERR, "attribute.missing", new Object[] { ns, ln }); } if (a.isReadonly()) { throw createDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.node", new Object[] { a.getNodeName() }); } updateIdEntry(a, isId); a.isIdAttr = isId; }
/** * <b>DOM</b>: Implements * {@link org.w3c.dom.Element#setIdAttributeNS(String,String,boolean)}. */ public void setIdAttributeNS( String ns, String ln, boolean isId ) throws DOMException { if ( ns != null && ns.length() == 0 ) { ns = null; } AbstractAttr a = (AbstractAttr)getAttributeNodeNS( ns, ln ); if (a == null) { throw createDOMException(DOMException.NOT_FOUND_ERR, "attribute.missing", new Object[] { ns, ln }); } if (a.isReadonly()) { throw createDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.node", new Object[] { a.getNodeName() }); } updateIdEntry(a, isId); a.isIdAttr = isId; }
/** * <b>DOM</b>: Implements * {@link org.w3c.dom.Element#setIdAttributeNode(Attr,boolean)}. */ public void setIdAttributeNode( Attr attr, boolean isId ) throws DOMException { AbstractAttr a = (AbstractAttr)attr; if (a.isReadonly()) { throw createDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.node", new Object[] { a.getNodeName() }); } updateIdEntry(a, isId); a.isIdAttr = isId; }
/** * <b>DOM</b>: Implements * {@link org.w3c.dom.Element#setIdAttributeNode(Attr,boolean)}. */ public void setIdAttributeNode( Attr attr, boolean isId ) throws DOMException { AbstractAttr a = (AbstractAttr)attr; if (a.isReadonly()) { throw createDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.node", new Object[] { a.getNodeName() }); } updateIdEntry(a, isId); a.isIdAttr = isId; }
/** * <b>DOM</b>: Implements * {@link org.w3c.dom.Element#setIdAttributeNode(Attr,boolean)}. */ public void setIdAttributeNode( Attr attr, boolean isId ) throws DOMException { AbstractAttr a = (AbstractAttr)attr; if (a.isReadonly()) { throw createDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.node", new Object[] { a.getNodeName() }); } updateIdEntry(a, isId); a.isIdAttr = isId; }