private String getNSAbbreviation(String namespace) throws IOException { if ("http://www.w3.org/XML/1998/namespace".equals(namespace)) return "xml:"; if (namespace == null || "".equals(namespace)) return ""; XMLNamespace ns = findByNamespace(namespace); if (ns == null) throw new IOException("Namespace " + namespace + " is not defined"); else if (ns.getAbbreviation() == null) return ""; else return ns.getAbbreviation() + ":"; }
/* (non-Javadoc) * @see org.eclipse.ohf.utilities.xml.IXMLWriter#namespace(java.lang.String, java.lang.String) */ @Override public void namespace(String namespace, String abbreviation) throws IOException { XMLNamespace ns = findByAbbreviation(abbreviation); if (ns == null || !ns.getNamespace().equals(namespace)) defineNamespace(namespace, abbreviation); }
/* (non-Javadoc) * @see org.eclipse.ohf.utilities.xml.IXMLWriter#getDefaultNamespace() */ @Override public String getDefaultNamespace() { XMLNamespace ns = findDefaultNamespace(); if (ns == null) return null; else return ns.getNamespace(); }