Question

Sorry for my bad english. I'm a Progress 4GL developer. I get the following error Malformed XML fragment: a name was started with an invalid character 'ñ' when I execute the RUN statement to execute a method of a web service

The XML structure is this:

<RecuperarDatosGeneralesVehiculoXCodigoInfoAuto 
    xmlns:ns0="http://www.example.com.ar/">
    <ns0:lsCodInfoAuto>12410</ns0:lsCodInfoAuto>
    <ns0:añoModelo>2012</ns0:añoModelo>
</RecuperarDatosGeneralesVehiculoXCodigoInfoAuto>

This structure can not be modified because it is designed by the developers of the Web Services.

Anyone can help me?

Was it helpful?

Solution

I still think this is about the codepage/character set of the file. I tried to copy-paste your xml into a document, adding the xml-start tag and read it in a Progress session and got an error similar to yours. Also opening the same file in different browsers produced errors.

However, the example below produces xml with a ñ in a tag and is possible to open not only in Progress (the example does exactly that), but also in different browsers.

I also read the xml into a general xml document in Progress and save a copy of it - still with the ñ character in the tag.

While the xml isn't 100% formed like yours it's still an example that might help you on the way.

/* 
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.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top