/**
  * Build xml attributes from line data. See TicketLineInfo constructors.
  *
  * @param Product $product
  * @param Tax     $tax
  */
 private function createAttributes($product, $tax)
 {
     // Set xml
     $domimpl = new \DOMImplementation();
     $doctype = $domimpl->createDocumentType('properties', null, 'http://java.sun.com/dtd/properties.dtd');
     $attrs = $domimpl->createDocument(null, null, $doctype);
     $attrs->xmlEncoding = 'UTF-8';
     $attrs->xmlVersion = '1.0';
     $attrs->xmlStandalone = false;
     // Add root properties element
     $properties = $attrs->createElement('properties');
     $attrs->appendChild($properties);
     // Add comment element
     $comment = $attrs->createElement('comment');
     $comment->appendChild($attrs->createTextNode('POS-Tech'));
     // This is actually the application name
     $properties->appendChild($comment);
     // Add some product keys
     $entry = $attrs->createElement('entry');
     $key = $attrs->createAttribute('key');
     $key->appendChild($attrs->createTextNode('product.taxcategoryid'));
     $entry->appendChild($key);
     $entry->appendChild($attrs->createTextNode($tax->getTaxCategoryId()));
     $properties->appendChild($entry);
     $entry = $attrs->createElement('entry');
     $key = $attrs->createAttribute('key');
     $key->appendChild($attrs->createTextNode('product.com'));
     $entry->appendChild($key);
     $entry->appendChild($attrs->createTextNode('false'));
     // TODO add iscom field
     $properties->appendChild($entry);
     $entry = $attrs->createElement('entry');
     $key = $attrs->createAttribute('key');
     $key->appendChild($attrs->createTextNode('product.categoryid'));
     $entry->appendChild($key);
     $entry->appendChild($attrs->createTextNode($product->getCategoryId()));
     $properties->appendChild($entry);
     $entry = $attrs->createElement('entry');
     $key = $attrs->createAttribute('key');
     $key->appendChild($attrs->createTextNode('product.scale'));
     $entry->appendChild($key);
     $entry->appendChild($attrs->createTextNode(strval($product->getIsScale()) ? 'true' : 'false'));
     $properties->appendChild($entry);
     $entry = $attrs->createElement('entry');
     $key = $attrs->createAttribute('key');
     $key->appendChild($attrs->createTextNode('product.name'));
     $entry->appendChild($key);
     $entry->appendChild($attrs->createTextNode($product->getName()));
     $properties->appendChild($entry);
     // Save all this stuff
     $this->attributes = $attrs->saveXML();
 }