Java tutorial
//package com.java2s; //License from project: Creative Commons License public class Main { private static final String BOM_IDENTIFIER = "^([\\W]+)<"; private static final String XML_TAG_START = "<"; public static String cleanXmlString(String xmlContent) { return xmlContent.replaceFirst(BOM_IDENTIFIER, XML_TAG_START); } }