0

I know that we should include

<?xml version="1.0"?>
as the header of xml.
But if I don't include it in the xml doc like

<message>aaa</message>

What's the consequence?
I've try that my java SAX parser can't parse this xml without the header.

What's the consequence of this?
Will SAX parse without this header?
If it's legal, how to parse this type of XML?

1 Answer 1

1

The XML declaration at the front of the file is optional. The consequence of omitting it is that the parser has to guess the character encoding of the file. In general it will guess UTF-8 unless there is other information available, such as an HTTP header.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.