private static Map<String, DomAttr> createAttributesCopyWithClonedAttribute(final HtmlElement elt, final String attrName) { final Map<String, DomAttr> newMap = new HashMap<>(elt.getAttributesMap()); // clone the specified element, if possible final DomAttr attr = newMap.get(attrName); if (null == attr) { return newMap; } final DomAttr clonedAttr = new DomAttr(attr.getPage(), attr.getNamespaceURI(), attr.getQualifiedName(), attr.getValue(), attr.getSpecified()); newMap.put(attrName, clonedAttr); return newMap; }
private static Map<String, DomAttr> createAttributesCopyWithClonedAttribute(final HtmlElement elt, final String attrName) { final Map<String, DomAttr> newMap = new HashMap<>(elt.getAttributesMap()); // clone the specified element, if possible final DomAttr attr = newMap.get(attrName); if (null == attr) { return newMap; } final DomAttr clonedAttr = new DomAttr(attr.getPage(), attr.getNamespaceURI(), attr.getQualifiedName(), attr.getValue(), attr.getSpecified()); newMap.put(attrName, clonedAttr); return newMap; }
/** * Creates an instance of a DOM element that can have a namespace. * * @param namespaceURI the URI that identifies an XML namespace * @param qualifiedName the qualified name of the element type to instantiate * @param page the page that contains this element * @param attributes a map ready initialized with the attributes for this element, or * {@code null}. The map will be stored as is, not copied. */ public DomElement(final String namespaceURI, final String qualifiedName, final SgmlPage page, final Map<String, DomAttr> attributes) { super(namespaceURI, qualifiedName, page); if (attributes != null && !attributes.isEmpty()) { attributes_ = new NamedAttrNodeMapImpl(this, isAttributeCaseSensitive(), attributes); for (final DomAttr entry : attributes_.values()) { entry.setParentNode(this); final String attrNamespaceURI = entry.getNamespaceURI(); if (attrNamespaceURI != null) { namespaces_.put(attrNamespaceURI, entry.getPrefix()); } } } }
/** * Creates an instance of a DOM element that can have a namespace. * * @param namespaceURI the URI that identifies an XML namespace * @param qualifiedName the qualified name of the element type to instantiate * @param page the page that contains this element * @param attributes a map ready initialized with the attributes for this element, or * {@code null}. The map will be stored as is, not copied. */ public DomElement(final String namespaceURI, final String qualifiedName, final SgmlPage page, final Map<String, DomAttr> attributes) { super(namespaceURI, qualifiedName, page); if (attributes != null && !attributes.isEmpty()) { attributes_ = new NamedAttrNodeMapImpl(this, isAttributeCaseSensitive(), attributes); for (final DomAttr entry : attributes_.values()) { entry.setParentNode(this); final String attrNamespaceURI = entry.getNamespaceURI(); if (attrNamespaceURI != null) { namespaces_.put(attrNamespaceURI, entry.getPrefix()); } } } }
/** * Creates an instance of a DOM element that can have a namespace. * * @param namespaceURI the URI that identifies an XML namespace * @param qualifiedName the qualified name of the element type to instantiate * @param page the page that contains this element * @param attributes a map ready initialized with the attributes for this element, or * <code>null</code>. The map will be stored as is, not copied. */ public DomElement(final String namespaceURI, final String qualifiedName, final SgmlPage page, final Map<String, DomAttr> attributes) { super(namespaceURI, qualifiedName, page); if (attributes != null && !attributes.isEmpty()) { attributes_ = new NamedAttrNodeMapImpl(this, isAttributeCaseSensitive(), attributes); for (final DomAttr entry : attributes_.values()) { entry.setParentNode(this); final String attrNamespaceURI = entry.getNamespaceURI(); if (attrNamespaceURI != null) { namespaces_.put(attrNamespaceURI, entry.getPrefix()); } } } }
/** * Creates an instance of a DOM element that can have a namespace. * * @param namespaceURI the URI that identifies an XML namespace * @param qualifiedName the qualified name of the element type to instantiate * @param page the page that contains this element * @param attributes a map ready initialized with the attributes for this element, or * <code>null</code>. The map will be stored as is, not copied. */ public DomElement(final String namespaceURI, final String qualifiedName, final SgmlPage page, final Map<String, DomAttr> attributes) { super(namespaceURI, qualifiedName, page); if (attributes != null && !attributes.isEmpty()) { attributes_ = new NamedAttrNodeMapImpl(this, isAttributeCaseSensitive(), attributes); for (final DomAttr entry : attributes_.values()) { entry.setParentNode(this); final String attrNamespaceURI = entry.getNamespaceURI(); if (attrNamespaceURI != null) { namespaces_.put(attrNamespaceURI, entry.getPrefix()); } } } }
/** * Creates an instance of a DOM element that can have a namespace. * * @param namespaceURI the URI that identifies an XML namespace * @param qualifiedName the qualified name of the element type to instantiate * @param page the page that contains this element * @param attributes a map ready initialized with the attributes for this element, or * <code>null</code>. The map will be stored as is, not copied. */ public DomElement(final String namespaceURI, final String qualifiedName, final SgmlPage page, final Map<String, DomAttr> attributes) { super(namespaceURI, qualifiedName, page); if (attributes != null && !attributes.isEmpty()) { attributes_ = new NamedAttrNodeMapImpl(this, isAttributeCaseSensitive(), attributes); for (final DomAttr entry : attributes_.values()) { entry.setParentNode(this); final String attrNamespaceURI = entry.getNamespaceURI(); if (attrNamespaceURI != null) { namespaces_.put(attrNamespaceURI, entry.getPrefix()); } } } }