my $rating = $doc->createElement('rating'); $rating->appendTextNode('5'); $book->appendChild($rating);