SUzB
2007-Nov-21 12:36 UTC
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 "<clone/>" are
added at the end
of filetransfer.data. How can I avoid these entries? Printing has a
similar effect. In that case "<inspect/>" 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
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
Frederick Cheung
2007-Nov-21 13:03 UTC
Re: Builder::XmlMarkup adds <inspect/> on printing and <clone/> on saving
On 21 Nov 2007, at 12:36, SUzB wrote:> > 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 "<clone/>" are added at the end > of filetransfer.data. How can I avoid these entries? Printing has a > similar effect. In that case "<inspect/>" is added every time I print. > > Locking forward to your hints > > SUzB > > **** code example **** > > filetransfer.data = Builder::XmlMarkup.newIf 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 received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
SUzB
2007-Nov-21 13:23 UTC
Re: Builder::XmlMarkup adds <inspect/> on printing and <clone/> on saving
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 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Frederick Cheung
2007-Nov-21 13:33 UTC
Re: Builder::XmlMarkup adds <inspect/> on printing and <clone/> on saving
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 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
SUzB
2007-Nov-21 14:01 UTC
Re: Builder::XmlMarkup adds <inspect/> on printing and <clone/> on saving
Thanks Fred! It works SUzB --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---