Ajesh
6th September 2016, 08:33
Hello there
I am trying to import an XML file into infor. The encoding being UTF-8. I am having trouble importing just this part specifically.



<Description>&lt;html&gt;
&lt;head&gt;

&lt;/head&gt;

&lt;body bgcolor=&quot;#ffffff&quot;&gt;
Enterprise
&lt;/body&gt;

&lt;/html&gt;</Description>



And the code which i use is this..



|Parse the XML file
cmfId = xmlRead(fp, error_string)
if not isspace(error_string) then
message(error_string)
endif



The Error Message is "Cannot carry out Code Conversion".

When i remove the Description part. XML is imported nicely and the tree is created.

bhushanchanda
6th September 2016, 11:11
Hi,

Why doesn't the XML file include tags like <>? What if you first replace all &quot; with ", &lt; with < and all &gt; with > this will help xml.* functions identify the exact structure of the XML and won't cause any issues.

Ajesh
6th September 2016, 12:05
<?xml version="1.0" encoding="UTF-8" ?>
<APIBusinessObjects xmlns="http://xmlns.oracle.com/Primavera/P6Professional/V8.3/API/BusinessObjects"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.oracle.com/Primavera/P6Professional/V8.3/API/BusinessObjects
http://xmlns.oracle.com/Primavera/P6Professional/V8.3/API/p6apibo.xsd">
<OBS>
<Description>&lt;html&gt;
&lt;head&gt;

&lt;/head&gt;

&lt;body bgcolor=&quot;#ffffff&quot;&gt;
Enterprise
&lt;/body&gt;

&lt;/html&gt;</Description>


Well this the orignal XML File, Just the Initial Part.

I tried without the ampersand part, like this,Do you mean like this?


<APIBusinessObjects xmlns="http://xmlns.oracle.com/Primavera/P6Professional/V8.3/API/BusinessObjects"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.oracle.com/Primavera/P6Professional/V8.3/API/BusinessObjects
http://xmlns.oracle.com/Primavera/P6Professional/V8.3/API/p6apibo.xsd">
<OBS>
<Description>
<html>
<head>
</head>
<body bgcolor="#ffffff">Enterprise</body>
</html>
</Description>



It gave me the same error.

srprks
6th September 2016, 14:56
Hi as per my knowledge this is a property file of xml. if you say a xml file with data node then it looks like below code

<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="AdvancedShipNotice.xsd" xmlns="AdvancedShipNotice.xsd" xmlns:NS="AdvancedShipNotice.xsd" elementFormDefault="qualified">
<xs:element name="CSCNASN">
<xs:complexType>
<xs:sequence>
<xs:element name="RecordType0" minOccurs="1" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element name="DUNSNumber" minOccurs="0" maxOccurs="1">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="9" />
<xs:whiteSpace value="collapse" />
</xs:restriction>
</xs:simpleType>
</xs:element>

bhushanchanda
6th September 2016, 14:58
Hi,

Then there seems to be some missing tools patch/solution because it works fine at my end. Attached are the two files I tried, one with proper characters and one with ampersand characters.

Note - I am assuming you are having a proper XML i.e. open and close of the elements are placed correctly.

Also, if possible, attach the original file or a log of the program which might help to analyze and identify the issue.

Ajesh
6th September 2016, 15:42
I forgot to add an important point. If i write it manually, the same <Description> part with the code for escape characters it works but when i try to directly import from the specific xml file, it fails.

Just try importing this File Directly.(First rename it as xml)

Ajesh
6th September 2016, 15:44
Hi as per my knowledge this is a property file of xml. if you say a xml file with data node then it looks like below code

<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="AdvancedShipNotice.xsd" xmlns="AdvancedShipNotice.xsd" xmlns:NS="AdvancedShipNotice.xsd" elementFormDefault="qualified">
<xs:element name="CSCNASN">
<xs:complexType>
<xs:sequence>
<xs:element name="RecordType0" minOccurs="1" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element name="DUNSNumber" minOccurs="0" maxOccurs="1">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="9" />
<xs:whiteSpace value="collapse" />
</xs:restriction>
</xs:simpleType>
</xs:element>

Both are Valid xml's.. The one you have is a schema defined one and attributes defined for element.

bhushanchanda
6th September 2016, 16:01
It worked just fine. Can you check if you are getting any log's? Also, check how the source application is writing the file. Check if the ISO is one of these -

ISO-8859-1
UTF-8
UTF-16

ISO-8859-15 might also cause a problem. But first, you can check with Infor if you are missing any setup for handling XML's. It might be an OS dependent issue as well. Mine is Unix.

Also, I see, only the Description element looks different with some different encoding.Is this element not part of the schema? Is it being added later? Something is not alright with that i.e. if I copy it in notepad, I see a different font.

Ajesh
7th September 2016, 09:51
It worked just fine. Can you check if you are getting any log's? Also, check how the source application is writing the file. Check if the ISO is one of these -

ISO-8859-1
UTF-8
UTF-16

ISO-8859-15 might also cause a problem. But first, you can check with Infor if you are missing any setup for handling XML's. It might be an OS dependent issue as well. Mine is Unix.

Also, I see, only the Description element looks different with some different encoding.Is this element not part of the schema? Is it being added later? Something is not alright with that i.e. if I copy it in notepad, I see a different font.

You mean the import went fine with the file i sent?

Also, the encoding is the same from the External Data Source as well, it is UTF-8.

No its part of the schema indeed, gets exported directly and not added externally.

bhushanchanda
8th September 2016, 15:33
Yes, the import went fine and I was able to read and parse the XML. Probably, you would need to check if a solution or setup is missing. May be a bsell trace will help.

Ajesh
8th September 2016, 15:40
Yes, the import went fine and I was able to read and parse the XML. Probably, you would need to check if a solution or setup is missing. May be a bsell trace will help.

which Baan version you are using?

bhushanchanda
8th September 2016, 17:02
Hi,

Are you sure you tried replacing the special characters with XML characters?

I tried on 10.4 and it works fine with the original file. Though on a previous version, it gave me error saying "Conversion to LOCAL failed". I modified the tags and it worked just fine. Probably, an earlier XML parser have issues reading the characters like &gt; etc

Check if the attached file works for you. It worked in both environments old and new.

Ajesh
22nd September 2016, 09:58
Hi,

Are you sure you tried replacing the special characters with XML characters?

I tried on 10.4 and it works fine with the original file. Though on a previous version, it gave me error saying "Conversion to LOCAL failed". I modified the tags and it worked just fine. Probably, an earlier XML parser have issues reading the characters like &gt; etc

Check if the attached file works for you. It worked in both environments old and new.

Its the same behavior. When i include the Description then, i get error, when i remove it i dont get the error.

I am thinking of upgrading Porting Set.

I seriously found xml interfaces support in Baan very bad.