<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:test="http://test/"> <soapenv:Header/> <soapenv:Body> <test:addEmployee> <!--Optional:--> <employee> <!--Optional:--> <empNum>002</empNum> <!--Optional:--> <name>aa</name> </employee> </test:addEmployee> </soapenv:Body> </soapenv:Envelope>

解决方案 »

  1.   


    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title></title>
    <script src="http://code.jquery.com/jquery-1.6.2.min.js" type="text/javascript"></script>
    <script src="http://jquery-xml2json-plugin.googlecode.com/svn/trunk/jquery.xml2json.js" type="text/javascript"></script>
     <script src="http://jquery-json.googlecode.com/files/jquery.json-2.2.min.js" type="text/javascript"></script> <script type="text/javascript">
            $(document).ready(function () {         
                var xml = '<xml><site>javachen.com</site></xml>';
                var json = $.xml2json(xml);
                alert(json);
                alert(json.site);
                alert($.toJSON(json));
            });
        </script></head>
    <body></body>
    </html>