I'm having trouble defining multiple name spaces for a node, e.g.: <?xml version="1.0" encoding="UTF-8"?> <Invoice xmlns="urn:oasis:names:specification:ubl:schema:xsd:Invoice-2" xmlns:qdt="urn:oasis:names:specification:ubl:schema:xsd:QualifiedDatatypes-2" xmlns:udt="urn:un:unece:uncefact:data:draft:UnqualifiedDataTypesSchemaModule:2"> [...] </Invoice>
I have the following code, which adds a default name space, but can't figure out from the api docs how to create additional prefixed name spaces: require 'rubygems' require 'xml/libxml' doc = XML::Document.new doc.root = XML::Node.new('Invoice') root = doc.root root.namespace = 'urn:oasis:names:specification:ubl:schema:xsd:Invoice-2' # TODO; add prefixed name spaces to root: # xmlns:udt="urn:un:unece:uncefact:data:draft:UnqualifiedDataTypesSchemaModule:2" # xmlns:qdt="urn:oasis:names:specification:ubl:schema:xsd:QualifiedDatatypes-2" # print document puts doc.to_s I could parse a dummy xml document and use that as a skeleton, but would like to build it using a dom-ish approach if possible. Just adding "xmlns:udt" and "xmlns:qdt" as attributes to root doesn't seem to do the proper thing. Someone able to lend a hand? Regards, Isak _______________________________________________ libxml-devel mailing list libxml-devel@rubyforge.org http://rubyforge.org/mailman/listinfo/libxml-devel