-
Notifications
You must be signed in to change notification settings - Fork 92
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue when XML contains Processing Instruction , but no Declaration #292
Comments
Are you talking about the Also, what version of scala-xml are you using? |
Yeah, I'm using |
Here is an overview of my code,
I'm reading the file from GCP. |
isn't |
Yes, that's true about It should be pointed out too that the deprecation warning was added in 1.1.1, released Sep-2018, so the original poster wouldn't have seen it with version 1.1.0. |
So could u guys give me some suggestion regarding this. Stop using XMLEventReader would be difficult, as i have built a pretty big code around it. Anything in scala, that works in a similar way would be great. |
As aside, I see that the declaration is merely recommended in XML 1.0, but actually required in XML 1.1 (according to https://stackoverflow.com/a/7007781/86485). Is there no possibility of altering the files themselves to add the declaration? If that isn't feasible, then I expect you would need to construct a Looking at the constructors listed at https://www.scala-lang.org/api/2.12.8/scala/io/Source$.html, I think
|
Another possibility would be to paste the What's wrong with using https://docs.oracle.com/javase/6/docs/api/javax/xml/stream/XMLEventReader.html instead, is it really so different that your code would have to be completely reworked? (Genuine question, I don't know the answer.) |
Thank You for the suggestions,
As I'm reading the file from GCP, i'm getting file as Array[Bytes]. Also the file size could be very large at times, so didn't want to load entire file as string. |
Thanks for documenting your workaround here. It might help others. |
When an XML file starts like this:
since there is no xml declaration, it gives a warning:
And then it processes normally as if tag2 is the first tag. It does not give any error, but parse the file wrongly. If an xml declaration is added it works fine:
Shouldn't it be giving an error, if xml declaration was the issue?
The text was updated successfully, but these errors were encountered: