Comments (6)
I tried to convert that file to ascii myself, but got into the following problem when doing ReadFrom()
:
xml: encoding "utf-16" declared but Decoder.CharsetReader is nil
from etree.
Attaching the simple example.xml file for you to try it out...
from etree.
After removing the BOM char myself, when doing ReadFrom()
, I'll get:
XML syntax error on line 1: expected element name after <
"MS is the source of all evil & trouble". Yes, I totally agree.
from etree.
After removing the stupid first line <?xml version="1.0" encoding="utf-16"?>
, I'm getting:
XML syntax error on line 1: illegal character code U+0000
$ head -1 et_example.xml | hexdump -C
00000000 00 3c 00 54 00 72 00 61 00 63 00 65 00 44 00 61 |.<.T.r.a.c.e.D.a|
00000010 00 74 00 61 00 20 00 78 00 6d 00 6c 00 6e 00 73 |.t.a. .x.m.l.n.s|
00000020 00 3d 00 22 00 68 00 74 00 74 00 70 00 3a 00 2f |.=.".h.t.t.p.:./|
00000030 00 2f 00 74 00 65 00 6d 00 70 00 75 00 72 00 69 |./.t.e.m.p.u.r.i|
00000040 00 2e 00 6f 00 72 00 67 00 2f 00 54 00 72 00 61 |...o.r.g./.T.r.a|
00000050 00 63 00 65 00 50 00 65 00 72 00 73 00 69 00 73 |.c.e.P.e.r.s.i.s|
00000060 00 74 00 65 00 6e 00 63 00 65 00 2e 00 78 00 73 |.t.e.n.c.e...x.s|
00000070 00 64 00 22 00 3e 00 0d 00 0a |.d.".>....|
0000007a
Attaching the witched file:
et_example.zip
So, basically, if you could make this file being read as-is without any issues, that'd be super.
thanks a lot.
from etree.
It looks like you're trying to read a UTF16-encoded file. You should probably use the unicode/utf16
library to decode it, re-encode it to UTF8 using unicode/utf8
, and then pass it to etree.
from etree.
Closing this issue since I haven't seen a response. Please feel free to reopen if my response doesn't help you.
from etree.
Related Issues (20)
- Error Read xml ISO-8859-1 HOT 1
- can not parse xml with "&" HOT 1
- Unexpected <></> when adding outer layer HOT 3
- Expected " but " HOT 1
- go version EOL HOT 1
- how to pretty print when writing back HOT 4
- xml writeto string? HOT 1
- UTF-8 support HOT 3
- Does this library supports XInclude standards for XML document? HOT 1
- How do I remove indent between inline labels? HOT 2
- Is there any way to get the comments of a document? HOT 5
- i don't wanna the string text to be escaped, how can i achieve that HOT 5
- if my text contains some string likes '<br>',but i dont wanna to escape them,how can i do HOT 2
- XPath string literal syntax does not accept double quotes HOT 2
- Avoid panics when element doesn't exist HOT 4
- vulnerabilities HOT 6
- Signature of FindElements... HOT 1
- How to access sibling element using Go with etree XML package? HOT 2
- Financial Contribution? HOT 1
- Guidance Needed: Removing XML Declaration in etree HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from etree.