org.apache.axiom.om.OMXMLBuilderFactory.createOMBuilder()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(8.5k)|赞(0)|评价(0)|浏览(67)

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

OMXMLBuilderFactory.createOMBuilder介绍

[英]Create an object model builder that reads a plain XML document from the provided input stream with the default parser configuration defined by StAXParserConfiguration#DEFAULT.
[中]创建一个对象模型生成器,从提供的输入流中读取一个普通的XML文档,默认解析器配置由StAXParserConfiguration#default定义。

代码示例

代码示例来源:origin: org.apache.ws.commons.axiom/axiom-api

/**
 * Create an object model builder that reads a plain XML document from the provided input stream
 * with a given parser configuration.
 * 
 * @param configuration
 *            the parser configuration to use
 * @param in
 *            the input stream representing the XML document
 * @return the builder
 */
public static OMXMLParserWrapper createOMBuilder(StAXParserConfiguration configuration, InputStream in) {
  return createOMBuilder(configuration, in, null);
}

代码示例来源:origin: org.apache.ws.commons.axiom/axiom-api

/**
 * Create an object model builder that reads a plain XML document from the provided input stream
 * with the default parser configuration defined by {@link StAXParserConfiguration#DEFAULT}.
 * 
 * @param in
 *            the input stream representing the XML document
 * @return the builder
 */
public static OMXMLParserWrapper createOMBuilder(InputStream in) {
  return createOMBuilder(StAXParserConfiguration.DEFAULT, in);
}

代码示例来源:origin: org.apache.ws.commons.axiom/axiom-api

/**
 * Create an object model builder that reads a plain XML document from the provided character
 * stream with the default parser configuration defined by
 * {@link StAXParserConfiguration#DEFAULT}.
 * 
 * @param in
 *            the character stream representing the XML document
 * @return the builder
 */
public static OMXMLParserWrapper createOMBuilder(Reader in) {
  return createOMBuilder(StAXParserConfiguration.DEFAULT, in);
}

代码示例来源:origin: org.apache.ws.commons.axiom/axiom-api

/**
 * Create an object model builder that reads an XML document from the provided input stream
 * using a specified object model factory and with the default parser configuration defined by
 * {@link StAXParserConfiguration#DEFAULT}.
 * 
 * @param omFactory
 *            the object model factory to use
 * @param in
 *            the input stream representing the XML document
 * @return the builder
 */
public static OMXMLParserWrapper createOMBuilder(OMFactory omFactory, InputStream in) {
  return createOMBuilder(omFactory, StAXParserConfiguration.DEFAULT, in);
}

代码示例来源:origin: org.apache.ws.commons.axiom/axiom-api

/**
 * Create an object model builder that reads an XML document from the provided character stream
 * using a specified object model factory and with the default parser configuration defined by
 * {@link StAXParserConfiguration#DEFAULT}.
 * 
 * @param omFactory
 *            the object model factory to use
 * @param in
 *            the character stream representing the XML document
 * @return the builder
 */
public static OMXMLParserWrapper createOMBuilder(OMFactory omFactory, Reader in) {
  return createOMBuilder(omFactory, StAXParserConfiguration.DEFAULT, in);
}

代码示例来源:origin: org.apache.ws.commons.axiom/axiom-api

/**
 * Create an object model builder that reads an XML document from the provided input stream
 * using a specified object model factory and with a given parser configuration.
 * 
 * @param omFactory
 *            the object model factory to use
 * @param configuration
 *            the parser configuration to use
 * @param in
 *            the input stream representing the XML document
 * @return the builder
 */
public static OMXMLParserWrapper createOMBuilder(OMFactory omFactory, StAXParserConfiguration configuration, InputStream in) {
  return createOMBuilder(omFactory, configuration, in, null);
}

代码示例来源:origin: org.apache.ws.commons.axiom/axiom-api

/**
 * Create an object model builder that reads a plain XML document from the provided input stream
 * with the default parser configuration defined by {@link StAXParserConfiguration#DEFAULT}.
 * 
 * @param in
 *            the input stream representing the XML document
 * @param encoding
 *            the charset encoding of the XML document or <code>null</code> if the parser should
 *            determine the charset encoding
 * @return the builder
 */
public static OMXMLParserWrapper createOMBuilder(InputStream in, String encoding) {
  return createOMBuilder(StAXParserConfiguration.DEFAULT, in, encoding);
}

代码示例来源:origin: org.apache.axis2/axis2-kernel

/**
 * Create a builder suitable for an XML message. This method uses
 * {@link StAXParserConfiguration#SOAP} to disallow document type declarations (that potentially
 * reference external entities).
 * 
 * @param in
 *            the input stream containing the plain XML message
 * @param encoding
 *            the charset encoding of the message or <code>null</code> if the parser should
 *            determine the charset encoding
 * @return the builder
 */
public static OMXMLParserWrapper createPOXBuilder(InputStream in, String encoding) {
  return OMXMLBuilderFactory.createOMBuilder(StAXParserConfiguration.SOAP, in, encoding);
}

代码示例来源:origin: wso2/wso2-synapse

/**
 * Returns the parsed xml document.
 *
 * @param stream input stream of xml string or document needed to be parsed
 * @return parsed document
 */
public OMElement getParsedOMElement(InputStream stream) {
  OMXMLParserWrapper builder = OMXMLBuilderFactory.createOMBuilder(stream);
  return builder.getDocumentElement();
}

代码示例来源:origin: org.paxml/PaxmlCore

/**
 * Parse input stream to get document.
 * @param in input stream
 * @return the document
 */
public static OMDocument getDocument(InputStream in) {
  // create the builder
  OMXMLParserWrapper builder = OMXMLBuilderFactory.createOMBuilder(in);
  // get the root element
  OMDocument doc = builder.getDocument();
  return doc;
}
/**

代码示例来源:origin: org.apache.neethi/neethi

public OMElement convert(Element s) {
    return OMXMLBuilderFactory.createOMBuilder(new DOMSource(s)).getDocumentElement();
  }
}

代码示例来源:origin: org.apache.synapse/synapse-samples

private static Policy loadPolicy(String xmlPath) throws Exception {
  InputStream in = new FileInputStream(xmlPath);
  try {
    return PolicyEngine.getPolicy(
        OMXMLBuilderFactory.createOMBuilder(in).getDocumentElement());
  } finally {
    in.close();
  }
}

代码示例来源:origin: apache/axis2-java

/**
 * Convert DOM Element into a fully built OMElement
 * @param element dom Element
 * @return OMElement
 * @throws Exception
 */
public static OMElement toOM(Element element) throws Exception {
  OMXMLParserWrapper builder = OMXMLBuilderFactory.createOMBuilder(element, true);
  builder.detach();
  return builder.getDocumentElement();
}

代码示例来源:origin: holodeck-b2b/Holodeck-B2B

/**
   * Converts the DOM representation of an Element to the Axiom one.
   *
   * @param element   The DOM representation of the element
   * @return          The Axiom representation of the same element
   */
  public static OMElement convertDOMElementToAxiom(final Element element) {
    OMXMLParserWrapper parser = OMXMLBuilderFactory.createOMBuilder(element, false);
    OMElement omElement = parser.getDocumentElement();
    omElement.build();
    return omElement;
  }
}

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

private List<OMElement> splitToRecords(String recordsSrc) {
  OMXMLParserWrapper records = OMXMLBuilderFactory.createOMBuilder(new StringReader(recordsSrc));
  OMElement element = records.getDocumentElement();
  AXIOMXPath xpath = null;
  try {
    xpath = new AXIOMXPath("//PubmedArticle");
    List<OMElement> recordsList = xpath.selectNodes(element);
    return recordsList;
  } catch (JaxenException e) {
    return null;
  }
}

代码示例来源:origin: org.apache.rampart/rampart-trust

public static TokenRequestDispatcherConfig load(String configFilePath) throws TrustException {
  FileInputStream fis;
  OMXMLParserWrapper builder;
  try {
    fis = new FileInputStream(configFilePath);
    builder = OMXMLBuilderFactory.createOMBuilder(fis);
  } catch (Exception e) {
    throw new TrustException("errorLoadingConfigFile", new String[]{configFilePath}, e);
  }
  return load(builder.getDocumentElement());
}

代码示例来源:origin: tst-labs/esocial

private static org.apache.neethi.Policy getPolicy (java.lang.String policyString) {
  return org.apache.neethi.PolicyEngine.getPolicy(org.apache.axiom.om.OMXMLBuilderFactory.createOMBuilder(
      new java.io.StringReader(policyString)).getDocument().getXMLStreamReader(false));
}

代码示例来源:origin: tst-labs/esocial

private static org.apache.neethi.Policy getPolicy (java.lang.String policyString) {
  return org.apache.neethi.PolicyEngine.getPolicy(org.apache.axiom.om.OMXMLBuilderFactory.createOMBuilder(
      new java.io.StringReader(policyString)).getDocument().getXMLStreamReader(false));
}

代码示例来源:origin: tst-labs/esocial

private static org.apache.neethi.Policy getPolicy (java.lang.String policyString) {
  return org.apache.neethi.PolicyEngine.getPolicy(org.apache.axiom.om.OMXMLBuilderFactory.createOMBuilder(
      new java.io.StringReader(policyString)).getDocument().getXMLStreamReader(false));
}

代码示例来源:origin: org.apache.synapse/synapse-core

public static SynapseConfiguration getConfiguration(InputStream is, Properties properties)
      throws XMLStreamException {

    log.info("Generating the Synapse configuration model by parsing the XML configuration");
    
    OMElement definitions = OMXMLBuilderFactory.createOMBuilder(is).getDocumentElement();
    definitions.build();

    return ConfigurationFactoryAndSerializerFinder.getInstance()
        .getConfiguration(definitions, properties);
    
  }
}

相关文章