nu.xom.Element.getLocalName()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(6.7k)|赞(0)|评价(0)|浏览(304)

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

Element.getLocalName介绍

暂无

代码示例

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

public String toString()
  {
    return ( "[xmlns:" + prefix + "=\"" +
        uri + "\", element=" +
        element.getLocalName() + "]" );
  }
}

代码示例来源:origin: com.thoughtworks.xstream/xstream

public String getNodeName() {
  return decodeNode(currentElement.getLocalName());
}

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

public String getElementName(Object o) {
  return (isElement(o) ? ((Element)o).getLocalName() : null);
}

代码示例来源:origin: com.thoughtworks.xstream/xstream

public String peekNextChild() {
    Elements children = currentElement.getChildElements();
    if (null == children || children.size() == 0) {
      return null;
    }
    return decodeNode(children.get(0).getLocalName());
  }
}

代码示例来源:origin: wiztools/rest-client

static Auth getAuth(Element eAuth) {
  Elements eChildren = eAuth.getChildElements();
  for(int i=0; i<eChildren.size(); i++) {
    Element e = eChildren.get(i);
    final String name = e.getLocalName();
    if(name.equals("basic")) {
      return getBasicAuth(e);
    }
    else if(name.equals("digest")) {
      return getDigestAuth(e);
    }
    else if(name.equals("ntlm")) {
      return getNtlmAuth(e);
    }
    else if(name.equals("oauth2-bearer")) {
      return getOAuth2BearerAuth(e);
    }
    else {
      throw new XMLException("Invalid auth element encountered: " + name);
    }
  }
  return null;
}

代码示例来源:origin: wiztools/rest-client

static OAuth2BearerAuth getOAuth2BearerAuth(Element eAuth) {
  OAuth2BearerAuthBean out = new OAuth2BearerAuthBean();
  
  Elements eChildren = eAuth.getChildElements();
  for(int i=0; i<eChildren.size(); i++) {
    Element e = eChildren.get(i);
    final String name = e.getLocalName();
    if(name.equals("token")) {
      out.setOAuth2BearerToken(e.getValue());
    }
    else {
      throw new XMLException("Unknown element in oauth2-bearer auth: " + name);
    }
  }
  
  return out;
}

代码示例来源:origin: wiztools/rest-client

public static List<Request> getRequestCollectionFromXMLFile(final File f)
    throws IOException, XMLException {
  XmlPersistenceRead xUtlRead = new XmlPersistenceRead();
  
  List<Request> out = new ArrayList<>();
  Document doc = xUtlRead.getDocumentFromFile(f);
  Element eRoot = doc.getRootElement();
  if(!"request-collection".equals(eRoot.getLocalName())) {
    throw new XMLException("Expecting root element <request-collection>, but found: "
        + eRoot.getLocalName());
  }
  final String version = eRoot.getAttributeValue("version");
  try {
    Versions.versionValidCheck(version);
  }
  catch(Versions.VersionValidationException ex) {
    throw new XMLException(ex);
  }
  xUtlRead.setReadVersion(version);
  
  Elements eRequests = doc.getRootElement().getChildElements();
  for(int i=0; i<eRequests.size(); i++) {
    Element eRequest = eRequests.get(i);
    Request req = xUtlRead.getRequestBean(eRequest);
    out.add(req);
  }
  return out;
}

代码示例来源:origin: wiztools/rest-client

static void populateBasicDigestAuth(BasicDigestAuthBaseBean bean, Element eAuth) {
  Elements eChildren = eAuth.getChildElements();
  for(int i=0; i<eChildren.size(); i++) {
    Element e = eChildren.get(i);
    final String name = e.getLocalName();
    if(name.equals("host")) {
      bean.setHost(e.getValue());
    }
    else if(name.equals("realm")) {
      bean.setRealm(e.getValue());
    }
    else if(name.equals("username")) {
      bean.setUsername(e.getValue());
    }
    else if(name.equals("password")) {
      bean.setPassword(getPassword(e));
    }
    else if(name.equals("preemptive")) {
      bean.setPreemptive(true);
    }
    else {
      throw new XMLException("Unknown element in basic/digest auth: " + name);
    }
  }
}

代码示例来源:origin: wiztools/rest-client

for(int i=0; i<eChildren.size(); i++) {
  Element e = eChildren.get(i);
  final String name = e.getLocalName();
  if("string".equals(name)) {
    ContentType ct = getContentType(e);

代码示例来源:origin: wiztools/rest-client

static NtlmAuth getNtlmAuth(Element eNtlmAuth) {
  NtlmAuthBean out = new NtlmAuthBean();
  
  Elements eChildren = eNtlmAuth.getChildElements();
  for(int i=0; i<eChildren.size(); i++) {
    Element e = eChildren.get(i);
    final String name = e.getLocalName();
    if(name.equals("domain")) {
      out.setDomain(e.getValue());
    }
    else if(name.equals("workstation")) {
      out.setWorkstation(e.getValue());
    }
    else if(name.equals("username")) {
      out.setUsername(e.getValue());
    }
    else if(name.equals("password")) {
      out.setPassword(getPassword(e));
    }
    else {
      throw new XMLException("Unknown element in ntlm auth: " + name);
    }
  }
  
  return out;
}

代码示例来源:origin: wiztools/rest-client

private ReqEntityPart getMultipartPart(Element e) {
  final String name = e.getLocalName();

代码示例来源:origin: wiztools/rest-client

for(int i=0; i<eChildren.size(); i++) {
  Element e = eChildren.get(i);
  final String name = e.getLocalName();
  if(null != name) switch (name) {
    case "trust-self-signed-cert": // backward-compatibility...

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

private boolean isBodySection(Node child) {
    return (child instanceof Element) && 
      ((Element) child).getLocalName().equals("body");
  }
}

代码示例来源:origin: com.io7m.jstructural/io7m-jstructural-xom

private static SSubsectionContent subsectionContent(
 final Element e)
 throws URISyntaxException
{
 if ("paragraph".equals(e.getLocalName())) {
  return SDocumentParser.paragraph(e);
 } else if ("formal-item".equals(e.getLocalName())) {
  return SDocumentParser.formalItem(e);
 }
 throw new UnreachableCodeException();
}

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

/**
 * Checks XML element local name and namespace URI.
 *
 * @param element XML element to check
 * @param xmlName XML element name
 * @return True if the element matches the localname and namespace URI. Otherwise, false.
 */
protected boolean isInstanceOf(Element element, XmlName xmlName) {
  return (xmlName.getLocalName().equals(element.getLocalName()) &&
    xmlName.getNamespace().equals(element.getNamespaceURI()));
}

代码示例来源:origin: org.dspace/dspace-sword-api

public XmlName(Element element)
{
  this.prefix = element.getNamespacePrefix();
  this.localName = element.getLocalName();
  this.namespace = element.getNamespaceURI();
}

代码示例来源:origin: x-stream/xstream

@Override
  public String peekNextChild() {
    final Elements children = currentElement.getChildElements();
    if (null == children || children.size() == 0) {
      return null;
    }
    return decodeNode(children.get(0).getLocalName());
  }
}

代码示例来源:origin: org.jvnet.hudson/xstream

public String peekNextChild() {
  Elements children = currentElement.getChildElements();
  if(children.size()==0)  return null;
  return unescapeXmlName(children.get(0).getLocalName());
}

代码示例来源:origin: com.haulmont.thirdparty/xstream

public String peekNextChild() {
    Elements children = currentElement.getChildElements();
    if (null == children || children.size() == 0) {
      return null;
    }
    return decodeNode(children.get(0).getLocalName());
  }
}

代码示例来源:origin: org.sonatype.nexus.xstream/xstream

public String peekNextChild() {
    Elements children = currentElement.getChildElements();
    if (null == children || children.size() == 0) {
      return null;
    }
    return decodeNode(children.get(0).getLocalName());
  }
}

相关文章