gpt4 book ai didi

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

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

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

XmlElement.getNamespace介绍

[英]Return namespace of current element (XML Infoset [namespace name] and [prefix] properties combined) null is only returned if element was created without namespace
[中]当前元素的返回名称空间(XML Infoset[namespace name]和[prefix]属性的组合)只有在创建元素时没有名称空间,才会返回null

代码示例

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

public XmlNamespace getNamespace() {
  return target.getNamespace();
}

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

public void serializeStartTag(XmlElement el, XmlSerializer ser) {
  try {
    XmlNamespace elNamespace = el.getNamespace();
    String elPrefix = (elNamespace != null) ? elNamespace.getPrefix() : "";
    if(elPrefix == null) {

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

public XmlNamespace getNamespace() {
  return target.getNamespace();
}

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

public void serializeStartTag(XmlElement el, XmlSerializer ser) {
  try {
    XmlNamespace elNamespace = el.getNamespace();
    String elPrefix = (elNamespace != null) ? elNamespace.getPrefix() : "";
    if(elPrefix == null) {

代码示例来源: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: 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 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 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

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 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 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 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

XmlNamespace ns = current.getNamespace();

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

XmlNamespace ns = current.getNamespace();

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