org.jdom.Attribute.getNamespace()方法的使用及代码示例

x33g5p2x  于2022-01-15 转载在 其他  
字(9.5k)|赞(0)|评价(0)|浏览(103)

本文整理了Java中org.jdom.Attribute.getNamespace()方法的一些代码示例,展示了Attribute.getNamespace()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Attribute.getNamespace()方法的具体详情如下:
包路径:org.jdom.Attribute
类名称:Attribute
方法名:getNamespace

Attribute.getNamespace介绍

[英]This will return this Attribute's Namespace.
[中]这将返回此AttributeNamespace

代码示例

代码示例来源:origin: org.freemarker/freemarker

public List operate(Object node) {
      if (node instanceof Element)
        return Collections.singletonList(((Element) node).getNamespace().getPrefix());
      else if (node instanceof Attribute)
        return Collections.singletonList(((Attribute) node).getNamespace().getPrefix());
      // With 2.1 semantics it  makes more sense to just return a null and let the core 
      // throw an InvalidReferenceException and the template writer can use ?exists etcetera. (JR)
      return null;
//            throw new TemplateModelException("_nsprefix can not be applied on " + node.getClass());
    }
  }

代码示例来源:origin: org.freemarker/freemarker

public List operate(Object node) {
      if (node instanceof Element)
        return Collections.singletonList(((Element) node).getNamespace().getURI());
      else if (node instanceof Attribute)
        return Collections.singletonList(((Attribute) node).getNamespace().getURI());
      // With 2.1 semantics it  makes more sense to just return a null and let the core 
      // throw an InvalidReferenceException and the template writer can use ?exists etcetera. (JR)
      return null;
//            throw new TemplateModelException("_nsuri can not be applied on " + node.getClass());
    }
  }

代码示例来源:origin: org.freemarker/freemarker

public List operate(Object node) {
      if (node instanceof Element) {
        Element element = (Element) node;
        return Collections.singletonList(element.getNamespace().getURI() + element.getName());
      } else if (node instanceof Attribute) {
        Attribute attribute = (Attribute) node;
        return Collections.singletonList(attribute.getNamespace().getURI() + attribute.getName());
      }
      // With 2.1 semantics it  makes more sense to just return a null and let the core 
      // throw an InvalidReferenceException and the template writer can use ?exists etcetera. (JR)
      return null;
//            throw new TemplateModelException("_cname can not be applied on " + node.getClass());
    }
  }

代码示例来源:origin: jaxen/jaxen

Namespace attrNS = attribute.getNamespace();

代码示例来源:origin: info.magnolia/magnolia-core

protected void printQualifiedName(Writer out, Attribute a) throws IOException {
  String prefix = a.getNamespace().getPrefix();
  if ((prefix != null) && (!prefix.equals(""))) {
    out.write(prefix);
    out.write(':');
  }
  printName(out, a);
}

代码示例来源:origin: org.jdom/jdom-legacy

private void printQualifiedName(Writer out, Attribute a) throws IOException {
  String prefix = a.getNamespace().getPrefix();
  if ((prefix != null) && (!prefix.equals(""))) {
    out.write(prefix);
    out.write(':');
    out.write(a.getName());
  }
  else {
    out.write(a.getName());
  }
}

代码示例来源:origin: org.sonatype.maven.archetype/archetype-common

private void printQualifiedName(Writer out, Attribute a) throws IOException {
  String prefix=a.getNamespace().getPrefix();
  if ((prefix != null) && (!prefix.equals(""))) {
    out.write(prefix);
    out.write(':');
    out.write(a.getName());
  }
  else {
    out.write(a.getName());
  }
}

代码示例来源:origin: org.freemarker/freemarker-gae

public List operate(Object node) {
      if (node instanceof Element)
        return Collections.singletonList(((Element) node).getNamespace().getURI());
      else if (node instanceof Attribute)
        return Collections.singletonList(((Attribute) node).getNamespace().getURI());
      // With 2.1 semantics it  makes more sense to just return a null and let the core 
      // throw an InvalidReferenceException and the template writer can use ?exists etcetera. (JR)
      return null;
//            throw new TemplateModelException("_nsuri can not be applied on " + node.getClass());
    }
  }

代码示例来源:origin: org.jdom/jdom-legacy

/**
 * Return index of attribute with same name and Namespace, or
 * -1 if one doesn't exist
 */
private int indexOfDuplicate(Attribute attribute) {
  int duplicate = -1;
  String name = attribute.getName();
  Namespace namespace = attribute.getNamespace();
  duplicate = indexOf(name, namespace);
  return duplicate;
}

代码示例来源:origin: apache/maven-archetype

private void printQualifiedName( Writer out, Attribute a )
  throws IOException
{
  String prefix = a.getNamespace().getPrefix();
  if ( ( prefix != null ) && ( !prefix.equals( "" ) ) )
  {
    out.write( prefix );
    out.write( ':' );
    out.write( a.getName() );
  }
  else
  {
    out.write( a.getName() );
  }
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.freemarker

public List operate(Object node) {
      if (node instanceof Element)
        return Collections.singletonList(((Element) node).getNamespace().getPrefix());
      else if (node instanceof Attribute)
        return Collections.singletonList(((Attribute) node).getNamespace().getPrefix());
      // With 2.1 semantics it  makes more sense to just return a null and let the core 
      // throw an InvalidReferenceException and the template writer can use ?exists etcetera. (JR)
      return null;
//            throw new TemplateModelException("_nsprefix can not be applied on " + node.getClass());
    }
  }

代码示例来源:origin: org.freemarker/freemarker-gae

public List operate(Object node) {
      if (node instanceof Element)
        return Collections.singletonList(((Element) node).getNamespace().getPrefix());
      else if (node instanceof Attribute)
        return Collections.singletonList(((Attribute) node).getNamespace().getPrefix());
      // With 2.1 semantics it  makes more sense to just return a null and let the core 
      // throw an InvalidReferenceException and the template writer can use ?exists etcetera. (JR)
      return null;
//            throw new TemplateModelException("_nsprefix can not be applied on " + node.getClass());
    }
  }

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.freemarker

public List operate(Object node) {
      if (node instanceof Element)
        return Collections.singletonList(((Element) node).getNamespace().getURI());
      else if (node instanceof Attribute)
        return Collections.singletonList(((Attribute) node).getNamespace().getURI());
      // With 2.1 semantics it  makes more sense to just return a null and let the core 
      // throw an InvalidReferenceException and the template writer can use ?exists etcetera. (JR)
      return null;
//            throw new TemplateModelException("_nsuri can not be applied on " + node.getClass());
    }
  }

代码示例来源:origin: org.freemarker/freemarker-gae

public List operate(Object node) {
      if (node instanceof Element) {
        Element element = (Element) node;
        return Collections.singletonList(element.getNamespace().getURI() + element.getName());
      } else if (node instanceof Attribute) {
        Attribute attribute = (Attribute) node;
        return Collections.singletonList(attribute.getNamespace().getURI() + attribute.getName());
      }
      // With 2.1 semantics it  makes more sense to just return a null and let the core 
      // throw an InvalidReferenceException and the template writer can use ?exists etcetera. (JR)
      return null;
//            throw new TemplateModelException("_cname can not be applied on " + node.getClass());
    }
  }

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.freemarker

public List operate(Object node) {
      if (node instanceof Element) {
        Element element = (Element) node;
        return Collections.singletonList(element.getNamespace().getURI() + element.getName());
      } else if (node instanceof Attribute) {
        Attribute attribute = (Attribute) node;
        return Collections.singletonList(attribute.getNamespace().getURI() + attribute.getName());
      }
      // With 2.1 semantics it  makes more sense to just return a null and let the core 
      // throw an InvalidReferenceException and the template writer can use ?exists etcetera. (JR)
      return null;
//            throw new TemplateModelException("_cname can not be applied on " + node.getClass());
    }
  }

代码示例来源:origin: org.jdom/jdom-legacy

/**
 * This detaches the <code>Attribute</code> from its parent, or does
 * nothing if the <code>Attribute</code> has no parent.
 *
 * @return <code>Attribute</code> - this <code>Attribute</code> modified.
 */
public Attribute detach() {
  final Element parentElement = getParent();
  if (parentElement != null) {
    parentElement.removeAttribute(getName(),getNamespace());
  }
  return this;
}

代码示例来源:origin: org.freemarker/com.springsource.freemarker

public List operate(Object node)
    {
      if (node instanceof Element)
        return Collections12.singletonList(((Element)node).getNamespace().getURI());
      else if (node instanceof Attribute)
        return Collections12.singletonList(((Attribute)node).getNamespace().getURI());
      // With 2.1 semantics it  makes more sense to just return a null and let the core 
      // throw an InvalidReferenceException and the template writer can use ?exists etcetera. (JR)
      return null;
//            throw new TemplateModelException("_nsuri can not be applied on " + node.getClass());
    }
  }

代码示例来源:origin: org.freemarker/com.springsource.freemarker

public List operate(Object node)
    {
      if (node instanceof Element)
        return Collections12.singletonList(((Element)node).getNamespace().getPrefix());
      else if (node instanceof Attribute)
        return Collections12.singletonList(((Attribute)node).getNamespace().getPrefix());
      // With 2.1 semantics it  makes more sense to just return a null and let the core 
      // throw an InvalidReferenceException and the template writer can use ?exists etcetera. (JR)
      return null;
//            throw new TemplateModelException("_nsprefix can not be applied on " + node.getClass());
    }
  }

代码示例来源:origin: dragome/dragome-sdk

@SuppressWarnings("unchecked")
static public void process_aput_object(Element element, InstructionUseInfo i) throws DataConversionException
{
  i.requiresRetain.orEq(getDestReg(element, "vx").and(i.usesAsObj()));
  if (!i.requiresRetain.isEmpty())
  {
    Element toAdd= new Element(cmd_a_release, vm);
    for (Attribute a : (List<Attribute>) i.Instruction.getAttributes())
    {
      toAdd.setAttribute(a.getName(), a.getValue(), a.getNamespace());
    }
    i.putRelease= toAdd;
  }
  i.isWrite= false;
}

代码示例来源:origin: dragome/dragome-sdk

@SuppressWarnings("unchecked")
static public void process_iput(Element element, InstructionUseInfo i) throws DataConversionException
{
  i.requiresRetain.orEq(getDestReg(element, "vx").and(i.usesAsObj()));
  if (!i.requiresRetain.isEmpty())
  {
    // need to release before we overwrite
    Element toAdd= new Element(cmd_i_release, vm);
    for (Attribute a : (List<Attribute>) i.Instruction.getAttributes())
    {
      toAdd.setAttribute(a.getName(), a.getValue(), a.getNamespace());
    }
    i.putRelease= toAdd;
  }
  i.isWrite= false;
}

相关文章