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

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

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

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

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

Thanks Fred! It works

SUzB