# Builder::XmlMarkup adds \<inspect/\> on printing and \<clone/\> on saving

**URL:** <https://www.ruby-forum.com/t/builder-xmlmarkup-adds-inspect-on-printing-and-clone-on-saving/120887>\
**Category:** Rails\
**Created:** [November 21, 2007, 1:37pm UTC](https://www.ruby-forum.com/t/builder-xmlmarkup-adds-inspect-on-printing-and-clone-on-saving/120887 "2007-11-21T13:37:53Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![SUzB](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ad7895/32.png) [@SUzB](https://www.ruby-forum.com/u/SUzB)\
**Post date:** [November 21, 2007, 1:37pm UTC](https://www.ruby-forum.com/t/builder-xmlmarkup-adds-inspect-on-printing-and-clone-on-saving/120887/1 "2007-11-21T13:37:53Z")

</div>

Hello,

I am new in this group. Please give me a short hint, in case this is  
the wrong place for my posting.

I want to create an XML file and store it in “filetransfer”. The XML  
part of the file (the body) sould go to “filetransfer.data”. Despite  
the last line, everything is fine with the code below.

With “filetransfer.save” two entries “” are added at the end  
of filetransfer.data. How can I avoid these entries? Printing has a  
similar effect. In that case “” is added every time I print.

Locking forward to your hints

SUzB

\*\*\*\* code example \*\*\*\*

```
filetransfer.data = Builder::XmlMarkup.new
myxml =

```

Builder::XmlMarkup.new(:target=\>filetransfer.data, :indent=\>2)

```
myxml.instruct! #:xml, :version=>"1.0"
myxml.OpenShipments("xmlns"=>"x-schema:OpenShipments.xdr"){
  for row in parsed # contains rows of a parsed .csv file
    myxml.OpenShipment("ShipmentOption"=>"", "ProcessStatus"=>"")

```

do  
myxml.ShipTo do  
myxml.CompanyOrName(row[0])  
myxml.Address1(row [1])  
myxml.Address2(row [2])  
myxml.CountryTerritory(“DE”)  
myxml.PostalCode(row [3])  
myxml.CityOrTown(row [4])  
end  
myxml.ShipmentInformation do  
myxml.ServiceType(“ES”)  
myxml.NumberOfPackages(“1”)  
myxml.BillingOption(“PP”)  
end  
myxml.Package do  
myxml.PackageType(“CP”)  
myxml.Weight(row [5])  
end  
end  
end  
}

```
filetransfer.save
```

---

<div class="post-metadata">

**Author:** ![SUzB](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ad7895/32.png) [@SUzB](https://www.ruby-forum.com/u/SUzB)\
**Post date:** [November 21, 2007, 2:04pm UTC](https://www.ruby-forum.com/t/builder-xmlmarkup-adds-inspect-on-printing-and-clone-on-saving/120887/2 "2007-11-21T14:04:48Z")

</div>

On 21 Nov 2007, at 12:36, SUzB wrote:

> With “filetransfer.save” two entries “” are added at the end  
> of filetransfer.data. How can I avoid these entries? Printing has a  
> similar effect. In that case “” is added every time I print.
> 
> Locking forward to your hints
> 
> SUzB
> 
> \*\*\*\* code example \*\*\*\*
> 
> filetransfer.data = Builder::XmlMarkup.new

If filetransfer.data is just supposed to contain the text of the  
markup - it’s shouldn’t be an instnace of Builder::XmlMarkup. It can  
be anything that responds to \<\<, for example a String or a File  
(Builder::XMLMarkup also responds to \<\< which is why this works at all.

Fred

---

<div class="post-metadata">

**Author:** ![SUzB](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ad7895/32.png) [@SUzB](https://www.ruby-forum.com/u/SUzB)\
**Post date:** [November 21, 2007, 2:24pm UTC](https://www.ruby-forum.com/t/builder-xmlmarkup-adds-inspect-on-printing-and-clone-on-saving/120887/3 "2007-11-21T14:24:47Z")

</div>

you are right, I am only interested in teh text of the markup. Do you  
have a short hint how to change my code?

SUzB

---

<div class="post-metadata">

**Author:** ![SUzB](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ad7895/32.png) [@SUzB](https://www.ruby-forum.com/u/SUzB)\
**Post date:** [November 21, 2007, 2:34pm UTC](https://www.ruby-forum.com/t/builder-xmlmarkup-adds-inspect-on-printing-and-clone-on-saving/120887/4 "2007-11-21T14:34:08Z")

</div>

On 21 Nov 2007, at 13:23, SUzB wrote:

> you are right, I am only interested in teh text of the markup. Do you  
> have a short hint how to change my code?

I’ve no idea what your file transfer class is, but changing the first  
line to filetransfer.data = “”  
would probably be a step in the right direction

Fred

---

<div class="post-metadata">

**Author:** ![SUzB](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ad7895/32.png) [@SUzB](https://www.ruby-forum.com/u/SUzB)\
**Post date:** [November 21, 2007, 3:02pm UTC](https://www.ruby-forum.com/t/builder-xmlmarkup-adds-inspect-on-printing-and-clone-on-saving/120887/5 "2007-11-21T15:02:18Z")

</div>

Thanks Fred! It works

SUzB
