• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java XMLUtils类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.apache.axis2.util.XMLUtils的典型用法代码示例。如果您正苦于以下问题:Java XMLUtils类的具体用法?Java XMLUtils怎么用?Java XMLUtils使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



XMLUtils类属于org.apache.axis2.util包,在下文中一共展示了XMLUtils类的17个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getPropertyFromAxisConf

import org.apache.axis2.util.XMLUtils; //导入依赖的package包/类
private static String getPropertyFromAxisConf(String parameter) throws IOException, XMLStreamException {
    try (InputStream file = new FileInputStream(Paths.get(CarbonBaseUtils.getCarbonConfigDirPath(), "axis2",
            "axis2.xml").toString())) {
       if(axis2Config == null) {
           OMElement element = (OMElement) XMLUtils.toOM(file);
           element.build();
           axis2Config = element;
       }
        Iterator parameters = axis2Config.getChildrenWithName(new QName("parameter"));
        while (parameters.hasNext()) {
            OMElement parameterElement = (OMElement) parameters.next();
            if (parameter.equals(parameterElement.getAttribute(new QName("name")).getAttributeValue())) {
                return parameterElement.getText();
            }
        }
        return null;
    } catch (IOException | XMLStreamException e) {
        throw e;
    }
}
 
开发者ID:wso2,项目名称:product-ei,代码行数:21,代码来源:Utils.java


示例2: execute

import org.apache.axis2.util.XMLUtils; //导入依赖的package包/类
/**
 * The method to execute the business logic for the specific command.
 */
public void execute() {
    authorise();
    TaskDAO task = getTask();
    checkPreConditions();
    checkState();
    task.complete(createMessage());
    TaskConfiguration taskConf = (TaskConfiguration) HumanTaskServiceComponent.
            getHumanTaskServer().getTaskStoreManager().getHumanTaskStore(task.getTenantId()).
            getTaskConfiguration(QName.valueOf(task.getName()));
    try {
        taskConf.getCallBackService().invoke(XMLUtils.toOM(taskOutput), task.getId());
    } catch (Exception e) {
        throw new HumanTaskRuntimeException("Error occurred while invoking callback service", e);
    }
    processTaskEvent();
    checkPostConditions();
}
 
开发者ID:wso2,项目名称:carbon-business-process,代码行数:21,代码来源:Complete.java


示例3: processEmbeddedEPR

import org.apache.axis2.util.XMLUtils; //导入依赖的package包/类
private void processEmbeddedEPR(List extensibilityElements, AxisEndpoint axisEndpoint) {
	Iterator eelts = extensibilityElements.iterator();
	while(eelts.hasNext()){
		ExtensibilityElement ee = (ExtensibilityElement)eelts.next();
		if(AddressingConstants.Final.WSA_ENDPOINT_REFERENCE.equals(ee.getElementType())){
			try {
				Element elt = ((UnknownExtensibilityElement)ee).getElement();
				OMElement eprOMElement = XMLUtils.toOM(elt);
				EndpointReference epr = EndpointReferenceHelper.fromOM(eprOMElement);
				Map referenceParameters = epr.getAllReferenceParameters();
				if(referenceParameters != null){
					axisEndpoint.addParameter(AddressingConstants.REFERENCE_PARAMETER_PARAMETER, new ArrayList(referenceParameters.values()));
				}
			} catch (Exception e) {
				if(log.isDebugEnabled()){
					log.debug("Exception encountered processing embedded wsa:EndpointReference", e);
				}
			}
		}
	}
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:22,代码来源:WSDL11ToAxisServiceBuilder.java


示例4: loadHandlerChains

import org.apache.axis2.util.XMLUtils; //导入依赖的package包/类
public HandlerChainsType loadHandlerChains(InputStream in) throws Exception {       
    Document document = XMLUtils.newDocument(in);
    Element el = document.getDocumentElement();
    if (!JAVA_EE_NS.equals(el.getNamespaceURI()) ||
        !"handler-chains".equals(el.getLocalName())) {
            throw new WebServiceException("Unexpected element {" + el.getNamespaceURI() + "}" + el.getLocalName() + ". Expected " + QNAME_HANDLER_CHAINS + " element");
    }

    HandlerChainsType handlerChains = new HandlerChainsType();
    Node node = el.getFirstChild();
    while (node != null) {
        if (node instanceof Element) {
            el = (Element)node;
            if (!JAVA_EE_NS.equals(el.getNamespaceURI()) ||
                !el.getLocalName().equals("handler-chain")) {                
                throw new WebServiceException("Unexpected element {" + el.getNamespaceURI() + "}" + el.getLocalName() + ". Expected " + QNAME_HANDLER_CHAIN + " element");
            }
            handlerChains.getHandlerChain().add(processHandlerChainElement(el));
        }
        node = node.getNextSibling();
    }

    return handlerChains;
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:25,代码来源:HandlerChainsParser.java


示例5: convertToAxis2

import org.apache.axis2.util.XMLUtils; //导入依赖的package包/类
/**
 * Convert from a {@link javax.xml.ws.EndpointReference} to a an instance of
 * {@link EndpointReference}.
 * 
 * @param axis2EPR
 * @param jaxwsEPR
 * @return the WS-Addressing namespace of the <code>javax.xml.ws.EndpointReference</code>.
 * @throws Exception
 */
public static String convertToAxis2(EndpointReference axis2EPR, javax.xml.ws.EndpointReference jaxwsEPR)
throws Exception {
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    jaxwsEPR.writeTo(new StreamResult(baos));
    ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
    OMElement eprElement = (OMElement) XMLUtils.toOM(bais);
    
    return EndpointReferenceHelper.fromOM(axis2EPR, eprElement);
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:19,代码来源:EndpointReferenceUtils.java


示例6: addReferenceParameters

import org.apache.axis2.util.XMLUtils; //导入依赖的package包/类
/**
 * 
 * @param axis2EPR
 * @param referenceParameters
 * @throws Exception
 */
public static void addReferenceParameters(EndpointReference axis2EPR, Element...referenceParameters)
throws Exception {
    if (referenceParameters != null) {
        for (Element element : referenceParameters) {
            OMElement omElement = XMLUtils.toOM(element);
            axis2EPR.addReferenceParameter(omElement);
        }            
    }    	
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:16,代码来源:EndpointReferenceUtils.java


示例7: addExtensibleElements

import org.apache.axis2.util.XMLUtils; //导入依赖的package包/类
/**
 * 
 * @param axis2EPR
 * @param elements
 * @throws Exception
 */
public static void addExtensibleElements(EndpointReference axis2EPR, Element... elements)
throws Exception {
    if (elements != null) {
        for (Element element : elements) {
            OMElement omElement = XMLUtils.toOM(element);
            axis2EPR.addExtensibleElement(omElement);
        }
    }
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:16,代码来源:EndpointReferenceUtils.java


示例8: addMetadata

import org.apache.axis2.util.XMLUtils; //导入依赖的package包/类
/**
 * 
 * @param axis2EPR
 * @param metadata
 * @throws Exception
 */
public static void addMetadata(EndpointReference axis2EPR, Element...metadata)
throws Exception {
    if (metadata != null) {
        for (Element element : metadata) {
            OMElement omElement = XMLUtils.toOM(element);
            axis2EPR.addMetaData(omElement);
        }
    }
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:16,代码来源:EndpointReferenceUtils.java


示例9: deploy

import org.apache.axis2.util.XMLUtils; //导入依赖的package包/类
public void deploy(DeploymentFileData deploymentFileData) throws DeploymentException {
    boolean isDirectory = deploymentFileData.getFile().isDirectory();
    ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
    try {
        deploymentFileData.setClassLoader(isDirectory,
                axisConfig.getModuleClassLoader(),
                (File) axisConfig.getParameterValue(Constants.Configuration.ARTIFACTS_TEMP_DIR),
                axisConfig.isChildFirstClassLoading());

        ClassLoader loader = deploymentFileData.getClassLoader();
        Thread.currentThread().setContextClassLoader(loader);
        InputStream xmlStream = loader.getResourceAsStream("META-INF/transport.xml");
        OMElement element = (OMElement) XMLUtils.toOM(xmlStream);
        element.build();
        AxisConfigBuilder builder = new AxisConfigBuilder(axisConfig);
        // Processing Transport Receivers
        Iterator trs_Reivers =
                element.getChildrenWithName(new QName(DeploymentConstants.TAG_TRANSPORT_RECEIVER));
        ArrayList transportReceivers = builder.processTransportReceivers(trs_Reivers);
        for (int i = 0; i < transportReceivers.size(); i++) {
            TransportInDescription transportInDescription = (TransportInDescription) transportReceivers.get(i);
            Parameter paramter = transportInDescription.getParameter("AutoStart");
            if (paramter != null) {
                configCtx.getListenerManager().addListener(transportInDescription, false);
                log.info("starting the transport : " + transportInDescription.getName());
            }
        }

        // Processing Transport Senders
        Iterator trs_senders =
                element.getChildrenWithName(new QName(DeploymentConstants.TAG_TRANSPORT_SENDER));

        builder.processTransportSenders(trs_senders);
        super.deploy(deploymentFileData);
    } catch (Exception e) {
        log.error(e.getMessage());
    } finally {
        Thread.currentThread().setContextClassLoader(contextClassLoader);
    }
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:41,代码来源:TransportDeployer.java


示例10: convertToOM

import org.apache.axis2.util.XMLUtils; //导入依赖的package包/类
private OMNode convertToOM(XmlSchema schema) throws DataRetrievalException {
    StringWriter writer = new StringWriter();
    schema.write(writer);

    StringReader reader = new StringReader(writer.toString());
    try {
        return XMLUtils.toOM(reader);
    } catch (XMLStreamException e) {
        throw new DataRetrievalException(
                "Can't convert XmlSchema object to an OMElement", e);
    }
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:13,代码来源:SchemaDataLocator.java


示例11: registerNamespace

import org.apache.axis2.util.XMLUtils; //导入依赖的package包/类
private static void registerNamespace(SchemaCompiler sc, String namespace, String pkgName) throws Exception {
    Document doc = XMLUtils.newDocument();
    Element rootElement = doc.createElement("schema");
    rootElement.setAttribute("xmlns", "http://www.w3.org/2001/XMLSchema");
    rootElement.setAttribute("xmlns:jaxb", "http://java.sun.com/xml/ns/jaxb");
    rootElement.setAttribute("jaxb:version", "2.0");
    rootElement.setAttribute("targetNamespace", namespace);
    Element annoElement = doc.createElement("annotation");
    Element appInfo = doc.createElement("appinfo");
    Element schemaBindings = doc.createElement("jaxb:schemaBindings");
    Element pkgElement = doc.createElement("jaxb:package");
    pkgElement.setAttribute("name", pkgName);
    annoElement.appendChild(appInfo);
    appInfo.appendChild(schemaBindings);
    schemaBindings.appendChild(pkgElement);
    rootElement.appendChild(annoElement);
    File file = File.createTempFile("customized",".xsd");
    FileOutputStream stream = new FileOutputStream(file);
    try {
        Result result = new StreamResult(stream);
        Transformer xformer = TransformerFactory.newInstance().newTransformer();
        xformer.transform(new DOMSource(rootElement), result);
        stream.flush();
        stream.close();
    } catch (Exception e) {
        e.printStackTrace();
    }
    InputSource ins = new InputSource(file.toURI().toString());
    sc.parseSchema(ins);
    file.delete();
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:32,代码来源:CodeGenerationUtility.java


示例12: populateItems

import org.apache.axis2.util.XMLUtils; //导入依赖的package包/类
private void populateItems() throws Exception {
    Map stateList = scxml.getChildren();

    for (Object stateObject : stateList.entrySet()) {

        Map.Entry state = (Map.Entry) stateObject;

        String currentStateName = (String) state.getKey();
        State currentState = (State) state.getValue();
        Datamodel model = currentState.getDatamodel();

        states.add(currentStateName);
        if (model != null) {
            List dataList = model.getData();
            for (Object dataObject : dataList) {
                Data data = (Data) dataObject;
                OMElement node = XMLUtils.toOM((Element) data.getNode());
                /*
                * when associating we will map the custom data model to a set of beans.
                * These will be used for further actions.
                * */
                populateCheckItems(currentStateName, node,checkListItems);
                populateTransitionValidations(currentStateName, node,transitionValidations);
                populateTransitionPermissions(currentStateName, node,transitionPermission);
                populateTransitionScripts(currentStateName, node,scriptElements);
                populateTransitionUIs(currentStateName, node,transitionUIs);
                populateTransitionExecutors(currentStateName, node,transitionExecution);
                populateTransitionApprovals(currentStateName,node,transitionApproval);
                populateTransitionInputs(currentStateName,node,transitionInputs);
            }
        }

        List<String> events = new ArrayList<String>();
        for (Object t : currentState.getTransitionsList()) {
            Transition transition = (Transition) t;
            events.add(transition.getEvent());
        }
        stateEvents.put(currentStateName, events);
    }
}
 
开发者ID:wso2,项目名称:carbon-governance,代码行数:41,代码来源:DefaultLifeCycle.java


示例13: getElementString

import org.apache.axis2.util.XMLUtils; //导入依赖的package包/类
public static String getElementString(Element element) throws Exception {
	OMElement om = XMLUtils.toOM(element);
	return XMLUtil.prettify(om);
}
 
开发者ID:wso2,项目名称:developer-studio,代码行数:5,代码来源:XMLUtil.java


示例14: initialize

import org.apache.axis2.util.XMLUtils; //导入依赖的package包/类
private void initialize() {
    if (header == null) {
        if (log.isTraceEnabled()) {
            log.trace("initialize: No SOAP header to check for reference parameters.");
        }
        
        referenceParameters = EMPTY_ARRAY;            
    }
    else {
        if (log.isTraceEnabled()) {
            log.trace("initialize: Checking SOAP header for reference parameters.");
        }
        
        List<Element> list = new ArrayList<Element>();
        Iterator headerBlocks = header.getChildElements();
        while (headerBlocks.hasNext()) {
            OMElement headerElement = (OMElement)headerBlocks.next();
            OMAttribute isRefParamAttr =
                    headerElement.getAttribute(new QName(namespace, "IsReferenceParameter"));
            if (log.isTraceEnabled()) {
                log.trace("initialize: Checking header element: " + headerElement.getQName());
            }
            
            if (isRefParamAttr != null && 
                ("true".equals(isRefParamAttr.getAttributeValue()) ||
                 "1".equals(isRefParamAttr.getAttributeValue()))) {
                try {
                    Element element = XMLUtils.toDOM(headerElement);
                    list.add(element);
                }
                catch (Exception e) {
                    throw ExceptionFactory.
                      makeWebServiceException(Messages.getMessage("referenceParameterConstructionErr"),
                                              e);
                }
                
                if (log.isTraceEnabled()) {
                    log.trace("initialize: Header: " + headerElement.getQName() +
                            " has IsReferenceParameter attribute. Adding to toEPR.");
                }
            }
        }
        
        referenceParameters = list.toArray(EMPTY_ARRAY);
    }
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:47,代码来源:ReferenceParameterList.java


示例15: test22CreateW3CEndpointReference

import org.apache.axis2.util.XMLUtils; //导入依赖的package包/类
public void test22CreateW3CEndpointReference() throws Exception {
    XMLUnit.setIgnoreWhitespace(true);
    try {
        Document doc = XMLUtils.newDocument();
        
        // Create metadata
        Element metadata1 = doc.createElementNS("http://test.com", "test:testMetadata1");
        metadata.add(metadata1);
        Element metadata2 = doc.createElementNS("http://test.com", "test:testMetadata2");
        metadata.add(metadata2);
        
        // Create reference parameters
        Element key = doc.createElementNS("http://example.com/fabrikam", "fabrikam:CustomerKey");
        key.appendChild(doc.createTextNode("123456789"));
        referenceParameters.add(key);
        Element cart = doc.createElementNS("http://example.com/fabrikam", "fabrikam:ShoppingCart");
        cart.appendChild(doc.createTextNode("ABCDEFG"));
        referenceParameters.add(cart);
        
        // Create elements
        Element element1 = doc.createElementNS("http://test.com", "test:testElement1");
        elements.add(element1);
        Element element2 = doc.createElementNS("http://test.com", "test:testElement2");
        elements.add(element2);
        
        // Create attributes
        attributes.put(new QName("http://test.com", "attribute1", "test"), "value1");
        attributes.put(new QName("http://test.com", "attribute2", "test"), "value2");
        
        w3cEpr = provider.createW3CEndpointReference(address, interfaceName, serviceName, portName, metadata, wsdlDocumentLocation, referenceParameters, elements, attributes);
        
        // Cannot put EPR in an external file since absolute WSDL location cannot be hard coded
        String expectedEPR = "<EndpointReference test:attribute1=\"value1\" test:attribute2=\"value2\" xmlns=\"http://www.w3.org/2005/08/addressing\" xmlns:test=\"http://test.com\">" +
                                 "<Address>http://localhost:8080/jaxws-samples/services/EchoService</Address>" +
                                 "<ReferenceParameters xmlns:fabrikam=\"http://example.com/fabrikam\">" +
                                     "<fabrikam:CustomerKey>123456789</fabrikam:CustomerKey>" +
                                     "<fabrikam:ShoppingCart>ABCDEFG</fabrikam:ShoppingCart>" +
                                 "</ReferenceParameters>" +
                                 "<Metadata xmlns:wsam=\"http://www.w3.org/2007/05/addressing/metadata\" xmlns:tns=\"http://org/apache/axis2/jaxws/samples/echo/\" xmlns:wsdli=\"http://www.w3.org/ns/wsdl-instance\" wsdli:wsdlLocation=\"http://org/apache/axis2/jaxws/samples/echo/ " + wsdlDocumentLocation + "\">" +
                                     "<wsam:ServiceName EndpointName=\"EchoServicePort\">tns:EchoService</wsam:ServiceName>" +
                                     "<wsam:InterfaceName>tns:EchoServicePortType</wsam:InterfaceName>" +
                                     "<test:testMetadata1/>" +
                                     "<test:testMetadata2/>" +
                                 "</Metadata>" +
                                 "<test:testElement1/>" +
                                 "<test:testElement2/>" +
                             "</EndpointReference>";
        
        assertXMLEqual(expectedEPR, w3cEpr.toString());
    } finally {
        XMLUnit.setIgnoreWhitespace(false);
    }
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:54,代码来源:ProviderTests.java


示例16: getAxisServiceFromWsdl

import org.apache.axis2.util.XMLUtils; //导入依赖的package包/类
public List<AxisService> getAxisServiceFromWsdl(InputStream in,
                                       ClassLoader loader, String wsdlUrl) throws Exception {
//         ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray());

        // now the question is which version of WSDL file this archive contains.
        // lets check the namespace of the root element and decide. But since we are
        // using axiom (dude, you are becoming handy here :)), we will not build the
        // whole thing.
        OMElement element = (OMElement) XMLUtils.toOM(in);
        OMNamespace documentElementNS = element.getNamespace();
        if (documentElementNS != null) {
            WSDLToAxisServiceBuilder wsdlToAxisServiceBuilder;
            ByteArrayOutputStream out = new ByteArrayOutputStream();
            element.serialize(out);
            if (Constants.NS_URI_WSDL11.
                    equals(documentElementNS.getNamespaceURI())) {
                wsdlToAxisServiceBuilder = new WSDL11ToAllAxisServicesBuilder(
                        new ByteArrayInputStream(out.toByteArray()));
                ((WSDL11ToAllAxisServicesBuilder)wsdlToAxisServiceBuilder).setCustomWSDLResolver(new WarBasedWSDLLocator(wsdlUrl,
                                                                                         loader,
                                                                                         new ByteArrayInputStream(
                                                                                                 out.toByteArray())));
                wsdlToAxisServiceBuilder.setCustomResolver(
                        new WarFileBasedURIResolver(loader));
                return ((WSDL11ToAllAxisServicesBuilder)wsdlToAxisServiceBuilder).populateAllServices();
            } else if (WSDL2Constants.WSDL_NAMESPACE.
                    equals(documentElementNS.getNamespaceURI())){
                wsdlToAxisServiceBuilder = new WSDL20ToAllAxisServicesBuilder(
                        new ByteArrayInputStream(out.toByteArray()));
                ((WSDL20ToAllAxisServicesBuilder)wsdlToAxisServiceBuilder).setCustomWSDLResolver(new WarBasedWSDLLocator(wsdlUrl,
                                                                                         loader,
                                                                                         new ByteArrayInputStream(
                                                                                                 out.toByteArray())));
                wsdlToAxisServiceBuilder.setCustomResolver(
                        new WarFileBasedURIResolver(loader));
                return ((WSDL20ToAllAxisServicesBuilder)wsdlToAxisServiceBuilder).populateAllServices();
            }
            else {
                throw new DeploymentException(Messages.getMessage("invalidWSDLFound"));
            }
        }
        return null;
    }
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:44,代码来源:ArchiveReader.java


示例17: buildOM

import org.apache.axis2.util.XMLUtils; //导入依赖的package包/类
/**
 * Creates OMElement for a given description document (axis2.xml ,
 * services.xml and module.xml).
 *
 * @return Returns <code>OMElement</code> .
 * @throws javax.xml.stream.XMLStreamException
 *
 */
public OMElement buildOM() throws XMLStreamException {
    OMElement element = (OMElement) XMLUtils.toOM(descriptionStream);
    element.build();
    return element;
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:14,代码来源:DescriptionBuilder.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java JsonUtils类代码示例发布时间:2022-05-23
下一篇:
Java Modifier类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap