Xml Decleration using builder


#1

I’m trying to create an XML file and I don’t see any way with the
builder methods to write the doc type down.

<?xml version = "1.0" encoding = "UTF-8" standalone = "no"?>

I can sucessfully using
xml.instruct! :xml, :version => “1.0”, :encoding => “UTF-8”, :standalone
=> “no”

to create the first line. But the DOCTYPE line is a mystery. Any ideas?

http://builder.rubyforge.org/


#2

On Wed, Oct 15, 2008 at 1:52 PM, Dan W. removed_email_address@domain.invalid wrote:

to create the first line. But the DOCTYPE line is a mystery. Any ideas?
xml.declare! :DOCTYPE, :questestinterop, :SYSTEM, ‘ims_qtiasiv1p2.dtd’

Got this from the README that ships with the gem.


#3
    xml.render_choice do
      xml.render_choice(:ident => item_ident, :rcardinality => 

rcardinality, :rtiming => rtiming)
(1…qammount).each do
xml.response_label do
xml.material do
xml.mattext(response_mattext)
end
end
end
end

thanks for that. Should have kept on looking, I blame the man flu I had.
I’m having issues with trying to give the parent class the tags. It’s
straight forward giving tags that close on the same line extra items.
e.g.

xml.render_choice(:ident => item_ident, :rcardinality => rcardinality,
:rtiming => rtiming)

gives
<render_choice ident=“NSFB_electronics_01_v1p2” rcardinality=“single”
rtiming=“No”/>

But I need to place other tags between this. Any ideas? I can’t see
anything in the help file to suggest that it’s possible.


#4

On Thu, 16 Oct 2008 09:14:37 -0500, Dan W. wrote:

    end

<render_choice ident=“NSFB_electronics_01_v1p2” rcardinality=“single”
rtiming=“No”/>

But I need to place other tags between this. Any ideas? I can’t see
anything in the help file to suggest that it’s possible.

Just add a block on the call to render_choice

xml.instruct! :xml, :version => “1.0”, :encoding => “UTF-8”, :standalone
xml.render_choice do
xml.render_choice(:ident => item_ident, :rcardinality =>
rcardinality, :rtiming => rtiming) do #here
(1…qammount).each do
xml.response_label do
xml.material do
xml.mattext(response_mattext)
end
end
end #and here
end
end