Let's keep in mind that doxxing is not a universal concept nor are its mechanisms universally perceived as negative/frowned upon outside of specific online areas.
I don't know of any law against it except for specific populations like law enforcement and even those usually have exceptions for journalism.