Tabnine Logo
Namespace.getPrefix
Code IndexAdd Tabnine to your IDE (free)

How to use
getPrefix
method
in
de.pdark.decentxml.Namespace

Best Java code snippets using de.pdark.decentxml.Namespace.getPrefix (Showing top 9 results out of 315)

origin: de.pdark/decentxml

public void addNamespace (Namespace ns)
{
  map.put (ns.getPrefix (), ns);
}

origin: de.pdark/decentxml

@Override
public boolean equals (Object obj)
{
  if (obj == null)
    return false;
  
  if (!(obj instanceof Namespace) )
    return false;
  
  Namespace ns = (Namespace)obj;
  return prefix.equals (ns.getPrefix ())
    && uri.equals (ns.getURI ())
  ;
}

origin: de.pdark/decentxml

public Attribute getAttribute (String name, Namespace ns)
{
  if (ns == null || ns.getPrefix ().length () == 0)
    return getAttribute (name);
  
  return getAttribute (ns.getPrefix ()+":"+name);
}

origin: jboss-fuse/fabric8

public static String getNamespaceURI(Node node) {
  if (node instanceof Element) {
    Namespace ns = ((Element) node).getNamespace();
    if (ns != null) {
      String uri = ns.getURI();
      if (uri == null || uri.length() == 0) {
        String uriAttr = ns.getPrefix().equals("") ? ((Element) node).getAttributeValue("xmlns") : null;
        if (uriAttr != null) {
          return uriAttr;
        } else {
          return getNamespaceURI(((Element) node).getParent());
        }
      } else {
        return uri;
      }
    }
  }
  return null;
}
origin: io.fabric8.forge/camel-tooling-util

public static String getNamespaceURI(Node node) {
  if (node instanceof Element) {
    Namespace ns = ((Element) node).getNamespace();
    if (ns != null) {
      String uri = ns.getURI();
      if (uri == null || uri.length() == 0) {
        String uriAttr = ns.getPrefix().equals("") ? ((Element) node).getAttributeValue("xmlns") : null;
        if (uriAttr != null) {
          return uriAttr;
        } else {
          return getNamespaceURI(((Element) node).getParent());
        }
      } else {
        return uri;
      }
    }
  }
  return null;
}
origin: io.fabric8.forge/camel-tooling-util

protected Node replaceNamespace(Node node, String oldNS, String newNS) {
  if (node instanceof Element) {
    String ns = getNamespaceURI(node);
    if (ns != null && ns.equals(oldNS)) {
      Namespace namespace = ((Element) node).getNamespace();
      if (namespace != null) {
        if (namespace.getURI() != null && namespace.getURI().equals(oldNS)) {
          ((Element) node).setNamespace(new Namespace(namespace.getPrefix(), newNS));
        }
      }
      for (Attribute attr : ((Element) node).getAttributes()) {
        if (attr.getName().startsWith("xmlns")) {
          String value = attr.getValue();
          if (value != null && value.equals(oldNS)) {
            attr.setValue(newNS);
          }
        }
      }
    }
  }
  if (node instanceof NodeWithChildren) {
    for (Node n : ((NodeWithChildren) node).getNodes()) {
      replaceNamespace(n, oldNS, newNS);
    }
  }
  return node;
}
origin: de.pdark/decentxml

if (parent.getNamespace ().getPrefix ().length () != 0)
  elementName = parent.getNamespace ().getPrefix () + ":" + elementName;
origin: jboss-fuse/fabric8

protected Node replaceNamespace(Node node, String oldNS, String newNS) {
  if (node instanceof Element) {
    String ns = getNamespaceURI(node);
    if (ns != null && ns.equals(oldNS)) {
      Namespace namespace = ((Element) node).getNamespace();
      if (namespace != null) {
        if (namespace.getURI() != null && namespace.getURI().equals(oldNS)) {
          ((Element) node).setNamespace(new Namespace(namespace.getPrefix(), newNS));
        }
      }
      for (Attribute attr : ((Element) node).getAttributes()) {
        if (attr.getName().startsWith("xmlns")) {
          String value = attr.getValue();
          if (value != null && value.equals(oldNS)) {
            attr.setValue(newNS);
          }
        }
      }
    }
  }
  if (node instanceof NodeWithChildren) {
    for (Node n : ((NodeWithChildren) node).getNodes()) {
      replaceNamespace(n, oldNS, newNS);
    }
  }
  return node;
}
origin: de.pdark/decentxml

@Override
public BasicNode toXML (XMLWriter writer) throws IOException
{
  writer.write (this, getPreSpace ());
  String prefix = getNamespace ().getPrefix ();
  if (prefix.length () != 0)
  {
    writer.write (this, prefix);
    writer.write (this, ":");
  }
  writer.write (this, getName ());
  writer.write (this, getEqualsSpace ());
  
  char[] buffer = new char[1];
  buffer[0] = (char)quoteChar;
  String s = new String (buffer);
  writer.write (this, s);
  if (rawValue != null)
    writer.write (this, rawValue);
  else
    writer.writeAttributeValue (this, getValue (), quoteChar);
  writer.write (this, s);
  
  return this;
}

de.pdark.decentxmlNamespacegetPrefix

Popular methods of Namespace

  • <init>
  • getURI
  • equals

Popular in Java

  • Updating database using SQL prepared statement
  • getApplicationContext (Context)
  • addToBackStack (FragmentTransaction)
  • setRequestProperty (URLConnection)
  • URLConnection (java.net)
    A connection to a URL for reading or writing. For HTTP connections, see HttpURLConnection for docume
  • Connection (java.sql)
    A connection represents a link from a Java application to a database. All SQL statements and results
  • Iterator (java.util)
    An iterator over a sequence of objects, such as a collection.If a collection has been changed since
  • PriorityQueue (java.util)
    A PriorityQueue holds elements on a priority heap, which orders the elements according to their natu
  • Filter (javax.servlet)
    A filter is an object that performs filtering tasks on either the request to a resource (a servlet o
  • Options (org.apache.commons.cli)
    Main entry-point into the library. Options represents a collection of Option objects, which describ
  • From CI to AI: The AI layer in your organization
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now