# File rice/payload.rb, line 26 def initialize(domain, party) @domain = domain @party = party # Create and populate an XML document @document = NQXML::Document.new() entity = NQXML::ProcessingInstruction.new('xml', {'version' => '1.0'}) @document.addToProlog(entity) entity = NQXML::Doctype.new('ice-payload', SYSTEM_EXTERNAL_ID, nil) @document.addToProlog(entity) # Generate payload id, create payload tag, and make it the root of # the document. id = Rice::PayloadIdentifier.new(domain) root = NQXML::Tag.new('ice-payload', { 'payload-id' => id.to_s, 'ice.version' => ICE_VERSION, 'timestamp' => Rice::DateTime.timeToICETime() }) rootNode = @document.setRoot(root) # Build header and add to root node header = NQXML::Tag.new('ice-header', nil) headerNode = rootNode.addChild(header) sender = NQXML::Tag.new('ice-sender', { 'sender-id' => @party.uuid, 'name' => @party.name, 'role' => @party.role }) headerNode.addChild(sender) agentNode = headerNode.addChild(NQXML::Tag.new('ice-user-agent', nil)) agentNode.addChild(NQXML::Text.new(USER_AGENT)) end