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
(final String namespaceURI, final String qualifiedName, final SgmlPage page,
final Map<String, DomAttr> attributes)
| 127 | * {@code null}. The map will be stored as is, not copied. |
| 128 | */ |
| 129 | public DomElement(final String namespaceURI, final String qualifiedName, final SgmlPage page, |
| 130 | final Map<String, DomAttr> attributes) { |
| 131 | super(namespaceURI, qualifiedName, page); |
| 132 | |
| 133 | if (attributes == null) { |
| 134 | attributes_ = new NamedAttrNodeMapImpl(this, isAttributeCaseSensitive()); |
| 135 | } |
| 136 | else { |
| 137 | attributes_ = new NamedAttrNodeMapImpl(this, isAttributeCaseSensitive(), attributes); |
| 138 | |
| 139 | for (final DomAttr entry : attributes.values()) { |
| 140 | entry.setParentNode(this); |
| 141 | final String attrNamespaceURI = entry.getNamespaceURI(); |
| 142 | final String prefix = entry.getPrefix(); |
| 143 | |
| 144 | if (attrNamespaceURI != null && prefix != null) { |
| 145 | if (namespaces_ == null) { |
| 146 | namespaces_ = new FastHashMap<>(1, 0.5f); |
| 147 | } |
| 148 | namespaces_.put(attrNamespaceURI, prefix); |
| 149 | } |
| 150 | } |
| 151 | } |
| 152 | } |
| 153 | |
| 154 | /** |
| 155 | * {@inheritDoc} |
nothing calls this directly
no test coverage detected