This is valid XML:
<?xml version="1.0" encoding="UTF-8" ?>
<fields />
<annots>
<square subject="Rectangle" page="0" rect="266.400067,580.800145,415.560104,443.520111" name="787bc126-3c6d-a8f1-69ba-c32e691cb4c8" title="Guest" date="D:20140827054329-05'00'" color="#000000" interior-color="#FFFF00" width="3" creationdate="D:20140827054328-05'00'"/>
</annots>
<pages>
<defmtx matrix="1.333333,0,0,-1.333333,0,1056" />
</pages>
</xfdf>
And indeed, with a single annotation, this annotation is parsed and imported.
This is still valid XML:
<?xml version="1.0" encoding="UTF-8" ?>
<fields />
<annots>
<square subject="Rectangle" page="0" rect="266.400067,580.800145,415.560104,443.520111" name="787bc126-3c6d-a8f1-69ba-c32e691cb4c8" title="Guest" date="D:20140827054329-05'00'" color="#000000" interior-color="#FFFF00" width="3" creationdate="D:20140827054328-05'00'"/>
<line width="3" color="#000000" creationdate="D:20140826160542-05'00'" start="519.180000,557.040000" end="135.060000,270.600000" date="D:20140826160542-05'00'" name="9b1dfc01-eea0-10e3-9d8c-8ac1460e93fe" page="0" rect="135.060000,557.040000,519.180000,270.600000" subject="Line" title="Guest">
</line>
</annots>
<pages>
<defmtx matrix="1.333333,0,0,-1.333333,0,1056" />
</pages>
</xfdf>
But using the following code, you will only get the line annotation in your pdf:
pdf_doc = ex.doc
pdf_doc.InitSecurityHandler()
fdf_doc =FDFDoc.CreateFromXFDF(xfdf_string)
pdf_doc.FDFMerge(fdf_doc)
new_path = pdf_file_path + ".merge.pdf"
pdf_doc.Save(new_path, SDFDoc::E_linearized)
By making the following change, you get both the line and the rectangle:
<?xml version="1.0" encoding="UTF-8" ?>
<fields />
<annots>
<square subject="Rectangle" page="0" rect="266.400067,580.800145,415.560104,443.520111" name="787bc126-3c6d-a8f1-69ba-c32e691cb4c8" title="Guest" date="D:20140827054329-05'00'" color="#000000" interior-color="#FFFF00" width="3" creationdate="D:20140827054328-05'00'"></square>
<line width="3" color="#000000" creationdate="D:20140826160542-05'00'" start="519.180000,557.040000" end="135.060000,270.600000" date="D:20140826160542-05'00'" name="9b1dfc01-eea0-10e3-9d8c-8ac1460e93fe" page="0" rect="135.060000,557.040000,519.180000,270.600000" subject="Line" title="Guest">
</line>
</annots>
<pages>
<defmtx matrix="1.333333,0,0,-1.333333,0,1056" />
</pages>
</xfdf>
We're working around this, but this would seem to be a bug. Newer browsers (Chrome 37) will output the self-closing xml from the webviewer, while e.g. Chrome 33 does not, causing the issue.