org.dom4j.Element.getName()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(11.6k)|赞(0)|评价(0)|浏览(301)

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

Element.getName介绍

[英]Returns the Namespace of this element if one exists otherwise Namespace.NO_NAMESPACE is returned.
[中]如果存在此元素,则返回该元素的Namespace,否则返回Namespace.NO_NAMESPACE

代码示例

代码示例来源:origin: hibernate/hibernate-orm

@SuppressWarnings({"unchecked"})
private static void changeNamesInColumnElement(Element element, ColumnNameIterator columnNameIterator) {
  final Iterator<Element> properties = element.elementIterator();
  while ( properties.hasNext() ) {
    final Element property = properties.next();
    if ( "column".equals( property.getName() ) ) {
      final Attribute nameAttr = property.attribute( "name" );
      if ( nameAttr != null ) {
        nameAttr.setText( columnNameIterator.next() );
      }
    }
  }
}

代码示例来源:origin: hibernate/hibernate-orm

private List<String> addEntityListenerClasses(Element element, String packageName, List<String> addedClasses) {
  List<String> localAddedClasses = new ArrayList<>();
  Element listeners = element.element( "entity-listeners" );
  if ( listeners != null ) {
    @SuppressWarnings( "unchecked" )
    List<Element> elements = listeners.elements( "entity-listener" );
    for (Element listener : elements) {
      String listenerClassName = buildSafeClassName( listener.attributeValue( "class" ), packageName );
      if ( classOverriding.containsKey( listenerClassName ) ) {
        //maybe switch it to warn?
        if ( "entity-listener".equals( classOverriding.get( listenerClassName ).getName() ) ) {
          LOG.duplicateListener( listenerClassName );
          continue;
        }
        throw new IllegalStateException("Duplicate XML entry for " + listenerClassName);
      }
      localAddedClasses.add( listenerClassName );
      classOverriding.put( listenerClassName, listener );
    }
  }
  LOG.debugf( "Adding XML overriding information for listeners: %s", localAddedClasses );
  addedClasses.addAll( localAddedClasses );
  return localAddedClasses;
}

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

return node.elementIterator(QName.get(localName, namespacePrefix, namespaceURI));
if (el == null || el.getName().equals(localName) == false) {
  return JaxenConstants.EMPTY_ITERATOR;

代码示例来源:origin: igniterealtime/Openfire

String node = iq.attributeValue("node");
  while (identities.hasNext()) {
    identity = identities.next();
    identity.setQName(new QName(identity.getName(), queryElement.getNamespace()));
    queryElement.add((Element)identity.clone());
  boolean hasResultSetManagementFeature = false;
  while (features.hasNext()) {
    final String feature = features.next();
    queryElement.addElement("feature").addAttribute("var", feature);
    if (feature.equals(NAMESPACE_DISCO_INFO)) {

代码示例来源:origin: igniterealtime/Openfire

return false;
else if ("db".equals(doc.getNamespacePrefix()) && "result".equals(doc.getName())) {
  if ( "valid".equals(doc.attributeValue("type")) ) {
    log.debug( "Authenticated succeeded!" );
    return true;

代码示例来源:origin: igniterealtime/Openfire

switch(element.getName()) {
  case "enable":
    String resumeString = element.attributeValue("resume");
    boolean resume = false;
    if (resumeString != null) {
    break;
  case "resume":
    long h = new Long(element.attributeValue("h"));
    String previd = element.attributeValue("previd");
    startResume( element.getNamespaceURI(), previd, h);
    break;

代码示例来源:origin: igniterealtime/Openfire

throw new IllegalStateException( "Unexpected data received while negotiating SASL authentication. Name of the offending root element: " + doc.getName() + " Namespace: " + doc.getNamespaceURI() );
switch ( ElementType.valueOfCaseInsensitive( doc.getName() ) )
    if ( doc.attributeValue( "mechanism" ) == null )
    final String mechanismName = doc.attributeValue( "mechanism" ).toUpperCase();
    throw new IllegalStateException( "Unexpected data received while negotiating SASL authentication. Name of the offending root element: " + doc.getName() + " Namespace: " + doc.getNamespaceURI() );

代码示例来源:origin: igniterealtime/Openfire

private void initiateSession(Element stanza) {
  
  String host = stanza.attributeValue("to");
  StreamError streamError = null;
  Locale language = Locale.forLanguageTag(stanza.attributeValue(QName.get("lang", XMLConstants.XML_NS_URI), "en"));
  if (STREAM_FOOTER.equals(stanza.getName())) {
    // an error occurred while setting up the session
    Log.warn("Client closed stream before session was established");
  } else if (!STREAM_HEADER.equals(stanza.getName())) {
    streamError = new StreamError(StreamError.Condition.unsupported_stanza_type);
    Log.warn("Closing session due to incorrect stream header. Tag: " + stanza.getName());
  } else if (!FRAMING_NAMESPACE.equals(stanza.getNamespace().getURI())) {
    // Validate the stream namespace (https://tools.ietf.org/html/rfc7395#section-3.3.2)
    streamError = new StreamError(StreamError.Condition.invalid_namespace);
    Log.warn("Closing session due to invalid namespace in stream header. Namespace: " + stanza.getNamespace().getURI());
  } else if (!validateHost(host)) {
    streamError = new StreamError(StreamError.Condition.host_unknown);
    Log.warn("Closing session due to incorrect hostname in stream header. Host: " + host);
  } else {
    // valid stream; initiate session
    xmppSession = SessionManager.getInstance().createClientSession(wsConnection, language);
    xmppSession.setSessionData("ws", Boolean.TRUE);
  }
  if (xmppSession == null) {
    closeStream(streamError);
  } else {
    openStream(language.toLanguageTag(), stanza.attributeValue("from"));
    configureStream();
  }
}

代码示例来源:origin: igniterealtime/Openfire

int i = propName[0].equals(element.getName()) ? 1 : 0;
for (; i < propName.length - 1; i++) {
  element = element.element(propName[i]);
Iterator iter = element.elementIterator(propName[propName.length - 1]);
ArrayList<String> props = new ArrayList<>();
while (iter.hasNext()) {
  Element e = (Element) iter.next();
  props.add(e.getName());

代码示例来源:origin: igniterealtime/Openfire

String node = iq.attributeValue("node");
      && itemsItr.hasNext();
    while (itemsItr.hasNext()) {
      allItems.add(itemsItr.next());
      final Element resultElement = item.getElement();
      resultElement.setQName(new QName(resultElement
          .getName(), queryElement.getNamespace()));
      queryElement.add(resultElement.createCopy());
    while (itemsItr.hasNext()) {
      item = itemsItr.next().getElement();
      item.setQName(new QName(item.getName(), queryElement.getNamespace()));
      queryElement.add(item.createCopy());

代码示例来源:origin: hibernate/hibernate-orm

/**
 * Copy a string attribute from an XML element to an annotation descriptor. The name of the annotation attribute is
 * explicitely given.
 *
 * @param annotation annotation where to copy to the attribute.
 * @param element XML element from where to copy the attribute.
 * @param annotationAttributeName name of the annotation attribute where to copy.
 * @param attributeName name of the XML attribute to copy.
 * @param mandatory whether the attribute is mandatory.
 */
private static void copyStringAttribute(
    final AnnotationDescriptor annotation, final Element element,
    final String annotationAttributeName, final String attributeName, boolean mandatory) {
  String attribute = element.attributeValue( attributeName );
  if ( attribute != null ) {
    annotation.setValue( annotationAttributeName, attribute );
  }
  else {
    if ( mandatory ) {
      throw new AnnotationException(
          element.getName() + "." + attributeName + " is mandatory in XML overriding. " + SCHEMA_VALIDATION
      );
    }
  }
}

代码示例来源:origin: igniterealtime/Openfire

return VerifyResult.error;
if (!doc.getRootElement().getName().equals("proceed")) {
  log.warn("Unable to verify key: Got {} instead of proceed for starttls", doc.getRootElement().getName());
  log.debug("Like this: {}", doc.asXML());
  return VerifyResult.error;
if ("db".equals(doc.getNamespacePrefix()) && "verify".equals(doc.getName())) {
  if (doc.attributeValue("id") == null || !streamID.equals(BasicStreamIDFactory.createStreamID( doc.attributeValue("id") ))) {
  else if (isHostUnknown( doc.attributeValue( "to" ) )) {

代码示例来源:origin: igniterealtime/Openfire

continue;
Element added = message.addChildElement(child.getName(), child.getNamespaceURI());
if (!child.getText().isEmpty()) {
  added.setText(child.getText());
message.setID(element.attributeValue("id"));

代码示例来源:origin: webx/citrus

public org.dom4j.Element filter(org.dom4j.Element e) throws Exception {
    // 删除schemaLocation
    org.dom4j.Attribute attr = e.attribute(new QName("schemaLocation", new Namespace("xsi",
                                             "http://www.w3.org/2001/XMLSchema-instance")));
    if (attr != null) {
      e.remove(attr);
    }
    // 导入beans:import,并删除element
    if ("http://www.springframework.org/schema/beans".equals(e.getNamespaceURI())
      && "import".equals(e.getName())) {
      String importedResourceName = trimToNull(e.attributeValue("resource"));
      if (importedResourceName != null) {
        Resource importedResource;
        if (importedResourceName.contains(":")) {
          importedResource = loader.getResource(importedResourceName);
        } else {
          importedResource = namedResource.resource.createRelative(importedResourceName);
        }
        ConfigurationFile importedConfigurationFile = parseConfigurationFile(new NamedResource(
            importedResourceName, importedResource), parsedNames);
        if (importedConfigurationFile != null) {
          importedConfigurationFiles.add(importedConfigurationFile);
        }
      }
      return null;
    }
    return e;
  }
});

代码示例来源:origin: hibernate/hibernate-orm

boolean changeToKey,
  boolean insertable) {
final Iterator<Element> properties = element.elementIterator();
while ( properties.hasNext() ) {
  final Element property = properties.next();
  if ( "property".equals( property.getName() ) || "many-to-one".equals( property.getName() ) ) {
    final Attribute nameAttr = property.attribute( "name" );
    if ( nameAttr != null ) {
      property.setName( "key-" + property.getName() );
      if ( property.getName().equals( "key-many-to-one" ) ) {
        final Attribute foreignKey = property.attribute( "foreign-key" );
        if ( foreignKey == null ) {
    if ( "property".equals( property.getName() ) ) {
      final Attribute insert = property.attribute( "insert" );
      insert.setText( Boolean.toString( insertable ) );

代码示例来源:origin: igniterealtime/Openfire

int i = propName[0].equals(element.getName()) ? 1 : 0;
for (; i < propName.length; i++) {
  element = element.element(propName[i]);
    value = element.attributeValue(attName);

代码示例来源:origin: igniterealtime/Openfire

if ("db".equals(doc.getNamespacePrefix()) && "result".equals(doc.getName())) {
  String hostname = doc.attributeValue("from");
  String recipient = doc.attributeValue("to");
  Log.debug("ServerDialback: RS - Validating remote domain for incoming session from {} to {}", hostname, recipient);
  if (validateRemoteDomain(doc, streamID)) {
else if ("db".equals(doc.getNamespacePrefix()) && "verify".equals(doc.getName())) {
  String verifyFROM = doc.attributeValue("from");
  String id = doc.attributeValue("id");
  Log.debug("ServerDialback: AS - Connection closed for host: " + verifyFROM + " id: " + id);

代码示例来源:origin: igniterealtime/Openfire

int i = propName[0].equals(element.getName()) ? 1 : 0;
for (; i < propName.length - 1; i++) {
  element = element.element(propName[i]);
Iterator iter = element.elementIterator(childName);
while (iter.hasNext()) {
  ((Node) iter.next()).detach();

代码示例来源:origin: igniterealtime/Openfire

private void processStanza(Element stanza) {
    String tag = stanza.getName();
    if (STREAM_FOOTER.equals(tag)) {
      xmppSession.getStreamManager().formalClose();
    } else if (STREAM_HEADER.equals(tag)) {
      openStream(stanza.attributeValue(QName.get("lang", XMLConstants.XML_NS_URI), "en"), stanza.attributeValue("from"));
      configureStream();
    } else if (Status.authenticated.equals(saslStatus)) {

代码示例来源:origin: igniterealtime/Openfire

@Override
boolean processUnknowPacket(Element doc) throws UnauthorizedException {
  String tag = doc.getName();
  if ("handshake".equals(tag)) {
    String extraDomain = doc.attributeValue("name");
    String allowMultiple = doc.attributeValue("allowMultiple");
    if (extraDomain == null || "".equals(extraDomain)) {

相关文章

微信公众号

最新文章

更多

Element类方法