public Element toXML(Document doc, String name) { Element inst_ele; Element desc_ele; inst_ele = doc.createElementNS(Namespace.MPEG7, name); inst_ele.setAttributeNS(Namespace.XSI, "xsi:type", "MediaInstanceType"); inst_ele.appendChild(instance_identifier.toXML(doc, "InstanceIdentifier")); if (media_locator != null) { inst_ele.appendChild(media_locator.toXML(doc, "MediaLocator")); } else { desc_ele = doc.createElement("LocationDescription"); desc_ele.setAttributeNS(Namespace.XSI, "xsi:type", "TextualType"); Utils.setContent(doc, desc_ele, location_description); inst_ele.appendChild(desc_ele); } return (inst_ele); }