gpt4 book ai didi

org.ow2.util.xml.XMLUtils.getStringValueElement()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-18 22:00:40 28 4
gpt4 key购买 nike

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

XMLUtils.getStringValueElement介绍

[英]Returns the value of the given node or null if the node is not found.
[中]返回给定节点的值,如果找不到该节点,则返回null

代码示例

代码示例来源:origin: org.ow2.util/util-xml

/**
 * Returns the value of the given node or <code>null</code> if the node is not found.
 * @param ns the namespace.
 * @param base the element from where to search.
 * @param name of the element to get.
 * @return the value of this element or null if the element does not exists.
 */
public static String getStringValueElement(final String ns, final Element base, final String name) {
  return getStringValueElement(ns, base, name, true);
}

代码示例来源:origin: org.ow2.util.xml/xml

/**
 * Returns the value of the given node. (value trimed by default)
 * @param base the element from where to search.
 * @param name of the element to get.
 * @return the value of this element.
 */
public static String getStringValueElement(final Element base, final String name) {
  return getStringValueElement(base, name, true);
}

代码示例来源:origin: org.ow2.util.xml/xml

/**
 * Returns the value of the given node or <code>null</code> if the node is not found.
 * @param ns the namespace.
 * @param base the element from where to search.
 * @param name of the element to get.
 * @return the value of this element or null if the element does not exists.
 */
public static String getStringValueElement(final String ns, final Element base, final String name) {
  return getStringValueElement(ns, base, name, true);
}

代码示例来源:origin: org.ow2.util/util-xml

/**
 * Returns the value of the given node. (value trimed by default)
 * @param base the element from where to search.
 * @param name of the element to get.
 * @return the value of this element.
 */
public static String getStringValueElement(final Element base, final String name) {
  return getStringValueElement(base, name, true);
}

代码示例来源:origin: org.ow2.util.metadata/metadata-common-impl

/**
 * Analyze the handler-chain element and find the protocol-bindings values.
 *
 * @param handlerChainElement given XML element which contains handler-chain.
 * @param handlerChain the struct object representing the XML element.
 */
private void analyzeProtocolBindings(final Element handlerChainElement, final HandlerChain handlerChain) {
  // protocol-bindings
  String bindingsValue = XMLUtils.getStringValueElement(getXMLNS(), handlerChainElement, "protocol-bindings");
  if (bindingsValue != null) {
    String[] bindings = bindingsValue.split(" ");
    for (String binding : bindings) {
      handlerChain.addProtocolBinding(binding);
    }
  }
}

代码示例来源:origin: org.ow2.util/util-ee-metadata-common-impl

/**
 * Analyze the handler element and fill the init values Map.
 *
 * @param handlerElement given XML element which contains init-param.
 * @param handler        the struct object representing the XML element.
 */
private void analyzeInitParam(final Element handlerElement, final Handler handler) {
  NodeList initParamList = handlerElement.getElementsByTagNameNS(getXMLNS(), "init-param");
  for (int i = 0; i < initParamList.getLength(); i++) {
    // There is a init-param element
    Element initParamElement = (Element) initParamList.item(i);
    // param-name
    String name = XMLUtils.getStringValueElement(getXMLNS(), handlerElement, "param-name");
    // param-value
    String value = XMLUtils.getStringValueElement(getXMLNS(), handlerElement, "param-value");
    handler.addInitParam(name, value);
  }
}

代码示例来源:origin: org.ow2.util/util-ee-metadata-common-impl

/**
 * Analyze the handler-chain element and find the protocol-bindings values.
 *
 * @param handlerChainElement given XML element which contains handler-chain.
 * @param handlerChain        the struct object representing the XML element.
 */
private void analyzeProtocolBindings(final Element handlerChainElement, final HandlerChain handlerChain) {
  // protocol-bindings
  String bindingsValue = XMLUtils.getStringValueElement(getXMLNS(), handlerChainElement, "protocol-bindings");
  if (bindingsValue != null) {
    String[] bindings = bindingsValue.split(" ");
    for (String binding : bindings) {
      handlerChain.addProtocolBinding(binding);
    }
  }
}

代码示例来源:origin: org.ow2.util.metadata/metadata-common-impl

/**
 * Analyze the handler element and fill the init values Map.
 *
 * @param handlerElement given XML element which contains init-param.
 * @param handler the struct object representing the XML element.
 */
private void analyzeInitParam(final Element handlerElement, final Handler handler) {
  NodeList initParamList = handlerElement.getElementsByTagNameNS(getXMLNS(), "init-param");
  for (int i = 0; i < initParamList.getLength(); i++) {
    // There is a init-param element
    Element initParamElement = (Element) initParamList.item(i);
    // param-name
    String name = XMLUtils.getStringValueElement(getXMLNS(), handlerElement, "param-name");
    // param-value
    String value = XMLUtils.getStringValueElement(getXMLNS(), handlerElement, "param-value");
    handler.addInitParam(name, value);
  }
}

代码示例来源:origin: org.ow2.util/util-ee-metadata-common-impl

/**
 * Analyze the ejb-ref/local-ref element and find the sub-elements.
 *
 * @param refElement given XML element which contains ejb-ref-name,
 *                   ejb-ref-type, etc.
 * @param ref        the struct object representing the XML element.
 */
private void analyzeCommonEJBRef(final Element refElement, final AbsEJBRef ref) {
  // ejb-ref-name
  String ejbRefName = XMLUtils.getStringValueElement(getXMLNS(), refElement, "ejb-ref-name");
  ref.setEjbRefName(ejbRefName);
  // ejb-ref-type
  String ejbRefType = XMLUtils.getStringValueElement(getXMLNS(), refElement, "ejb-ref-type");
  ref.setEjbRefType(ejbRefType);
  // mapped-name
  String mappedName = XMLUtils.getStringValueElement(getXMLNS(), refElement, "mapped-name");
  ref.setMappedName(mappedName);
  // lookup-name
  String lookupName = XMLUtils.getStringValueElement(getXMLNS(), refElement, "lookup-name");
  ref.setLookupName(lookupName);
  // ejb-link
  String ejbLink = XMLUtils.getStringValueElement(getXMLNS(), refElement, "ejb-link");
  ref.setEjbLink(ejbLink);
  // Analyze injection-target
  analyzeInjectionTarget(refElement, ref);
}

代码示例来源:origin: org.ow2.util/util-ee-metadata-common-impl

/**
 * Analyze the environment element and find the security-role-ref element.
 *
 * @param envElement given XML element which contains security-role-ref.
 * @param env        the struct object representing the XML element.
 */
private void analyzeSecurityRoleRef(final Element envElement, final IEnvironment env) {
  NodeList securityRoleRefList = envElement.getElementsByTagNameNS(getXMLNS(), ISecurityRoleRef.NAME);
  // Loop on this list
  for (int i = 0; i < securityRoleRefList.getLength(); i++) {
    Element securityRoleRefElement = (Element) securityRoleRefList.item(i);
    SecurityRoleRef securityRoleRef = new SecurityRoleRef();
    // name
    String roleName = XMLUtils.getStringValueElement(getXMLNS(), securityRoleRefElement, "role-name");
    securityRoleRef.setRoleName(roleName);
    // link
    String roleLink = XMLUtils.getStringValueElement(getXMLNS(), securityRoleRefElement, "role-link");
    securityRoleRef.setRoleLink(roleLink);
    // add security-role-ref in environment element
    env.addSecurityRoleRef(securityRoleRef);
  }
}

代码示例来源:origin: org.ow2.util.metadata/metadata-common-impl

/**
 * Analyze the environment element and find the security-role-ref element.
 *
 * @param envElement given XML element which contains security-role-ref.
 * @param env the struct object representing the XML element.
 */
private void analyzeSecurityRoleRef(final Element envElement, final IEnvironment env) {
  NodeList securityRoleRefList = envElement.getElementsByTagNameNS(getXMLNS(), ISecurityRoleRef.NAME);
  // Loop on this list
  for (int i = 0; i < securityRoleRefList.getLength(); i++) {
    Element securityRoleRefElement = (Element) securityRoleRefList.item(i);
    SecurityRoleRef securityRoleRef = new SecurityRoleRef();
    // name
    String roleName = XMLUtils.getStringValueElement(getXMLNS(), securityRoleRefElement, "role-name");
    securityRoleRef.setRoleName(roleName);
    // link
    String roleLink = XMLUtils.getStringValueElement(getXMLNS(), securityRoleRefElement, "role-link");
    securityRoleRef.setRoleLink(roleLink);
    // add security-role-ref in environment element
    env.addSecurityRoleRef(securityRoleRef);
  }
}

代码示例来源:origin: org.ow2.util/util-ee-metadata-common-impl

/**
 * Analyze the injection-target element and add them to the given resource
 * group object used by ejb-ref, ejb-local-ref, resource-ref, etc.
 *
 * @param refElement    given XML element which contains a resource element.
 * @param resourceGroup the struct object representing the XML element.
 */
private void analyzeInjectionTarget(final Element refElement, final IResourceGroup resourceGroup) {
  // injection target
  NodeList injectionTargetList = refElement.getElementsByTagNameNS(getXMLNS(), "injection-target");
  for (int j = 0; j < injectionTargetList.getLength(); j++) {
    Element injectionTargetElement = (Element) injectionTargetList.item(j);
    // Build Object and add it
    InjectionTarget injectionTarget = new InjectionTarget();
    // Get class name
    String className =
      XMLUtils.getStringValueElement(getXMLNS(), injectionTargetElement, "injection-target-class");
    injectionTarget.setClassname(className);
    // Get target
    String targetName =
      XMLUtils.getStringValueElement(getXMLNS(), injectionTargetElement, "injection-target-name");
    injectionTarget.setTargetName(targetName);
    resourceGroup.addInjectionTarget(injectionTarget);
  }
}

代码示例来源:origin: org.ow2.util.metadata/metadata-common-impl

private void analyzeHandlers(final Element handlerChainElement, final HandlerChain handlerChain) {
  NodeList handlerList = handlerChainElement.getElementsByTagNameNS(getXMLNS(), "handler");
  for (int i = 0; i < handlerList.getLength(); i++) {
    // There is a handler element
    Element handlerElement = (Element) handlerList.item(i);
    // handler-name
    String name = XMLUtils.getStringValueElement(getXMLNS(), handlerElement, "handler-name");
    // handler-class
    String classname = XMLUtils.getStringValueElement(getXMLNS(), handlerElement, "handler-class");
    Handler handler = new Handler(name, classname);
    handlerChain.addHandler(handler);
    // soap-header
    QName soapHeader = XMLUtils.getChildValueAsQName(handlerElement, "soap-header");
    handler.setSoapHeader(soapHeader);
    // soap-role
    String soapRole = XMLUtils.getStringValueElement(getXMLNS(), handlerElement, "soap-role");
    handler.setSoapRole(soapRole);
    // init-param
    analyzeInitParam(handlerElement, handler);
  }
}

代码示例来源:origin: org.ow2.util/util-ee-metadata-common-impl

private void analyzeHandlers(final Element handlerChainElement, final HandlerChain handlerChain) {
  NodeList handlerList = handlerChainElement.getElementsByTagNameNS(getXMLNS(), "handler");
  for (int i = 0; i < handlerList.getLength(); i++) {
    // There is a handler element
    Element handlerElement = (Element) handlerList.item(i);
    // handler-name
    String name = XMLUtils.getStringValueElement(getXMLNS(), handlerElement, "handler-name");
    // handler-class
    String classname = XMLUtils.getStringValueElement(getXMLNS(), handlerElement, "handler-class");
    Handler handler = new Handler(name, classname);
    handlerChain.addHandler(handler);
    // soap-header
    QName soapHeader = XMLUtils.getChildValueAsQName(handlerElement, "soap-header");
    handler.setSoapHeader(soapHeader);
    // soap-role
    String soapRole = XMLUtils.getStringValueElement(getXMLNS(), handlerElement, "soap-role");
    handler.setSoapRole(soapRole);
    // init-param
    analyzeInitParam(handlerElement, handler);
  }
}

代码示例来源:origin: org.ow2.util.metadata/metadata-common-impl

/**
 * Analyze the environment element and find the ejb-ref element.
 *
 * @param envElement given XML element which contains ejb-ref.
 * @param env the struct object representing the XML element.
 */
private void analyzeEJBRef(final Element envElement, final IEnvironment env) {
  NodeList ejbRefList = envElement.getElementsByTagNameNS(getXMLNS(), EJBRef.NAME);
  // Loop on this list
  for (int i = 0; i < ejbRefList.getLength(); i++) {
    Element ejbRefElement = (Element) ejbRefList.item(i);
    EJBRef ejbRef = new EJBRef();
    analyzeCommonEJBRef(ejbRefElement, ejbRef);
    // remote
    String remote = XMLUtils.getStringValueElement(getXMLNS(), ejbRefElement, "remote");
    ejbRef.setRemote(remote);
    // home
    String home = XMLUtils.getStringValueElement(getXMLNS(), ejbRefElement, "home");
    ejbRef.setHome(home);
    // add ejb-ref in environment element
    env.addEJBRef(ejbRef);
  }
}

代码示例来源:origin: org.ow2.util.metadata/metadata-common-impl

/**
 * Analyze the injection-target element and add them to the given resource
 * group object used by ejb-ref, ejb-local-ref, resource-ref, etc.
 *
 * @param refElement given XML element which contains a resource element.
 * @param resourceGroup the struct object representing the XML element.
 */
private void analyzeInjectionTarget(final Element refElement, final IResourceGroup resourceGroup) {
  // injection target
  NodeList injectionTargetList = refElement.getElementsByTagNameNS(getXMLNS(), "injection-target");
  for (int j = 0; j < injectionTargetList.getLength(); j++) {
    Element injectionTargetElement = (Element) injectionTargetList.item(j);
    // Build Object and add it
    InjectionTarget injectionTarget = new InjectionTarget();
    // Get class name
    String className =
      XMLUtils.getStringValueElement(getXMLNS(), injectionTargetElement, "injection-target-class");
    injectionTarget.setClassname(className);
    // Get target
    String targetName =
      XMLUtils.getStringValueElement(getXMLNS(), injectionTargetElement, "injection-target-name");
    injectionTarget.setTargetName(targetName);
    resourceGroup.addInjectionTarget(injectionTarget);
  }
}

代码示例来源:origin: org.ow2.util.metadata/metadata-common-impl

String resRefName = XMLUtils.getStringValueElement(getXMLNS(), resourceRefElement, "res-ref-name");
resourceRef.setResRefName(resRefName);
String resRefType = XMLUtils.getStringValueElement(getXMLNS(), resourceRefElement, "res-type");
resourceRef.setResRefType(resRefType);
String mappedName = XMLUtils.getStringValueElement(getXMLNS(), resourceRefElement, "mapped-name");
resourceRef.setMappedName(mappedName);
String lookupName = XMLUtils.getStringValueElement(getXMLNS(), resourceRefElement, "lookup-name");
resourceRef.setLookupName(lookupName);

代码示例来源:origin: org.ow2.util/util-ee-metadata-common-impl

/**
 * Analyze the environment element and find the ejb-ref element.
 *
 * @param envElement given XML element which contains ejb-ref.
 * @param env        the struct object representing the XML element.
 */
private void analyzeEJBRef(final Element envElement, final IEnvironment env) {
  NodeList ejbRefList = envElement.getElementsByTagNameNS(getXMLNS(), EJBRef.NAME);
  // Loop on this list
  for (int i = 0; i < ejbRefList.getLength(); i++) {
    Element ejbRefElement = (Element) ejbRefList.item(i);
    EJBRef ejbRef = new EJBRef();
    analyzeCommonEJBRef(ejbRefElement, ejbRef);
    // remote
    String remote = XMLUtils.getStringValueElement(getXMLNS(), ejbRefElement, "remote");
    ejbRef.setRemote(remote);
    // home
    String home = XMLUtils.getStringValueElement(getXMLNS(), ejbRefElement, "home");
    ejbRef.setHome(home);
    // add ejb-ref in environment element
    env.addEJBRef(ejbRef);
  }
}

代码示例来源:origin: org.ow2.util/util-ee-metadata-common-impl

/**
 * Analyze the environment element and find the ejb-local-ref element.
 *
 * @param envElement given XML element which contains ejb-local-ref.
 * @param env        the struct object representing the XML element.
 */
private void analyzeEJBLocalRef(final Element envElement, final IEnvironment env) {
  NodeList ejbLocalRefList = envElement.getElementsByTagNameNS(getXMLNS(), IEJBLocalRef.NAME);
  // Loop on this list
  for (int i = 0; i < ejbLocalRefList.getLength(); i++) {
    Element ejbRefElement = (Element) ejbLocalRefList.item(i);
    EJBLocalRef ejbLocalRef = new EJBLocalRef();
    analyzeCommonEJBRef(ejbRefElement, ejbLocalRef);
    // local
    String local = XMLUtils.getStringValueElement(getXMLNS(), ejbRefElement, "local");
    ejbLocalRef.setLocal(local);
    // local-home
    String localHome = XMLUtils.getStringValueElement(getXMLNS(), ejbRefElement, "local-home");
    ejbLocalRef.setLocalHome(localHome);
    // add ejb-local-ref in environment element
    env.addEJBLocalRef(ejbLocalRef);
  }
}

代码示例来源:origin: org.ow2.util.metadata/metadata-common-impl

/**
 * Analyze the environment element and find the ejb-local-ref element.
 *
 * @param envElement given XML element which contains ejb-local-ref.
 * @param env the struct object representing the XML element.
 */
private void analyzeEJBLocalRef(final Element envElement, final IEnvironment env) {
  NodeList ejbLocalRefList = envElement.getElementsByTagNameNS(getXMLNS(), IEJBLocalRef.NAME);
  // Loop on this list
  for (int i = 0; i < ejbLocalRefList.getLength(); i++) {
    Element ejbRefElement = (Element) ejbLocalRefList.item(i);
    EJBLocalRef ejbLocalRef = new EJBLocalRef();
    analyzeCommonEJBRef(ejbRefElement, ejbLocalRef);
    // local
    String local = XMLUtils.getStringValueElement(getXMLNS(), ejbRefElement, "local");
    ejbLocalRef.setLocal(local);
    // local-home
    String localHome = XMLUtils.getStringValueElement(getXMLNS(), ejbRefElement, "local-home");
    ejbLocalRef.setLocalHome(localHome);
    // add ejb-local-ref in environment element
    env.addEJBLocalRef(ejbLocalRef);
  }
}

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