小编sha*_*sha的帖子

需要从xml中删除<?xml version ="1.0"encoding ="utf-16"?>

您好我通过将xsl应用于xml输入来生成xml.我需要没有这部分的输出"<?xml version="1.0" encoding="utf-16"?>"

输入 - XML

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<CreateResponse xmlns="http://jerseytelecom.com/">
    <CreateResult>
        <ISD_XMLGateway>
            <Entity>RIM_BPS</Entity>
         </ISD_XMLGateway>
    </CreateResult>
   </CreateResponse>
</soap:Body>
</soap:Envelope> 
Run Code Online (Sandbox Code Playgroud)

我的xsl

    <?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:JT="http://jerseytelecom.com/" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" exclude-result-prefixes="JT">
         <xsl:output method="xml" indent="yes"/>
         <xsl:template match="/">
           <xsl:element name="Entity">
            <xsl:value-of select="soap:Envelope/soap:Body/JT:CreateResponse/JT:CreateResult/JT:ISD_XMLGateway/JT:Entity"/>  
            </xsl:element>
            </xsl:template>
            </xsl:stylesheet>
Run Code Online (Sandbox Code Playgroud)

电流输出

   <?xml version="1.0" encoding="utf-16"?>
    <Entity>RIM_BPS</Entity>
Run Code Online (Sandbox Code Playgroud)

预期产出

    <Entity>RIM_BPS</Entity>
Run Code Online (Sandbox Code Playgroud)

xml xslt xpath xslt-1.0

29
推荐指数
3
解决办法
5万
查看次数

如何修复1字节UTF-8序列的无效字节1

我试图使用java方法从db中获取以下xml但我收到错误

用于解析xml的代码

DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();

InputSource is = new InputSource(new ByteArrayInputStream(cond.getBytes()));

Document doc = db.parse(is);

Element elem = doc.getDocumentElement();

// here we expect a series of <data><name>N</name><value>V</value></data>
NodeList nodes = elem.getElementsByTagName("data");

TableID jobId = new TableID(_processInstanceId);
Job myJob = Job.queryByID(_clientContext, jobId, true);

if (nodes.getLength() == 0) {
    log(Level.DEBUG, "No data found on condition XML");

}

for (int i = 0; i < nodes.getLength(); i++) {
    // loop through the <data> in the XML

    Element dataTags …
Run Code Online (Sandbox Code Playgroud)

java xml xml-parsing

27
推荐指数
4
解决办法
14万
查看次数

两个不同soap版本的系统属性"javax.xml.soap.MessageFactory"

我需要与我的应用程序中的两个Web服务进行通信.对于一个web服务,我需要使用soap1_1版本,而另一个soap版本是soap1_2.在这种情况下,应该为系统属性"javax.xml.soap.MessageFactory"设置的值是什么

客户1:

public class SoapClient1 {


protected static Logger _logger = Logger.getLogger ("TEST");
private static Long retryDelay = null;


public String sendSoapMessage (String xml) throws Exception {

    SOAPMessage resp  = null;
    String response = null;
    String endpoint = "http:xxxx";



    System.setProperty("javax.xml.soap.MessageFactory","com.sun.xml.internal.messaging.saaj.soap.ver1_2.SOAPMessageFactory1_2Impl");
    SOAPConnectionFactory connectionFactory = SOAPConnectionFactory.newInstance();
    SOAPConnection soapConnection = connectionFactory.createConnection();

    long start = System.currentTimeMillis();
    long end = System.currentTimeMillis();

    //URL endPoint = new URL(endpoint);

    //setting connection time out and read timeout

    URL endPoint = new URL (null, endpoint, new URLStreamHandler () {
        @Override …
Run Code Online (Sandbox Code Playgroud)

java web-services soap-client system-properties

9
推荐指数
1
解决办法
5324
查看次数

可用的不同HttpClient之间有什么区别?

我正在尝试编写一个简单的HttpClient程序.这是我第一次与之合作HttpClient,我很困惑要包括哪些罐子.

当我创建一个对象时,我已经包含了apache-httpcomponents-httpclient.jarorg.apache.commons.httpclient.jar这些,我HttpClient在客户端对象中看到了不同的方法

package com.comverse.rht;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.HttpException;
import org.apache.commons.httpclient.HttpStatus;
import org.apache.commons.httpclient.NameValuePair;
import org.apache.commons.httpclient.URI;
import org.apache.commons.httpclient.URIException;
import org.apache.commons.httpclient.methods.GetMethod;
import org.apache.commons.httpclient.methods.PostMethod;
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpGet;

public class HttpClientTest {

    public static void main(String[] args) throws URIException {
        URI url = new URI("http://www.google.com/search?q=httpClient");
        HttpClient client = new HttpClient();   
        GetMethod get = new GetMethod();
        PostMethod post = new PostMethod();
        String responseString;
        StringBuilder sb = new …
Run Code Online (Sandbox Code Playgroud)

java http

5
推荐指数
1
解决办法
1099
查看次数

在xslt version1.0中使用xpath查找节点的最大值

我是xslt的新蜜蜂.有人可以提供一些有关下面问题的指导我需要编写一个模板,该模板从下面的输入返回最大值和最小值节点EI

   <Data>
   <EI>110</EI>
    <EI>111</EI>
    <EI>112</EI>
    <EI>113</EI>
     <EI>114</EI>
    <EI>115</EI>
    </Data>
Run Code Online (Sandbox Code Playgroud)

xml xslt-1.0

1
推荐指数
1
解决办法
2475
查看次数