抱歉我的英语不好。 我是Progress 4GL开发人员。 我收到以下错误格式错误的XML片段:当我执行RUN语句以执行Web服务的方法时,名称以无效字符'ñ'启动
XML结构是这样的:
<RecuperarDatosGeneralesVehiculoXCodigoInfoAuto
xmlns:ns0="http://www.example.com.ar/">
<ns0:lsCodInfoAuto>12410</ns0:lsCodInfoAuto>
<ns0:añoModelo>2012</ns0:añoModelo>
</RecuperarDatosGeneralesVehiculoXCodigoInfoAuto>
此结构无法修改,因为它是由Web服务的开发人员设计的。
任何人都可以帮助我?
答案 0 :(得分:0)
我仍然认为这是关于文件的代码页/字符集。我尝试将xml复制粘贴到文档中,添加xml-start标记并在Progress会话中读取它并得到类似于您的错误。在不同的浏览器中打开相同的文件也会产生错误。
但是,下面的示例在标记中生成带有ñ的xml,并且不仅可以在Progress中打开(示例正是如此),而且还可以在不同的浏览器中打开。
我还将xml读入正在进行的常规xml文档中并保存它的副本 - 仍然在标记中包含ñ字符。
虽然xml不像你的那样100%形成,但它仍然是一个可以帮助你的例子。
/*
Defining a temp-table named ttRecuperarDatos.
Note:
1) I have to put the long name (RecuperarDatosGeneralesVehiculoXCodigoInfoAuto)
as SERIALIZE-NAME (could use XML-NODE-NAME as well) since Progress only allows for
32 character long names
2) añoModelo needs to be put AS SERIALIZE-NAME as well since
Progress wont let me use special character as field names.
*/
DEFINE TEMP-TABLE ttRecuperarDatos NO-UNDO SERIALIZE-NAME "RecuperarDatosGeneralesVehiculoXCodigoInfoAuto"
FIELD lsCodInfoAuto AS CHARACTER
FIELD anoModelo AS CHARACTER SERIALIZE-NAME "añoModelo".
/* Defining a copy of the first temp-table */
DEFINE TEMP-TABLE ttCopy SERIALIZE-NAME "RecuperarDatosGeneralesVehiculoXCodigoInfoAuto" LIKE ttRecuperarDatos .
/* Define a handle to a general xml-document */
DEFINE VARIABLE hXml AS HANDLE NO-UNDO.
/* Create two records */
CREATE ttRecuperarDatos.
ASSIGN
ttRecuperarDatos.lsCodInfoAuto = "abc123"
ttRecuperarDatos.anoModelo = "1998".
CREATE ttRecuperarDatos.
ASSIGN
ttRecuperarDatos.lsCodInfoAuto = "cde444"
ttRecuperarDatos.anoModelo = "2004".
/* Write content to file */
TEMP-TABLE ttRecuperarDatos:WRITE-XML("FILE","c:\temp\testfile.xml").
/* Read content from file into second temp-table */
TEMP-TABLE ttCopy:READ-XML( "FILE"
, "c:\temp\testfile.xml"
, "EMPTY"
, ""
, FALSE).
/* Display records just to prove the READ-XML worked */
FOR EACH ttCopy:
DISPLAY ttCopy.
END.
/* Create a new xml document */
CREATE X-DOCUMENT hXml.
/* Load content into it */
hXml:LOAD("FILE","c:\temp\testfile.xml", FALSE).
/* Save a copy to disc */
hXml:SAVE("FILE","c:\temp\testfile_copy.xml").
/* Cleanup */
DELETE OBJECT hXml.