I have a XML like this

<packagedElement xmi:type="uml:Class" xmi:id="EAID_4A" name="DCEdge"
isAbstract="true">
    <!-- some stuff -->
</packagedElement>
<packagedElement xmi:type="uml:Association" xmi:id="EAID_46">
    <!-- some stuff -->
</packagedElement>

and I would like to generate UmlClass and UmlAssociation classes for this.

I could use XMLPluggableElementFactory, however that only allows me to
specify the target class only on the element's name, such as

doc := (XMLDOMParser on: someXML)
nodeFactory:
(XMLPluggableElementFactory new
elementClass: GenericElement;
handleElement: 'packagedElement' withClass: UmlPackagedElement)
parseDocument.

However I need better granularity, because I would like to have a different
class for 'packagedElement[xmi:type="uml:Class"]' and different class for
'packagedElement[xmi:type="uml:Association"]'.

Of course I could use double visitors (so use the Pluggable stuff to get
UmlPackagedElement) and then make another pass on it to get the final
classes,

however I would prefer to have to wanted class directly without the need to
go through intermediate representation.

Is there a way to do this?

Thanks,
Peter

Reply via email to