/** * Returns true if there is a namespace declared with the given name, which must be a well-formed URI. */ public boolean hasNamespace(String name) { if (name == null) { return false; } return getPrefix(name) != null; }
public void addNamespace(String namespaceUri, String prefix) { if (namespaces == null) { namespaces = new XmlNamespaces(); } if ("".equals(prefix)) { prefix = null; } try { namespaces.add(prefix, namespaceUri); } catch (URISyntaxException e) { log.error(String.format("Cannot add XML namespace for invalid URI %s: %s", namespaceUri, e.getMessage())); } }
protected String getNamespacePrefix(String namespaceUri) { if (this.namespaces != null && this.namespaces.hasNamespace(namespaceUri)) { String prefix = this.namespaces.getPrefix(namespaceUri); return prefix == null || prefix.isEmpty() ? "" : prefix + ":"; } if (parent!=null) { return parent.getNamespacePrefix(namespaceUri); } return ""; }
@Before public void createNamespaces() { namespaces = new XmlNamespaces(); }
public boolean hasNamespace(String namespaceUri) { if (this.namespaces!=null && this.namespaces.hasNamespace(namespaceUri)) { return true; } if (parent!=null) { return parent.hasNamespace(namespaceUri); } return false; }
public boolean hasNamespace(String namespaceUri) { if (this.namespaces!=null && this.namespaces.hasNamespace(namespaceUri)) { return true; } if (parent!=null) { return parent.hasNamespace(namespaceUri); } return false; }
/** * Returns true if there is a namespace declared with the given name, which must be a well-formed URI. */ public boolean hasNamespace(String name) { if (name == null) { return false; } return getPrefix(name) != null; }
protected String getNamespacePrefix(String namespaceUri) { if (this.namespaces != null && this.namespaces.hasNamespace(namespaceUri)) { String prefix = this.namespaces.getPrefix(namespaceUri); return prefix == null || prefix.isEmpty() ? "" : prefix + ":"; } if (parent!=null) { return parent.getNamespacePrefix(namespaceUri); } return ""; }
public void addNamespace(String namespaceUri, String prefix) { if (namespaces == null) { namespaces = new XmlNamespaces(); } if ("".equals(prefix)) { prefix = null; } try { namespaces.add(prefix, namespaceUri); } catch (URISyntaxException e) { log.error(String.format("Cannot add XML namespace for invalid URI %s: %s", namespaceUri, e.getMessage())); } }
/** * Returns the namespace prefix for the given namespace name, which must be a well-formed URI. */ public String getPrefix(String name) { try { return getPrefix(new URI(name)); } catch (URISyntaxException e) { return null; } }
/** * Returns the namespace prefix for the given namespace name, which must be a well-formed URI. */ public String getPrefix(String name) { try { return getPrefix(new URI(name)); } catch (URISyntaxException e) { return null; } }
protected void initializeNamespacePrefixes() { if (xml.namespaces != null) { bpmnPrefix = xml.namespaces.getPrefix(BPMN_URI); effektifPrefix = xml.namespaces.getPrefix(EFFEKTIF_URI); } // Add any missing namespaces with their default prefixes. if (bpmnPrefix == null) { bpmnPrefix = ""; xml.addNamespace(BPMN_URI, bpmnPrefix); } if (bpmnDiagramPrefix == null) { bpmnDiagramPrefix = "bpmndi"; xml.addNamespace(BPMN_DI_URI, bpmnDiagramPrefix); xml.addNamespace(OMG_DC_URI, "omgdc"); xml.addNamespace(OMG_DI_URI, "omgdi"); } if (effektifPrefix == null) { effektifPrefix = "e"; xml.addNamespace(EFFEKTIF_URI, effektifPrefix); } }