gpt4 book ai didi

org.xmlpull.v1.builder.XmlElement.getName()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-25 21:07:05 26 4
gpt4 key购买 nike

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

XmlElement.getName介绍

[英]XML Infoset [local name] property.
[中]XML信息集[local name]属性。

代码示例

代码示例来源:origin: org.ogce/xpp3

public String getElementName(Object obj)
{
  XmlElement elem = (XmlElement) obj;
  return elem.getName();
}

代码示例来源:origin: org.ogce/xpp3

public String getElementQName(Object obj)
{
  XmlElement elem = (XmlElement) obj;
  String prefix = null;
  if(elem.getNamespace() != null) {
    //TODO REVISIT: needs to declare prefix if namesapce name != null ... or not?
    prefix = elem.getNamespace().getPrefix();
  }
  if ( prefix == null || "".equals( prefix ) )
  {
    return elem.getName();
  }
  return prefix + ":" + elem.getName();
}

代码示例来源:origin: org.ogce/xpp3

public void serializeEndTag(XmlElement el, XmlSerializer ser) {
  try {
    ser.endTag(el.getNamespaceName(), el.getName());
  } catch (IOException e) {
    throw new XmlBuilderException("serializing XML end tag failed", e);
  }
}

代码示例来源:origin: xpp3/xpp3_xpath

public String getElementQName(Object obj)
{
  XmlElement elem = (XmlElement) obj;
  String prefix = null;
  if(elem.getNamespace() != null) {
    //TODO REVISIT: needs to declare prefix if namesapce name != null ... or not?
    prefix = elem.getNamespace().getPrefix();
  }
  if ( prefix == null || "".equals( prefix ) )
  {
    return elem.getName();
  }
  return prefix + ":" + elem.getName();
}

代码示例来源:origin: xpp3/xpp3_xpath

public String getElementName(Object obj)
{
  XmlElement elem = (XmlElement) obj;
  return elem.getName();
}

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

public void serializeEndTag(XmlElement el, XmlSerializer ser) {
  try {
    ser.endTag(el.getNamespaceName(), el.getName());
  } catch (IOException e) {
    throw new XmlBuilderException("serializing XML end tag failed", e);
  }
}

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

private void findNextEl() {
  currentEl = null;
  while(children.hasNext()) {
    Object child = children.next();
    if(child instanceof XmlElement) {
      XmlElement el = (XmlElement) child;
      if( (name == null || el.getName() == name || name.equals(el.getName()))
          && (n == null || el.getNamespace() == n || n.equals(el.getNamespace()))
       )
      {
        currentEl = el;
        break;
      }
    }
  }
}

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

public String getName() {
  return target.getName();
}

代码示例来源:origin: org.ogce/xpp3

private void findNextEl() {
  currentEl = null;
  while(children.hasNext()) {
    Object child = children.next();
    if(child instanceof XmlElement) {
      XmlElement el = (XmlElement) child;
      if( (name == null || el.getName() == name || name.equals(el.getName()))
          && (n == null || el.getNamespace() == n || n.equals(el.getNamespace()))
       )
      {
        currentEl = el;
        break;
      }
    }
  }
}

代码示例来源:origin: org.ogce/xpp3

public String getName() {
  return target.getName();
}

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

public XmlElement findElementByName(String namespaceName, String name) {
  if(children == null) return null;
  int length = children.size();
  for (int i = 0; i < length; i++)
  {
    Object child = children.get(i);
    if(child instanceof XmlElement) {
      XmlElement childEl = (XmlElement) child;
      XmlNamespace namespace = childEl.getNamespace();
      if (namespace != null) {
        if ((name.equals(childEl.getName())) && (namespaceName.equals(namespace.getNamespaceName()))) {
          return childEl;
        }
      } else {
        if ((name.equals(childEl.getName())) && (namespaceName == null)) {
          return childEl;
        }
      }
    }
  }
  return null;
}

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

public XmlElement findElementByName(String name) {
  if(children == null) return null;
  int length = children.size();
  for (int i = 0; i < length; i++)
  {
    Object child = children.get(i);
    if(child instanceof XmlElement) {
      XmlElement childEl = (XmlElement) child;
      if(name.equals(childEl.getName())) {
        return childEl;
      }
    }
  }
  return null;
}

代码示例来源:origin: org.ogce/xpp3

public XmlElement findElementByName(String namespaceName, String name) {
  if(children == null) return null;
  int length = children.size();
  for (int i = 0; i < length; i++)
  {
    Object child = children.get(i);
    if(child instanceof XmlElement) {
      XmlElement childEl = (XmlElement) child;
      XmlNamespace namespace = childEl.getNamespace();
      if (namespace != null) {
        if ((name.equals(childEl.getName())) && (namespaceName.equals(namespace.getNamespaceName()))) {
          return childEl;
        }
      } else {
        if ((name.equals(childEl.getName())) && (namespaceName == null)) {
          return childEl;
        }
      }
    }
  }
  return null;
}

代码示例来源:origin: org.ogce/xpp3

public XmlElement findElementByName(String name) {
  if(children == null) return null;
  int length = children.size();
  for (int i = 0; i < length; i++)
  {
    Object child = children.get(i);
    if(child instanceof XmlElement) {
      XmlElement childEl = (XmlElement) child;
      if(name.equals(childEl.getName())) {
        return childEl;
      }
    }
  }
  return null;
}

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

public XmlElement element(XmlNamespace namespace, String name, boolean create) {
  XmlElement e = getDocumentElement();
  if(e == null) {
    return null;
  }
  String eNamespaceName = e.getNamespace() != null ? e.getNamespace().getNamespaceName() : null;
  if (namespace != null) {
    if ((name.equals(e.getName()))
        && (eNamespaceName != null && eNamespaceName.equals(namespace.getNamespaceName())))
    {
      return e;
    }
  } else {
    if ((name.equals(e.getName()))
        && (eNamespaceName == null))
    {
      return e;
    }
  }
  if(create) {
    return addDocumentElement(namespace, name);
  } else {
    return null;
  }
  
}

代码示例来源:origin: xpp3/xpp3_xpath

public String toString()
  {
    return ( "[xmlns:" + namespace.getPrefix() + "=\"" +
         namespace.getNamespaceName() + "\", element=" +
         element.getName() + "]" );
  }
}

代码示例来源:origin: org.ogce/xpp3

public XmlElement element(XmlNamespace namespace, String name, boolean create) {
  XmlElement e = getDocumentElement();
  if(e == null) {
    return null;
  }
  String eNamespaceName = e.getNamespace() != null ? e.getNamespace().getNamespaceName() : null;
  if (namespace != null) {
    if ((name.equals(e.getName()))
        && (eNamespaceName != null && eNamespaceName.equals(namespace.getNamespaceName())))
    {
      return e;
    }
  } else {
    if ((name.equals(e.getName()))
        && (eNamespaceName == null))
    {
      return e;
    }
  }
  if(create) {
    return addDocumentElement(namespace, name);
  } else {
    return null;
  }
  
}

代码示例来源:origin: org.ogce/xpp3

public String toString()
  {
    return ( "[xmlns:" + namespace.getPrefix() + "=\"" +
         namespace.getNamespaceName() + "\", element=" +
         element.getName() + "]" );
  }
}

代码示例来源:origin: org.ogce/xpp3

public void testSelection() throws Exception
  {
    XPath xpath = new Xb1XPath( "/foo/bar/baz" );
    
    XmlInfosetBuilder builder = XmlInfosetBuilder.newInstance();
    
    XmlDocument doc = builder.parseReader( new StringReader( BASIC_XML ));
    
    List results = xpath.selectNodes( doc );
    
    assertEquals( 3,
           results.size() );
    
    Iterator iter = results.iterator();
    
    assertEquals( "baz",
             ((XmlElement)iter.next()).getName() );
    
    assertEquals( "baz",
             ((XmlElement)iter.next()).getName() );
    
    assertEquals( "baz",
             ((XmlElement)iter.next()).getName() );
    
    assertTrue( ! iter.hasNext() );
    
  }
}

代码示例来源:origin: org.apache.airavata/airavata-xbaya-gui

if("ErrorResponse".equals(XMLUtil.stringToXmlElement3(this.getOutputMessage().toString()).getName())){

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com