XMLport problem (encoding)

fjalarfjalar Member Posts: 2
Hi
I'm trying to import xml document from the web and have not managed it yet. I've both tried to write it to a file and to use a stream directly to the XMLport.

First question: In the XMLport property "Encoding" I can only choose UTF-8 or UTF-16 but the beginning of the XML file looks like this:

<?xml version="1.0" encoding="ISO-8859-1"?>
<!-- XML file generated by Joakim. -->
<?xml-stylesheet type="text/xsl" href="CollectorEntity.xslt"?>
<CollectorEntities xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance&quot; xsi:noNamespaceSchemaLocation="CollectorEntity.xsd">

Is it possible that the encoding is causing my problem?

Second question: In the following code i'm trying to read the XML file to my XMLport.


CREATE(ServerXmlHttp);
RequestString := '[url]CollectorEntity.xml';
ServerXmlHttp.open('GET',RequestString);
ServerXmlHttp.send(thevariant);
thevariant := ServerXmlHttp.responseStream;
is := thevariant;
XMLPORT.IMPORT(55555,is);

When I run this CodeUnit i get "The Attribute <CollectorEntities> is unexpected".

Any tips? #-o[/url]
Regards
Fjalar

Comments

  • DenSterDenSter Member Posts: 8,307
    That error message means that there is an element in the XML called "CollectorEntities", which is not defined in your XMLPort. Add the element in its correct position and you shuold be ok.
Sign In or Register to comment.