golang / go

The Go programming language
https://go.dev
BSD 3-Clause "New" or "Revised" License
123.62k stars 17.61k forks source link

encoding/xml: add support for xml version 1.1 #25755

Open cpanato opened 6 years ago

cpanato commented 6 years ago

What version of Go are you using (go version)?

go 1.10.2

Does this issue reproduce with the latest release?

n/a

What operating system and processor architecture are you using (go env)?

GOHOSTARCH="amd64" GOHOSTOS="darwin"

There are any plans to add support for XML version 1.1 in the "encoding/xml" lib?

thanks!

ianlancetaylor commented 6 years ago

What would be required to make this happen?

ianlancetaylor commented 6 years ago

@summychou Thanks, noted, but please see https://golang.org/wiki/NoPlusOne . Can you answer the question I asked above?

runzexia commented 6 years ago

@ianlancetaylor https://www.w3.org/TR/xml11/#sec-xml11 changes in xml 1.1

runzexia commented 6 years ago

@ianlancetaylor Processing XML 1.1 documents with XML Schema 1.0 processors

iris-garcia commented 4 years ago

Is there any alternative to parse a 1.1 XML document?

ohenak commented 4 years ago

Haven't get a change to go through the XML 1.1 spec yet, but the seems to be mainly on extending further Unicode support.

"XML 1.1 improves on some of the short comings of XML 1.0, notably recognizing end of line. There currently exists a misalignment between what XML and Unicode defines as end of line, this affects particularly IBM machines, as well as systems communicating with them .

XML 1.1 also adds 2 new important characters NEL and a line separator. NEL 0x85 is used to mark the end of line and for completeness 0x2028 is used to mark the separation of line, this is extremely helpful in normalizing linefeed in text which plagues XML 1.0."

According to this post: http://echmondprojects.com/general/tutorials/xml/xml_a/whats-in-xml-1-1/

More reading from the official XML spec: https://www.w3.org/TR/xml11schema10/

zhongsdjn commented 2 years ago

使用的go 1.17 需要对jenkins的xml进行解析 but Jenkins xml version is 1.1 ?How to deal with?

zhongsdjn commented 2 years ago

不明白为什么提了问题你们给关了?倒是给个解决的方案啊?说是和这个重复,那这个也都几年了还是没进度!感觉go是只关心核心进展

ianlancetaylor commented 2 years ago

@zhongsdjn This issue tracker is primarily in English.

This issue is not closed. But as far as I know nobody is working on it. Go is an open source project. Would you like to send in patches for XML 1.1 support? Thanks.

mengzhuo commented 2 years ago

使用的go 1.17 需要对jenkins的xml进行解析 but Jenkins xml version is 1.1 ?How to deal with?

Can you show more detail of Jenkins' xml file as an example?

zhongsdjn commented 2 years ago

the error: xml: unsupported version "1.1"; only version 1.0 is supported

but jenkins config file both xml 1.1 like flow: \<?xml version='1.1' encoding='UTF-8'?>

false false false 1GB false false 1GB false
jglick commented 2 years ago

https://github.com/jenkinsci/jenkins/pull/3185 for the record. If you are using some Golang-based tool to manipulate Jenkins XML configurations (which?), pending this fix I suppose it would suffice to start by just stripping out any version='1.1' or version="1.1" from the first line of its input (should be fine to emit nothing or version='1.0' in output), and documenting that the tool will break in the rare case that control characters are present in text managed by the config file.

anasbousselham commented 2 years ago

Any update for xml 1.1!

gopherbot commented 1 year ago

Change https://go.dev/cl/452235 mentions this issue: encoding/xml: parser should not fail on XML version check in non-strict mode

gitbeyond commented 1 year ago

the error: xml: unsupported version "1.1"; only version 1.0 is supported

but jenkins config file both xml 1.1 like flow: <?xml version='1.1' encoding='UTF-8'?> false </hudson.nodemonitors.ArchitectureMonitor> <hudson.nodemonitors.ClockMonitor> false </hudson.nodemonitors.ClockMonitor> <hudson.nodemonitors.DiskSpaceMonitor> false 1GB </hudson.nodemonitors.DiskSpaceMonitor> <hudson.nodemonitors.SwapSpaceMonitor> false </hudson.nodemonitors.SwapSpaceMonitor> <hudson.nodemonitors.TemporarySpaceMonitor> false 1GB </hudson.nodemonitors.TemporarySpaceMonitor> <hudson.nodemonitors.ResponseTimeMonitor> false </hudson.node__monitors.ResponseTimeMonitor> </hudson.util.DescribableList>

I also had this problem. My solution is as follows:

  1. First replace version='1.1' with version='1.0'
  2. After the operation, replace version='1.0' with verison=1.1'
nxk88998 commented 8 months ago

We need to support 1.1

lecogiteur commented 4 months ago

Hi, this issue is opened from 2018 Any plan for xml 1.1 support ?

ianlancetaylor commented 4 months ago

I'm not aware of anybody actively working on this.

jimsheldon commented 2 months ago

Change https://go.dev/cl/452235 mentions this issue: encoding/xml: parser should not fail on XML version check in non-strict mode

This looks like a sensible compromise. If the user doesn't want strict behavior, they can optionally disable it.