Problem with the XML attributes, if the attribute is written

Posted by Valeriy Bashkatov on 21-Jan-2015 04:32

Faced with the problem of removing the XML attributes from the file, if the attribute is written in Cyrillic (format from Tax inspection). For example, the contents of the XML:

<?xml version="1.0" encoding="windows-1251" ?>
<Файл gtVer="1" ВерсПрог="1С:ПРЕДПРИЯТИЕ 8.2 УПП 1.3.51.3;СБиС в.2" ВерсФорм="5.03" ИдФайл="" ПКПК="1" ПркЛ="2">
</Файл>


ABL code:

DEF VAR xDoc AS HANDLE NO-UNDO.
DEF VAR xNode AS HANDLE NO-UNDO.
CREATE X-DOCUMENT xDoc.
xDoc:LOAD("file","NO_NDS.XML",false).
CREATE x-noderef xNode.
xDoc:GET-DOCUMENT-ELEMENT(xNode).
xNode:REMOVE-ATTRIBUTE("ПКПК").
xDoc:SAVE("file","no_nds1.XML").


How to fix, what to look for something to read?

That`s true both OpenEdge 10.2B and OpenEdge 11.5

Thanks for any help.


All Replies

Posted by Valeriy Bashkatov on 21-Jan-2015 04:33

xml.p

Posted by slacroixak on 21-Jan-2015 04:53

Hi Valery,
 
About this :
<?xml version="1.0" encoding="windows-1251" ?>
 
When I used to work at the Progress Tech Support and when the support of XML doc was introduced (that’s a while ago indeed), I used to explain to customers that it was just better to use the default right encoding for xml docs : i.e. : UTF-8. 
 
http://www.stephan-brenner.com/?p=16
 
Now sometimes you have to deal with those xml files because they come by a tiers party.  But each time you write your owns, or you can have a little influence on the people/apps that write those non UTF-8 encoded docs, then try to switch to UTF-8 instead.
 
Just in case, could you try to convert the file to UTF-8 (various text editors can do that), then change the first line to
<?xml version="1.0" encoding="UTF-8" ?>
Do you still hit your problem ?
 
Hope this helps
 
 
/SL
De : Valeriy Bashkatov [mailto:bounce-Arelav2@community.progress.com]
Envoyé : mercredi 21 janvier 2015 11:33
À : TU.OE.Development@community.progress.com
Objet : [Technical Users - OE Development] Problem with the XML attributes, if the attribute is written in Cyrillic
 
Thread created by Valeriy Bashkatov

Faced with the problem of removing the XML attributes of the file, if the attribute is written in Cyrillic (format from Tax inspection). For example, the contents of the XML:

<?xml version="1.0" encoding="windows-1251" ?>
<Файл gtVer="1" ВерсПрог="1С:ПРЕДПРИЯТИЕ 8.2 УПП 1.3.51.3;СБиС в.2" ВерсФорм="5.03" ИдФайл="" ПКПК="1" ПркЛ="2">
</Файл>


ABL code:

DEF VAR xDoc AS HANDLE NO-UNDO.
DEF VAR xNode AS HANDLE NO-UNDO.
CREATE X-DOCUMENT xDoc.
xDoc:LOAD("file","NO_NDS.XML",false).
CREATE x-noderef xNode.
xDoc:GET-DOCUMENT-ELEMENT(xNode).
xNode:REMOVE-ATTRIBUTE("ПКПК").
xDoc:SAVE("file","no_nds1.XML").


How to fix what to look for something to read?

That`s true both OpenEdge 10.2B and OpenEdge 11.5

Thanks for any help.


Attachments:
NO_NDS.XML
Stop receiving emails on this subject.

Flag this post as spam/abuse.

Posted by Valeriy Bashkatov on 21-Jan-2015 05:40

Hi,

Thank you for your reply.

I converted the XML file to UTF-8 as you wrote and changed the first line to, but the problem still present :(

Then I replaced the attribute "ПКПК" by english transcription "PKPK"  - it`s work fine.

Are there any other variants?

Posted by bronco on 21-Jan-2015 06:56

Are your cpstream and cpinternal set to UTF-8?

Posted by Valeriy Bashkatov on 21-Jan-2015 07:25

Hi,

[quote user="bronco"]

Are your cpstream and cpinternal set to UTF-8?

[/quote]
Yes, I tried
pro -b -p xmlutf8.p -cpinternal utf-8 -cpstream utf-8 -cpcoll basic
Result the same.
But even if it corrected the problem, it is not possible to set language parameters to "-cpinternal utf-8 -cpstream utf-8 -cpcoll basic" permanently. Because the database runs on linux, and all customers are CHUI and yet for many reasons...

Posted by Garry Hall on 21-Jan-2015 08:58

Hi Valeriy,

Please contact TS to log a bug for this.

When I used -cpinternal UTF-8 -cpstream UTF-8 -cpcoll BASIC(and converting xml.p to UTF-8) , this worked for me. I was using Win32 with the latest 11.6 build to test. However, I do understand your concern that you are not able to use -cpinternal UTF-8 with CHUI clients.

Thanks,

Garry.

Posted by Valeriy Bashkatov on 04-Feb-2015 02:35

This is registered as defect PSC00326413.

In waiting for HotFix.

This thread is closed