Hello Pedro,
try the following code:
import xml
constant NS_DOC = "http://sgth.es/XSD/v1.0/doc",
NS_CONTENT = "http://sgth.es/XSD/v1.0/content"
type TContent record
data string
end record
type TDoc record
content TContent ATTRIBUTE(XMLNamespace="http://sgth.es/XSD/v1.0/content")
end record
main
define
doc TDoc ATTRIBUTE(XMLName="doc", XMLNamespace="http://sgth.es/XSD/v1.0/doc"),
dom_doc xml.DomDocument,
root_node,
node_content,
node_data xml.DomNode
let doc.content.data = "kkkkk"
let dom_doc = xml.DomDocument.CreateDocumentNS("fjs1", "doc", NS_DOC)
let root_node = dom_doc.getDocumentElement()
call dom_doc.declareNamespace(root_node, "fjs2", NS_CONTENT)
let node_content = dom_doc.createElementNS("fjs2", "content", NS_CONTENT)
let node_data = dom_doc.createElementNS("fjs2", "data", NS_CONTENT)
call node_data.appendChild(dom_doc.createTextNode(doc.content.data))
call node_content.appendChild(node_data)
call root_node.appendChild(node_content)
display dom_doc.saveToString()
end main
This should generate the desired output.
Kind regards
Roland