title: NSXMLParser and BOM bytes
body: <p>I'm getting my xml file as a result of a php query from some server. When I print the resulting data to the console I'm getting well-structured xml file. When I try to parse it using NSXMLParser it returns NSXMLParserErrorDomain with code 4 - empty document.
  I saw that xmls that it couldn't parse have BOM (Byte order mark) sequence right after closing '>' mark of xml header. The question is how to get rid of BOM sequence. I tried to create a string with those BOM bytes like that:</p>
  
  <pre><code>    const   UInt8 bom[3] = {0xEF, 0xBB, 0xBF};
  NSString    *bomString = [[NSString alloc] initWithData:[NSData dataWithBytes:(const void *)bom length:3] encoding:NSUTF8StringEncoding];
  NSString    *noBOMString = [theResult stringByReplacingOccurrencesOfString:bomString withString:@" "];
  </code></pre>
  
  <p>but it doesn't work for some reason. There are xmls, that have this sequence after the root element. In this case NSXMLParser parses the xml successfully. Safari ignores those characters. So Xcode debugger. Please help!</p>
  
  <p>Thanks,</p>
  
  <p>Nava</p>