diff --git a/src/Symfony/Component/Serializer/Encoder/XmlEncoder.php b/src/Symfony/Component/Serializer/Encoder/XmlEncoder.php
index <HASH>..<HASH> 100644
--- a/src/Symfony/Component/Serializer/Encoder/XmlEncoder.php
+++ b/src/Symfony/Component/Serializer/Encoder/XmlEncoder.php
@@ -162,13 +162,13 @@ class XmlEncoder extends AbstractEncoder
     {
         if (is_array($val)) {
             return $this->buildXml($node, $val);
-        } elseif (is_object($val)) {
-            return $this->buildXml($node, $this->serializer->normalizeObject($val, $this->format));
         } elseif ($val instanceof \SimpleXMLElement) {
             $child = $this->dom->importNode(dom_import_simplexml($val), true);
             $node->appendChild($child);
         } elseif ($val instanceof \Traversable) {
             $this->buildXml($node, $val);
+        } elseif (is_object($val)) {
+            return $this->buildXml($node, $this->serializer->normalizeObject($val, $this->format));
         } elseif (is_numeric($val)) {
             return $this->appendText($node, (string) $val);
         } elseif (is_string($val)) {
Fix for SimpleXML in XmlEncoder

Check first for special objects like SimpleXMLElement and Traversable and the check for is_object.