@Override
    public void marshal(Element e, Document doc) {
        super.marshal(e, doc);
        String xns = NS.XLINK.ns(); // to keep lines short.

        if (this.xlinkType != null) {
            Attr xtype = doc.createAttributeNS(xns, "xlink:type");
            xtype.setNodeValue(this.xlinkType.value());
            e.setAttributeNode(xtype);
        }
        if (this.xlinkHREF != null) {
            Attr xhref = doc.createAttributeNS(xns, "xlink:href");
            xhref.setNodeValue(this.xlinkHREF);
            e.setAttributeNode(xhref);
        }
        if (this.xlinkRole != null) {
            Attr xrole = doc.createAttributeNS(xns, "xlink:role");
            xrole.setNodeValue(this.xlinkRole);
            e.setAttributeNode(xrole);
        }
        if (this.xlinkArcRole != null) {
            Attr xArcRole = doc.createAttributeNS(xns, "xlink:arcrole");
            xArcRole.setNodeValue(this.xlinkArcRole);
            e.setAttributeNode(xArcRole);
        }
        if (this.xlinkTitle != null) {
            Attr xtitle = doc.createAttributeNS(xns, "xlink:title");
            xtitle.setNodeValue(this.xlinkTitle);
            e.setAttributeNode(xtitle);
        }
        if (this.otherloctype != null)
            e.setAttribute("OTHERLOCTYPE", this.otherloctype);

        if (this.xlinkShow != null) {
            Attr show = doc.createAttributeNS(xns, "xlink:show");
            show.setNodeValue(this.xlinkShow.value());
            e.setAttributeNode(show);
        }
        if (this.xlinkActuate != null) {
            Attr actuate = doc.createAttributeNS(xns, "xlink:actuate");
            actuate.setNodeValue(this.xlinkActuate.value());
            e.setAttributeNode(actuate);
        }
        if (this.loctype != null)
            e.setAttribute("LOCTYPE", this.loctype.value());
    }