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

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

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

Element.getQualifiedName介绍

暂无

代码示例

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

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

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

private Map<String, String> getHeadersFromHeaderNode(final Element node)
    throws XMLException {
  Map<String, String> m = new LinkedHashMap<>();
  for (int i = 0; i < node.getChildElements().size(); i++) {
    Element headerElement = node.getChildElements().get(i);
    if (!"header".equals(headerElement.getQualifiedName())) {
      throw new XMLException("<headers> element should contain only <header> elements");
    }
    m.put(headerElement.getAttributeValue("key"),
        headerElement.getAttributeValue("value"));
  }
  return m;
}

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

private List<HttpCookie> getCookiesFromCookiesNode(final Element node) 
    throws XMLException {
  List<HttpCookie> out = new ArrayList<>();
  
  for (int i = 0; i < node.getChildElements().size(); i++) {
    Element e = node.getChildElements().get(i);
    if(!"cookie".equals(e.getQualifiedName())) {
      throw new XMLException("<cookies> element should contain only <cookie> elements");
    }
    
    HttpCookie cookie = new HttpCookie(e.getAttributeValue("name"),
        e.getAttributeValue("value"));
    final String cookieVerStr = e.getAttributeValue("version");
    if(StringUtil.isNotEmpty(cookieVerStr)) {
      cookie.setVersion(Integer.parseInt(cookieVerStr));
    }
    else {
      cookie.setVersion(CookieVersion.DEFAULT_VERSION.getIntValue());
    }
    out.add(cookie);
  }
  
  return out;
}

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

String nodeName = tNode.getQualifiedName();
if ("http-version".equals(nodeName)) {
  String t = tNode.getValue();

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

if (!"rest-client".equals(rootNode.getQualifiedName())) {
  throw new XMLException("Root node is not <rest-client>");
for (int i = 0; i < responseNode.getChildElements().size(); i++) {
  tNode = responseNode.getChildElements().get(i);
  String nodeName = tNode.getQualifiedName();
      String nn = tNode.getQualifiedName();
      if ("run-count".equals(nn)) {
        throw new XMLException("<headers> element should contain only <header> elements");

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

protected Request xml2Request(final Document doc)
    throws MalformedURLException, XMLException {
  // get the rootNode
  Element rootNode = doc.getRootElement();
  if (!"rest-client".equals(rootNode.getQualifiedName())) {
    throw new XMLException("Root node is not <rest-client>");
  }
  // checking correct rest version
  final String rcVersion = rootNode.getAttributeValue("version");
  try {
    Versions.versionValidCheck(rcVersion);
  }
  catch(Versions.VersionValidationException ex) {
    throw new XMLException(ex);
  }
  
  readVersion = rcVersion;
  // if more than two request element is present then throw the exception 
  if (rootNode.getChildElements().size() != 1) {
    throw new XMLException("There can be only one child node for root node: <request>");
  }
  // minimum one request element is present in xml 
  if (rootNode.getFirstChildElement("request") == null) {
    throw new XMLException("The child node of <rest-client> should be <request>");
  }
  Element requestNode = rootNode.getFirstChildElement("request");
  
  return getRequestBean(requestNode);
}

代码示例来源:origin: org.openbase/jul.extension.xml

public MissingAttributeException(final String attributeName, final Element sourceElement) {
    super("Missing Attribute["+attributeName+"] for Element["+sourceElement.getQualifiedName()+"].");
  }
}

代码示例来源:origin: org.openbase/jul.extension.xml

public MissingAttributeException(final String attributeName, final Element sourceElement, final Exception cause) {
  super("Missing Attribute["+attributeName+"] for Element["+sourceElement.getQualifiedName()+"].", cause);
}

代码示例来源:origin: org.openbase/jul.extension.xml

public static int parseIntegerAttributeValue(final String attributeName, final Element sourceElement) throws MissingAttributeException, XMLParsingException {
  try {
    return Integer.parseInt(parseAttributeValue(attributeName, sourceElement));
  } catch (NumberFormatException ex) {
    throw new XMLParsingException("Could not parse integer attribute[" + attributeName + "] for element[" + sourceElement.getQualifiedName() + "].", ex);
  }
}

代码示例来源:origin: org.openbase/jul.extension.xml

public static <T extends Enum<T>> T parseEnumAttributeValue(final String attributeName, final Element sourceElement, final Class<T> enumType) throws MissingAttributeException, XMLParsingException {
  String attributeValue = parseAttributeValue(attributeName, sourceElement);
  try {
    return Enum.valueOf(enumType, attributeValue);
  } catch (java.lang.IllegalArgumentException ex) {
    throw new XMLParsingException("Could not resolve enum value[" + attributeValue + "] out of attribute[" + attributeName + "] for element[" + sourceElement.getQualifiedName() + "].", ex);
  }
}

代码示例来源:origin: org.openscience.cdk/cdk-pcore

private static HashMap<String, String> getGroupDefinitions(Element e) {
  HashMap<String, String> groups = new HashMap<String, String>();
  Elements children = e.getChildElements();
  for (int i = 0; i < children.size(); i++) {
    Element child = children.get(i);
    if (child.getQualifiedName().equals("group")) {
      String id = child.getAttributeValue("id").trim();
      String smarts = child.getValue().trim();
      groups.put(id, smarts);
    }
  }
  return groups;
}

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

private static HashMap<String, String> getGroupDefinitions(Element e) {
  HashMap<String, String> groups = new HashMap<String, String>();
  Elements children = e.getChildElements();
  for (int i = 0; i < children.size(); i++) {
    Element child = children.get(i);
    if (child.getQualifiedName().equals("group")) {
      String id = child.getAttributeValue("id").trim();
      String smarts = child.getValue().trim();
      groups.put(id, smarts);
    }
  }
  return groups;
}

代码示例来源:origin: org.jboss.teiid/teiid-engine

/**
 * Get the display name of this node. For elements and attributes this is
 * [prefix:]localname. For unnamed nodes, it is an empty string.
 *
 * @return The display name of this node. For a node with no name, return an
 *         empty string.
 */
public String getDisplayName() {
  switch (nodeKind) {
    case Type.ELEMENT:
      return ((Element) node).getQualifiedName();
    case Type.ATTRIBUTE:
      return ((Attribute) node).getQualifiedName();
    case Type.PROCESSING_INSTRUCTION:
      return ((ProcessingInstruction) node).getTarget();
    default:
      return "";
  }
}

代码示例来源:origin: org.openbase/jul.extension.xml

public static Elements parseChildElements(final Element sourceElement, final String childElementName, final boolean atLeastOne) throws XMLParsingException {
  Elements childElements = sourceElement.getChildElements(childElementName);
  if (atLeastOne && childElements.size() == 0) {
    throw new XMLParsingException("Missing at least one element[" + childElementName + "] for parent element[" + sourceElement.getQualifiedName() + "].");
  }
  return childElements;
}

代码示例来源:origin: org.openscience.cdk/cdk-pcore

private static List<PharmacophoreQuery> getdefs(Document doc) throws CDKException {
  Element root = doc.getRootElement();
  // ltes get the children of the container
  // these will be either group or pharmacophore elems
  List<PharmacophoreQuery> ret = new ArrayList<PharmacophoreQuery>();
  // get global group defs
  HashMap<String, String> groups = getGroupDefinitions(root);
  //now get the pcore defs
  Elements children = root.getChildElements();
  for (int i = 0; i < children.size(); i++) {
    Element e = children.get(i);
    if (e.getQualifiedName().equals("pharmacophore")) ret.add(processPharmacophoreElement(e, groups));
  }
  return ret;
}

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

private static List<PharmacophoreQuery> getdefs(Document doc) throws CDKException {
  Element root = doc.getRootElement();
  // ltes get the children of the container
  // these will be either group or pharmacophore elems
  List<PharmacophoreQuery> ret = new ArrayList<PharmacophoreQuery>();
  // get global group defs
  HashMap<String, String> groups = getGroupDefinitions(root);
  //now get the pcore defs
  Elements children = root.getChildElements();
  for (int i = 0; i < children.size(); i++) {
    Element e = children.get(i);
    if (e.getQualifiedName().equals("pharmacophore")) ret.add(processPharmacophoreElement(e, groups));
  }
  return ret;
}

代码示例来源:origin: cmu-phil/tetrad

public BayesIm getBayesIm(Element element) {
  if (!"bayesNet".equals(element.getQualifiedName())) {
    throw new IllegalArgumentException("Expecting 'bayesNet' element.");
  }
  Elements elements = element.getChildElements();
  Element element0 = elements.get(0);
  Element element1 = elements.get(1);
  Element element2 = elements.get(2);
  List<Node> variables = getVariables(element0);
  BayesPm bayesPm = makeBayesPm(variables, element1);
  return makeBayesIm(bayesPm, element2);
}

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

protected SwordValidationInfo handleIncorrectElement(Element element, Properties validationProperties)
  throws UnmarshallException {
  log.error(
    "Unexpected element. Expected: " + getQualifiedName() + ". Got: " +
      ((element != null) ? element.getQualifiedName() : "null"));
  if (validationProperties != null) {
    SwordValidationInfo info = new SwordValidationInfo(
      new XmlName(element.getNamespacePrefix(), element.getLocalName(),
            element.getNamespaceURI()),
      "This is not the expected element. Received: " +
        element.getQualifiedName() + " for namespaceUri: " +
        element.getNamespaceURI(), SwordValidationInfoType.ERROR
    );
    return info;
  } else {
    throw new UnmarshallException("Not a " + getQualifiedName() + " element");
  }
}

代码示例来源:origin: cmu-phil/tetrad

private static void addMarginalErrorDistribution(Element marginalDistributionElement, SemIm semIm) {
  if (!SemXmlConstants.MARGINAL_ERROR_DISTRIBUTION.equals(marginalDistributionElement.getQualifiedName())) {
    throw new IllegalArgumentException("Expecting '" + SemXmlConstants.MARGINAL_ERROR_DISTRIBUTION + "' element"); //$NON-NLS-1$ //$NON-NLS-2$
  }
  Element normal;
  Node node;
  Elements normals = marginalDistributionElement.getChildElements(SemXmlConstants.NORMAL);
  for (int i = 0; i < normals.size(); i++) {
    normal = normals.get(i);
    SemGraph graph = semIm.getSemPm().getGraph();
    graph.setShowErrorTerms(true);
    node = graph.getExogenous(graph.getNode(normal.getAttributeValue(SemXmlConstants.VARIABLE)));
    //can't set mean at this point...
    semIm.setParamValue(node, node, new Double(normal.getAttributeValue(SemXmlConstants.VARIANCE)));
  }
}

代码示例来源:origin: cmu-phil/tetrad

private static void addJointErrorDistribution(Element jointDistributionElement, SemIm semIm) {
  if (!SemXmlConstants.JOINT_ERROR_DISTRIBUTION.equals(jointDistributionElement.getQualifiedName())) {
    throw new IllegalArgumentException("Expecting '" + SemXmlConstants.JOINT_ERROR_DISTRIBUTION + "' element"); //$NON-NLS-1$ //$NON-NLS-2$
  }
  Element normal;
  Node node1, node2;
  Elements normals = jointDistributionElement.getChildElements(SemXmlConstants.NORMAL);
  for (int i = 0; i < normals.size(); i++) {
    normal = normals.get(i);
    node1 = semIm.getSemPm().getGraph().getExogenous(semIm.getSemPm().getGraph().getNode(normal.getAttributeValue(SemXmlConstants.NODE_1)));
    node2 = semIm.getSemPm().getGraph().getExogenous(semIm.getSemPm().getGraph().getNode(normal.getAttributeValue(SemXmlConstants.NODE_2)));
    semIm.setParamValue(node1, node2, new Double(normal.getAttributeValue(SemXmlConstants.COVARIANCE)));
  }
}

相关文章