{"id":134,"date":"2012-12-22T08:00:17","date_gmt":"2012-12-22T00:00:17","guid":{"rendered":"http:\/\/lg.yusemo.com\/?p=134"},"modified":"2012-12-20T22:50:56","modified_gmt":"2012-12-20T14:50:56","slug":"file-byte-xml","status":"publish","type":"post","link":"https:\/\/lg.yusemo.com\/?p=134","title":{"rendered":"\u8bfb\u53d6\u6587\u4ef6\u4e3a\u5b57\u8282\u6d41\u5e76\u4fdd\u5b58\u5230xml\u4e2d"},"content":{"rendered":"<p>\u4e24\u4e2a\u4e0d\u540c\u7684\u670d\u52a1\u8fdb\u884c\u4ea4\u4e92\u6570\u636e\u7684\u65f6\u5019\uff0c\u5e38\u5e38\u7528\u7684\u534f\u8bae\u683c\u5f0f\u90fd\u662fxml\uff0c\u4f46\u662fxml\u4e5f\u5e38\u4f1a\u78b0\u5230\u8fd9\u6837\u90a3\u6837\u7684\u95ee\u9898\uff0c\u6bd4\u5982\u4eca\u5929\u6211\u5c31\u78b0\u5230\u4e86\u4e24\u4e2a\u95ee\u9898\uff0cxml\u4e2d\u4f1a\u5bf9&#8221;&lt;&#8221; \u548c &#8220;&amp;&#8221;\u89e3\u6790\u51fa\u9519\uff0c\u8fd9\u662f\u4f17\u6240\u5468\u77e5\u7684\u3002\u4eca\u5929\u8981\u505a\u7684\u95ee\u9898\u5462\u5c31\u662f\u5728xml\u534f\u8bae\u4e2d\u5d4c\u5957\u4e00\u4e2a\u6587\u4ef6\uff0c\u5373\uff1a\u5c06\u6587\u4ef6\u8bfb\u6210byte[]\u6570\u7ec4\u7136\u540e\u6dfb\u52a0\u5230\u534f\u8bae\u4e2d\u4f20\u7ed9\u522b\u4eba\uff0c\u8fd9\u4e2a\u65f6\u5019\u5462\u662f\u5b9e\u73b0\u4e0d\u4e86\u7684\uff0c\u56e0\u4e3a\u5728\u534f\u8bae\u7684\u5176\u4ed6\u90e8\u5206\u90fd\u662fstring\uff0c\u4e24\u8005\u7ed3\u5408\u5728\u4e00\u5757\u5c31\u4f1a\u628abyte[]\u8f6c\u6362\u4e3astring\uff0c\u8fd9\u4e2a\u65f6\u5019\u95ee\u9898\u5c31\u51fa\u73b0\u4e86\u3002\u6587\u4ef6\u4e2d\u5982\u679c\u51fa\u73b0&#8221;&lt;&#8221; \u548c &#8220;&amp;&#8221;\u65f6\u5c31\u4f1a\u62a5\u9519\u4e86\uff0c\u4f46\u662f\u53c8\u4e0d\u80fd\u5bf9\u6587\u4ef6\u4e2d\u7684\u5185\u5bb9\u4e2d\u7684\u8fd9\u4e9b\u503c\u8fdb\u884c\u8f6c\u4e49\uff0c\u56e0\u4e3a\u5982\u679c\u662fpdf\u7b49\u5176\u4ed6\u683c\u5f0f\u65f6\u5c31\u4f1a\u51fa\u73b0\u95ee\u9898\u3002\u7136\u540e\u7528cdata\u6807\u7b7e\uff0c\u5c31\u53ef\u4ee5\u8f7b\u677e\u907f\u514d\u8f6c\u4e49\u4e86\u3002\u5176\u683c\u5f0f\u5982\u4e0b\uff1a<\/p>\n<p>&lt;question_file&gt;&lt;![CDATA[\u6587\u4ef6\u5185\u5bb9]]&lt;\/question_file&gt;<\/p>\n<p>\u5728\u8bfb\u53d6pdf\u683c\u5f0f\u6587\u4ef6\u8bfb\u6210\u5b57\u8282\u6d41\uff0c\u518d\u7528new String\u7684\u65b9\u5f0f\u5199\u5165\u5230\u65b0\u7684\u6587\u4ef6\u4e2d\u65f6\u53d1\u73b0\u5199\u5165\u6587\u4ef6\u5927\u5c0f\u662f\u6b63\u786e\u7684\uff0c\u4f46\u662f\u6587\u4ef6\u5185\u5bb9\u5374\u662f\u7a7a\u767d\u7684\uff0c\u8fd9\u4e2a\u611f\u89c9\u662f\u5b57\u8282\u6d41\u8f6c\u6362\u4e3a\u5b57\u7b26\u4e32\u7684\u65f6\u5019\uff0c\u622a\u53d6\u7684\u4f4d\u7f6e\u6216\u8005\u662f\u957f\u5ea6\u4e0d\u6b63\u786e\uff0c\u5fc5\u987b\u7528\u5b57\u8282\u6d41\u624d\u884c\uff0c\u6240\u4ee5\u624d\u534f\u8bae\u4e2dnew string\u4e5f\u4e0d\u884c\u3002\u8fd9\u4e2a\u65f6\u5019\u8981\u5c06byte[]\u7684\u683c\u5f0f\u4fdd\u6301\u4e0d\u53d8\u7684\u60c5\u51b5\u4e0b\uff0c\u5728\u534f\u8bae\u4e2d\u4f20\u8fc7\u53bb\u7684\u65b9\u6cd5\u5c31\u662f\uff0c\u7528base64\u5bf9\u5b57\u8282\u6d41\u91cd\u65b0\u7f16\u7801\u751f\u6210\u65b0\u7684\u5b57\u7b26\u4e32\u5c31\u53ef\u4ee5\u4e86\uff0c\u7136\u540e\u5c31\u65b9\u4fbf\u5f88\u591a\u4e86\u3002<\/p>\n<p>base64\u5c06\u5b57\u8282\u6570\u7ec4\u8f6c\u6362\u4e3astring\u7684\u65b9\u6cd5\u5982\u4e0b\uff1a<\/p>\n<p>public static String encodeToString(byte[] bytes)\u00a0 {<\/p>\n<p>return new String(Base64.encode(bytes));<\/p>\n<p>}<\/p>\n<p>\u7136\u540e\u4e3a\u4ec0\u4e48base64\u7f16\u7801\u4e4b\u540e\u5c31\u53ef\u4ee5\u4fdd\u6301\u539f\u6709\u6d41\u7684\u6b63\u786e\u53ef\u4ee5\u76f4\u63a5\u751f\u6210\u6b63\u786e\u7684\u6587\u4ef6\u5462\uff1fbase64\u771f\u7684\u6709\u8fd9\u4e48\u795e\u5947\uff1f\u867d\u7136\u4e00\u76f4\u7528\u5b83\uff0c\u4e5f\u770b\u8fc7\u5b83\u7684\u7f16\u7801\u89c4\u5219\uff0c\u4f46\u662f\u8fd8\u662f\u4e0d\u660e\u767d\u5176\u4e2d\u7684\u539f\u56e0\u3002<\/p>\n<p>&nbsp;<\/p>\n<p>\u534f\u8bae\u7ec4\u7ec7\u4ee3\u7801\uff1a<\/p>\n<p>public static String getDszxXmlFromVo(DszxNrVo vo) {<\/p>\n<p>StringBuffer xml = new StringBuffer(DszxConstants.XML_HEADER);<\/p>\n<p>xml.append(&#8220;&lt;file&gt;&lt;![CDATA[&#8220;).append(Base64.encodeToString(vo.getQuestionAppendix())).append(&#8220;]]&gt;&lt;\/file&gt;&#8221;);<\/p>\n<p>xml.append(DszxConstants.XML_HEADER_ROOT_END);<\/p>\n<p>return xml.toString();<\/p>\n<p>}<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4e24\u4e2a\u4e0d\u540c\u7684\u670d\u52a1\u8fdb\u884c\u4ea4\u4e92\u6570\u636e\u7684\u65f6\u5019\uff0c\u5e38\u5e38\u7528\u7684\u534f\u8bae\u683c\u5f0f\u90fd\u662fxml\uff0c\u4f46\u662fxml\u4e5f\u5e38\u4f1a\u78b0\u5230\u8fd9\u6837\u90a3\u6837\u7684\u95ee\u9898\uff0c\u6bd4\u5982\u4eca\u5929\u6211\u5c31\u78b0\u5230\u4e86\u4e24\u4e2a\u95ee\u9898\uff0cxml\u4e2d\u4f1a\u5bf9&#8221;&lt;&#8221; \u548c &#8220;&amp;&#8221;\u89e3\u6790\u51fa\u9519\uff0c\u8fd9\u662f\u4f17\u6240\u5468\u77e5\u7684\u3002\u4eca\u5929\u8981\u505a\u7684\u95ee\u9898\u5462\u5c31\u662f\u5728xml\u534f\u8bae\u4e2d\u5d4c\u5957\u4e00\u4e2a\u6587\u4ef6\uff0c\u5373\uff1a\u5c06\u6587&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[],"_links":{"self":[{"href":"https:\/\/lg.yusemo.com\/index.php?rest_route=\/wp\/v2\/posts\/134"}],"collection":[{"href":"https:\/\/lg.yusemo.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lg.yusemo.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lg.yusemo.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lg.yusemo.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=134"}],"version-history":[{"count":3,"href":"https:\/\/lg.yusemo.com\/index.php?rest_route=\/wp\/v2\/posts\/134\/revisions"}],"predecessor-version":[{"id":137,"href":"https:\/\/lg.yusemo.com\/index.php?rest_route=\/wp\/v2\/posts\/134\/revisions\/137"}],"wp:attachment":[{"href":"https:\/\/lg.yusemo.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=134"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lg.yusemo.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=134"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lg.yusemo.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=134"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}