/** * Write the xml for a {@link Reference}. * * @param reference * @param contentHandler * @throws SAXException */ protected static void generateXML( final String namespace, Reference reference, ContentHandler contentHandler, boolean isScrPrivateFile) throws SAXException { final AttributesImpl ai = new AttributesImpl(); IOUtils.addAttribute(ai, "name", reference.getName()); IOUtils.addAttribute(ai, "interface", reference.getInterfacename()); IOUtils.addAttribute(ai, "cardinality", reference.getCardinality()); IOUtils.addAttribute(ai, "policy", reference.getPolicy()); IOUtils.addAttribute(ai, "target", reference.getTarget()); IOUtils.addAttribute(ai, "bind", reference.getBind()); IOUtils.addAttribute(ai, "unbind", reference.getUnbind()); // attributes new in 1.1-felix (FELIX-1893) if (NAMESPACE_URI_1_1_FELIX.equals(namespace)) { IOUtils.addAttribute(ai, "updated", reference.getUpdated()); } if (isScrPrivateFile) { IOUtils.addAttribute(ai, "checked", String.valueOf(reference.isChecked())); IOUtils.addAttribute(ai, "strategy", reference.getStrategy()); } IOUtils.indent(contentHandler, 2); contentHandler.startElement( INNER_NAMESPACE_URI, ComponentDescriptorIO.REFERENCE, ComponentDescriptorIO.REFERENCE_QNAME, ai); contentHandler.endElement( INNER_NAMESPACE_URI, ComponentDescriptorIO.REFERENCE, ComponentDescriptorIO.REFERENCE_QNAME); IOUtils.newline(contentHandler); }