|
From: Moisei R. <mra...@il...> - 2003-02-16 10:53:36
|
Hello, dear all.
I would say that after 4 years experience of working with TCL and DOM X=
ML I
fill completely lost between different versions of TCL,XML,DOM etc.
I am reading the posts to this list regular and I understand that I am =
not
alone with this feeling...
OK, here is my question and may be somebody could show me the light at =
end
of this tunnel:
my environment is Windows 2000
I am ready to use any version of TCL 8.* (I would prefer 8.3)
I am ready to use any version of XML/DOM parser (I would prefer compile=
d
version rather than pure TLC because of performance issue)
what I need is to parse Unicode XML file attached below.
The file is Unicode - UTF-16 file that contains Hebrew letters.
Please, if somebody (Bill, Andreas?) could help me to find pre-compiled=
properly version of needed software, I would very appreciate this.
1. I am able to view the file in IE (6) with all Hebrew letters
2. I am able to read/write this file through TCL and file is not change=
d:
-----------
set f {c:/1.xml}
set fh [open $f]
fconfigure $fh -encoding unicode -translation auto
set xml [read $fh]
close $fh
set f {c:/2.xml}
set fh [open $f "w"]
fconfigure $fh -encoding unicode -translation auto
puts -nonewline $fh $xml
close $fh
-----------
The file 2.xml if completely same as 1.xml
3. I am unable to parse this file in any TCL XML/DOM parser known to me=
:
TCL 8.3.5 from ActiveState:
set f {C:/1.xml}
set fh [open $f]
fconfigure $fh -encoding unicode -translation auto
set xml [read $fh]; puts ok; # to suppress output of the long xml strin=
g
close $fh
package require dom
dom::parse $xml
--- output --------
Entity: line 1: error: Blank needed here
??????????????
^
Entity: line 1: error: parsing XML declaration: '?>' expected
??????????????
^
Entity: line 1: error: Start tag expected, '<' not found
??????????????????????????=E2
-------------
string range $xml 0 10
?<?xml vers
Ok, let remove strange "?" at the beginning of the string:
set xml1 [string range $xml 1 end]; puts ok; # to suppress output of th=
e
long xml string
dom::parse $xml1
Entity: line 1: error: Blank needed here
??????????????
^
Entity: line 1: error: parsing XML declaration: '?>' expected
??????????????
^
Entity: line 1: error: Start tag expected, '<' not found
??????????????????????????=E2
the same error... what can I do more?
-----------------------
here is the file:
(See attached file: 1.xml)
Thank you in advance,
Best Regards,
Moisei=
|