Re: writing collection of refobjects through xmiwriter
Brian Smith <[email protected]>
| Newsgroups | gmane.comp.java.netbeans.modules.mdr.devel |
|---|---|
| Organization | CollabNet Hosting |
| Message-ID | <[email protected]> |
Martin Matula wrote: > Hi Brian, > I have two questions. > 1) Which problem does this approach solve compared to the original > proposal? It is always possible to get either an xmi.idref or an href. The XMIWriter can choose which format it wants and the XMIReference must always be able to provide both formats. Actually, the XMIReference must always be able to return the href format (from getLocation()), but it only has to be able to return the xmi.idref format (from getXmiId()) if MDR will actually be writing the document that will "contain" the referenced object. Perhaps "getLocation()" is a bad name; maybe "getPointer()" or something similar would be better. Additionally, I think that it is more easily understood. In your proposal, I have to use isHref() to determine what format getReference() will return. It isn't clear what to do if the XMIReference doesn't give you the format you need. > 2) Why do we need getLocation method? The getDocumentURI() returns the URI to the _document_, not the XML element representing the object. Using the getDocumentURI(), the XMIWriter can determine if two objects are in the same document. The getLocation() method returns the path _inside_ the document. For example, if you have http://www.foo.com/mof.xml#String then getDocumentURI() will return "http://www.foo.com/mof.xml" and getLocation() would return "#String". If you wanted to insist that the URI's are always in the form <document-uri>#<xmi.id> then you wouldn't need the getLocation() method. But, if you want more flexibility (e.g. the ability to do full XPointers or some other format), then you would need the getLocation() method to do that. - Brian