当前位置: 首页>>代码示例>>Java>>正文


Java StAXOMBuilder.getDocument方法代码示例

本文整理汇总了Java中org.apache.axiom.om.impl.builder.StAXOMBuilder.getDocument方法的典型用法代码示例。如果您正苦于以下问题:Java StAXOMBuilder.getDocument方法的具体用法?Java StAXOMBuilder.getDocument怎么用?Java StAXOMBuilder.getDocument使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.axiom.om.impl.builder.StAXOMBuilder的用法示例。


在下文中一共展示了StAXOMBuilder.getDocument方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: outputTo

import org.apache.axiom.om.impl.builder.StAXOMBuilder; //导入方法依赖的package包/类
/**
 * outputTo the writer.
 *
 * @param writer -- the output of the converter
 */
public void outputTo(XMLStreamWriter writer) throws XMLStreamException {
    // Using OM to convert the reader to a writer.  This seems to be
    // the safest way to make the conversion, and it promotes code re-use.
    StAXOMBuilder builder = new StAXOMBuilder(reader);
    OMDocument omDocument = builder.getDocument();
    Iterator it = omDocument.getChildren();
    while (it.hasNext()) {
        OMNode omNode = (OMNode)it.next();
        // TODO Using serialize and consume
        // caused an axiom bug...falling back to serialize
        // (which is less performant due to om caching)
        //omNode.serializeAndConsume(writer);
        omNode.serialize(writer);
    }
    // Close the reader if marked to do so
    if (closeReader) {
        if (log.isDebugEnabled()) {
            log.debug("closing reader, builder: " + JavaUtils.stackToString());
        }
        reader.close();
    }
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:28,代码来源:Reader2Writer.java

示例2: createXMLObjectModel

import org.apache.axiom.om.impl.builder.StAXOMBuilder; //导入方法依赖的package包/类
private void createXMLObjectModel(String jrxmlFile) throws FileNotFoundException,
    XMLStreamException, ReportingException {
    XMLInputFactory xif = XMLInputFactory.newInstance();
    xif.setProperty("javax.xml.stream.isCoalescing", true);
    InputStream jrxmlInputStream = getJrxmlFileContent(jrxmlFile);
    XMLStreamReader reader = xif.createXMLStreamReader(jrxmlInputStream);

    StAXOMBuilder builder = new StAXOMBuilder(reader);

    document = builder.getDocument();
}
 
开发者ID:wso2,项目名称:carbon-commons,代码行数:12,代码来源:AbstractJrxmlHandler.java

示例3: retrieveXMLObject

import org.apache.axiom.om.impl.builder.StAXOMBuilder; //导入方法依赖的package包/类
private void retrieveXMLObject(String jrxmlFile) throws FileNotFoundException,
        XMLStreamException, ReportingException {
    XMLInputFactory xif = XMLInputFactory.newInstance();

    InputStream jrxmlInputStream = getJrxmlFileContent(jrxmlFile);
    XMLStreamReader reader = xif.createXMLStreamReader(jrxmlInputStream);
    xif.setProperty("javax.xml.stream.isCoalescing", false);

    StAXOMBuilder builder = new StAXOMBuilder(reader);

    document = builder.getDocument();
}
 
开发者ID:wso2,项目名称:carbon-commons,代码行数:13,代码来源:AbstractJrxmlHandler.java

示例4: getSubreportNames

import org.apache.axiom.om.impl.builder.StAXOMBuilder; //导入方法依赖的package包/类
private String[] getSubreportNames(String template) throws XMLStreamException, JaxenException {
    InputStream is = new ByteArrayInputStream(template.getBytes());
     XMLInputFactory xif = XMLInputFactory.newInstance();
    XMLStreamReader reader = xif.createXMLStreamReader(is);
    StAXOMBuilder builder = new StAXOMBuilder(reader);
    OMDocument document = builder.getDocument();
    OMElement documentElement = document.getOMDocumentElement();

    AXIOMXPath xpathExpression = new AXIOMXPath("//a:subreport");
    xpathExpression.addNamespace("a", "http://jasperreports.sourceforge.net/jasperreports");
    List nodeList = xpathExpression.selectNodes(documentElement);

    ArrayList<String> repNames = new ArrayList<String>();
    if(nodeList == null | nodeList.size()<1){
        return null;
    }
    else {
       for(Object obj : nodeList){
           if(obj instanceof OMElement){
               OMElement subReport = (OMElement)obj;
               Iterator iterator = subReport.getChildrenWithLocalName("subreportExpression");
               OMElement element = (OMElement)iterator.next();

               String reportName = element.getText();
               reportName = reportName.replaceAll("\\{", "");
               reportName = reportName.replaceAll("\\}", "");
               reportName = reportName.replaceAll("\\$P", "");
               reportName = reportName.replaceAll("\\$F", "");
               repNames.add(reportName);
           }
       }
        String[] names = new String[repNames.size()];
        names = repNames.toArray(names);
        return names;
    }
}
 
开发者ID:wso2,项目名称:carbon-commons,代码行数:37,代码来源:DBReportingService.java


注:本文中的org.apache.axiom.om.impl.builder.StAXOMBuilder.getDocument方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。