private function appendLines(\DOMNode $parent, $lines, $hasHeaderLine, array $fields = NULL)
{
$document = $parent instanceof \DOMDocument ? $parent : $parent->ownerDocument;
$headers = NULL;
foreach ($lines as $line) {
if ($headers === NULL) {
$headers = $this->getHeaders($line, $hasHeaderLine, $fields);
if ($hasHeaderLine) {
continue;
}
}
$parent->appendChild($node = $document->createElement(self::DEFAULT_QNAME));
foreach ($line as $index => $field) {
if (isset($headers[$index])) {
$this->appendField($node, $headers[$index], $field);
}
}
}
}