For educational purposes I'm building an XML parser.
But I'm having some question marks for some of the syntax rules.

For example '<' and '>' should be replaced by their HTML entities.
Generally speaking this is for element values, but does it also apply for attribute values?

And for quotation marks and apostrophes; does proper XML allow to escape them with a backslash or is it HTML entities only?

Also, any hints regarding the building of the parser?
I already have a pretty solid draft but it might be flawed considering the mentioned rules.

Thanks.