The list of methods to do XML Attribute Create are organized into topic(s).
void
createAttribute(Document doc, String nodeName, Map map) create Attribute
Node node = doc.getElementsByTagName(nodeName).item(0);
if (node.getNodeType() == Node.ELEMENT_NODE) {
Element element = (Element) node;
for (Map.Entry<String, String> entry : map.entrySet()) {
element.setAttribute(entry.getKey(), entry.getValue());
Map
createAttributeTable(Element e)
create Attribute Table
Map<String, String> attributeTable = new HashMap<>();
NamedNodeMap attrs = e.getAttributes();
if (attrs != null) {
int numAttrs = attrs.getLength();
for (int i = 0; i < numAttrs; i++) {
Node na = attrs.item(i);
if (na.getNodeType() != Node.ATTRIBUTE_NODE) {
continue;
...
Element
createFontAttributeGraphics(Document d, boolean showFamily, boolean showStyle, boolean showWeight, boolean showSize, boolean showDecoration, boolean showAlign, boolean showRotation) create Font Attribute Graphics
Element fontGraphics = d.createElement("font");
if (showFamily)
fontGraphics.setAttribute("family", "arial,sans-serif");
if (showStyle)
fontGraphics.setAttribute("style", "italic");
if (showWeight)
fontGraphics.setAttribute("weight", "bold");
if (showSize)
...
Map
mapifyAttrs(Node node, Map overwrite)
This grabs the attributes from a dom node and overwrites those values with those specified by the overwrite map.
Map<String, String> map = new HashMap<String, String>();
NamedNodeMap nnMap = node.getAttributes();
for (int i = 0; i < nnMap.getLength(); i++) {
Node attr = nnMap.item(i);
map.put(attr.getNodeName(), attr.getNodeValue());
if (overwrite != null) {
for (Map.Entry<String, String> e : overwrite.entrySet()) {
...