org.dom4j.Namespace.<init>()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(10.5k)|赞(0)|评价(0)|浏览(123)

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

Namespace.<init>介绍

[英]DOCUMENT ME!
[中]记录我!

代码示例

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

/**
 * Returns the stream features which are available for this session.
 *
 * @return the stream features which are available for this session.
 */
public Collection<Element> getAvailableStreamFeaturesElements() {
  List<Element> elements = new ArrayList<>();
  if (getAuthToken() == null) {
    Element sasl = SASLAuthentication.getSASLMechanismsElement(this);
    if (sasl != null) {
      elements.add(sasl);
    }
  }
  if (XMPPServer.getInstance().getIQRegisterHandler().isInbandRegEnabled()) {
    elements.add(DocumentHelper.createElement(new QName("register",
        new Namespace("", "http://jabber.org/features/iq-register"))));
  }
  Element bind = DocumentHelper.createElement(new QName("bind",
      new Namespace("", "urn:ietf:params:xml:ns:xmpp-bind")));
  elements.add(bind);
  Element session = DocumentHelper.createElement(new QName("session",
      new Namespace("", "urn:ietf:params:xml:ns:xmpp-session")));
  session.addElement("optional");
  elements.add(session);
  return elements;
}

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

public static Element getSASLMechanismsElement( ClientSession session )
{
  final Element result = DocumentHelper.createElement( new QName( "mechanisms", new Namespace( "", SASL_NAMESPACE ) ) );
  for (String mech : getSupportedMechanisms()) {
    if (mech.equals("EXTERNAL")) {
      boolean trustedCert = false;
      if (session.isSecure()) {
        final Connection connection   = ( (LocalClientSession) session ).getConnection();
        final TrustStore trustStore   = connection.getConfiguration().getTrustStore();
        trustedCert = trustStore.isTrusted( connection.getPeerCertificates() );
      }
      if ( !trustedCert ) {
        continue; // Do not offer EXTERNAL.
      }
    }
    final Element mechanism = result.addElement("mechanism");
    mechanism.setText(mech);
  }
  return result;
}

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

public static Element getSASLMechanismsElement( LocalIncomingServerSession session )
{
  final Element result = DocumentHelper.createElement( new QName( "mechanisms", new Namespace( "", SASL_NAMESPACE ) ) );
  if (session.isSecure()) {
    final Connection connection   = session.getConnection();
    final TrustStore trustStore   = connection.getConfiguration().getTrustStore();
    final X509Certificate trusted = trustStore.getEndEntityCertificate( session.getConnection().getPeerCertificates() );
    boolean haveTrustedCertificate = trusted != null;
    if (trusted != null && session.getDefaultIdentity() != null) {
      haveTrustedCertificate = verifyCertificate(trusted, session.getDefaultIdentity());
    }
    if (haveTrustedCertificate) {
      // Offer SASL EXTERNAL only if TLS has already been negotiated and the peer has a trusted cert.
      final Element mechanism = result.addElement("mechanism");
      mechanism.setText("EXTERNAL");
    }
  }
  return result;
}

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

/**
   * A factory method to create {@link Namespace}instance
   * 
   * @param prefix
   *            DOCUMENT ME!
   * @param uri
   *            DOCUMENT ME!
   * 
   * @return a newly created {@link Namespace}instance.
   */
  protected Namespace createNamespace(String prefix, String uri) {
    return new Namespace(prefix, uri);
  }
}

代码示例来源: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: 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: org.jenkins-ci.dom4j/dom4j

/**
   * A factory method to create {@link Namespace}instance
   * 
   * @param prefix
   *            DOCUMENT ME!
   * @param uri
   *            DOCUMENT ME!
   * 
   * @return a newly created {@link Namespace}instance.
   */
  protected Namespace createNamespace(String prefix, String uri) {
    return new Namespace(prefix, uri);
  }
}

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

/**
   * A factory method to create {@link Namespace}instance
   * 
   * @param prefix
   *            DOCUMENT ME!
   * @param uri
   *            DOCUMENT ME!
   * 
   * @return a newly created {@link Namespace}instance.
   */
  protected Namespace createNamespace(String prefix, String uri) {
    return new Namespace(prefix, uri);
  }
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.dom4j

/**
   * A factory method to create {@link Namespace}instance
   * 
   * @param prefix
   *            DOCUMENT ME!
   * @param uri
   *            DOCUMENT ME!
   * 
   * @return a newly created {@link Namespace}instance.
   */
  protected Namespace createNamespace(String prefix, String uri) {
    return new Namespace(prefix, uri);
  }
}

代码示例来源:origin: org.dom4j/com.springsource.org.dom4j

/**
   * A factory method to create {@link Namespace}instance
   * 
   * @param prefix
   *            DOCUMENT ME!
   * @param uri
   *            DOCUMENT ME!
   * 
   * @return a newly created {@link Namespace}instance.
   */
  protected Namespace createNamespace(String prefix, String uri) {
    return new Namespace(prefix, uri);
  }
}

代码示例来源:origin: org.dom4j/org.motechproject.org.dom4j

/**
   * A factory method to create {@link Namespace}instance
   * 
   * @param prefix
   *            DOCUMENT ME!
   * @param uri
   *            DOCUMENT ME!
   * 
   * @return a newly created {@link Namespace}instance.
   */
  protected Namespace createNamespace(String prefix, String uri) {
    return new Namespace(prefix, uri);
  }
}

代码示例来源:origin: apache/servicemix-bundles

/**
   * A factory method to create {@link Namespace}instance
   * 
   * @param prefix
   *            DOCUMENT ME!
   * @param uri
   *            DOCUMENT ME!
   * 
   * @return a newly created {@link Namespace}instance.
   */
  protected Namespace createNamespace(String prefix, String uri) {
    return new Namespace(prefix, uri);
  }
}

代码示例来源:origin: maven/dom4j

/**
   * A factory method to create {@link Namespace}instance
   * 
   * @param prefix
   *            DOCUMENT ME!
   * @param uri
   *            DOCUMENT ME!
   * 
   * @return a newly created {@link Namespace}instance.
   */
  protected Namespace createNamespace(String prefix, String uri) {
    return new Namespace(prefix, uri);
  }
}

代码示例来源:origin: com.alibaba.citrus.tool/antx-autoexpand

/**
   * A factory method to create {@link Namespace}instance
   * 
   * @param prefix
   *            DOCUMENT ME!
   * @param uri
   *            DOCUMENT ME!
   * 
   * @return a newly created {@link Namespace}instance.
   */
  protected Namespace createNamespace(String prefix, String uri) {
    return new Namespace(prefix, uri);
  }
}

代码示例来源:origin: jlfex/hermes

/**
 * @return
 */
public static Map<String, Namespace> namespaces() {
  if (namespaces == null) {
    namespaces = new HashMap<String, Namespace>();
    namespaces.put("a", new Namespace("a", "attribute"));
    namespaces.put("c", new Namespace("c", "collection"));
    namespaces.put("o", new Namespace("o", "object"));
  }
  return namespaces;
}

代码示例来源:origin: net.sf.sido/sido

private Namespace createNamespace(String name) {
  return new Namespace(StringUtils.lowerCase(name), XMLDOSchema.NS_SDO_URI + "/" + name);
}

代码示例来源:origin: org.mule.modules/mule-module-spring-config

private void wrapElementInSpringBeanContainer(Element rootElement, org.w3c.dom.Element dependentElement) throws ParserConfigurationException
{
  String namespaceUri = dependentElement.getNamespaceURI();
  Namespace namespace = new Namespace(dependentElement.getPrefix(), namespaceUri);
  Element beans = rootElement.element(new QName(BEANS_ELEMENT, namespace));
  if (beans == null)
  {
    beans = rootElement.addElement(BEANS_ELEMENT, namespaceUri);
  }
  beans.add(convert(dependentElement));
}

代码示例来源:origin: com.haulmont.cuba/cuba-core

private Document createEmptyDocument() {
  Document doc = DocumentHelper.createDocument();
  Element rootEl = doc.addElement("entity-mappings", XMLNS);
  Namespace xsi = new Namespace("xsi", "http://www.w3.org/2001/XMLSchema-instance");
  rootEl.add(xsi);
  rootEl.addAttribute(new QName("schemaLocation", xsi), SCHEMA_LOCATION);
  rootEl.addAttribute("version", PERSISTENCE_VER);
  return doc;
}

代码示例来源:origin: net.gltd.gtms/gtmsutil

@Override
public void handleGtxProfileIq(IQ iq) throws UnsupportedOperationException, PacketException {
  try {
    JID jid = iq.getFrom();
    Element gtxProfile = iq.getChildElement().element(new QName(GlobalConstants.ELEMENT_NAME_PROFILE, new Namespace("gtx", GlobalConstants.NAMESPACE)));
    if (gtxProfile != null && jid.getNode() != null && jid.getDomain() != null && jid.getResource() != null) {
      String profile = "<gtx-profile xmlns=\"" + GlobalConstants.NAMESPACE + "\">" + "<profiles>" + "<profile id=\"" + jid.getResource() + "\">" + "<systems>"
          + getRegistration(jid).toElement().asXML() + "</systems>" + "</profile>" + "</profiles>" + "</gtx-profile>";
      Document profileDoc = DocumentHelper.parseText(profile);
      IQ replyPacket = IQ.createResultIQ(iq);
      Element query = replyPacket.setChildElement("query", GlobalConstants.NAMESPACE_JABBER_IQ_PRIVATE);
      query.add(profileDoc.getRootElement());
      sendPacket(replyPacket);
    }
  } catch (Exception e) {
    throw new PacketException(e.getMessage());
  }
}

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

@BeforeMethod
  public void setUp() throws Exception {
    super.setUp();

    Document schema = getDocument("/xml/test/schema/personal.xsd");
    factory.loadSchema(schema);

    Namespace ns = new Namespace("t", "urn://testing");
    factory.loadSchema(schema, ns);
  }
}

相关文章