I have an object, tree / model / hierarchy, regardless of the correct term. It consists of what can be described as a one-to-one mapping of the desired XML.
That is, I have the following (in custom syntax like UML)
class A {
class B b[*]
class C
class D
}
class B {
class C c[*]
string AttributeFoo = "bar"
}
class C {
string AttributeThis = "is"
}
class D {
string AttributeName = "d"
}
The desired output looks something like this:
<?xml version="1.0"?>
<a>
<b attribute-foo="bar">
<c attribute-this="is"/>
</b>
<c attribute-this="is"/>
<d attribute-name="d"/>
</a>
What would you suggest the best and / or simplest way to achieve this?
source
share