Hello everybody, I am trying to export a class to xml and remove the tag "xmlns" from mother class. These are my classes to create the XML.
Class Class.Test Extends (%RegisteredObject, %XML.Adaptor) { Parameter NAMESPACE = "http://mynamespace.com/test"; Property Person As Class.Person; Property Address As Class.Address; }
Class Class.Person Extends (%RegisteredObject, %XML.Adaptor) { Parameter NAMESPACE = "http://mynamespace.com/test"; Property name As %String; Property age As %String; }
Class Class.Address Extends (%RegisteredObject, %XML.Adaptor) { Parameter NAMESPACE = "http://mynamespace.com/test"; Property location As %String; }That is my function to export the XML.
set writer=##class(%XML.Writer).%New() set writer.Indent=1 set writer.Charset="ISO-8859-1" set status=writer.OutputToString() set status=writer.RootObject(objectTest) set xml=writer.GetXMLString()This is the xml that was generated:
<Test xmlns="http://mynamespace.com/test"> <Person> <name>John</name> <age>22</age> </Person> <location>New York NY 10036</location> </Test>When i delete the Parameter NAMESPACE from Class.Test this happens with my xml.
<Test> <Person xmlns:s01="http://mynamespace.com/test"> <s01:name>1</s01:name> </Person> <ResultadoCultura xmlns:s01="http://mynamespace.com/test"> <s01:location>New York NY 10036</s01:location> </ResultadoCultura> </Test>Someone can help me? I want to create this XML:
<Test> <Person> <name>John</name> <age>22</age> </Person> <location>New York NY 10036</location> </Test>Best Regards.