Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » ID Attribute Name
ID Attribute Name [message #530928] Mon, 03 May 2010 00:48 Go to next message
John T.E. Timm is currently offline John T.E. TimmFriend
Messages: 161
Registered: July 2009
Senior Member
I have XML documents that use "ID" as the ID attribute name. I am currently using ExtendedMetaData. What is the best approach to enable automatic recording of extrinsic IDs in the Resource? From what I have read, XMLMap is not compatible with ExtendedMetaData and the two should not be used together.

Thanks,

JT
Re: ID Attribute Name [message #530981 is a reply to message #530928] Mon, 03 May 2010 09:12 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33136
Registered: July 2009
Senior Member
JT,

You'll see someone else asked a similar question recently in the thread
"automatic assignment of generated UUID to attribute with property
ID=true [intrinsic]".


John T.E. Timm wrote:
> I have XML documents that use "ID" as the ID attribute name. I am
> currently using ExtendedMetaData. What is the best approach to enable
> automatic recording of extrinsic IDs in the Resource? From what I have
> read, XMLMap is not compatible with ExtendedMetaData and the two
> should not be used together.
>
> Thanks,
>
> JT


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: ID Attribute Name [message #530990 is a reply to message #530928] Mon, 03 May 2010 09:33 Go to previous messageGo to next message
John T.E. Timm is currently offline John T.E. TimmFriend
Messages: 161
Registered: July 2009
Senior Member
Ed:

Thanks for the reply. I don't want intrinsic IDs. After reviewing the source code, I see that in XMLHandler idAttribute is set to the value of xmlMap.getIDAttributeName() and in SAXXMLHandler, if an attribute exists with a name that is equal to idAttribute, then the extrinsic ID is set automatically. So I think what I want is something like:

XMLMap xmlMap = new XMLMapImpl();
xmlMap.setIDAttributeName("ID");
resource.getDefaultLoadOptions().put(XMLResource.OPTION_XML_MAP, xmlMap);


However, my concern is that I am already using ExtendedMetaData as an option on the same resource. I am wondering if it is a good idea to use both options simultaneously. From other posts, it seems that it is not recommended. Please advise.

Thanks,

JT

[Updated on: Mon, 03 May 2010 10:00]

Report message to a moderator

Re: ID Attribute Name [message #530997 is a reply to message #530990] Mon, 03 May 2010 09:37 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33136
Registered: July 2009
Senior Member
JT,

If necessary (if the XML map option interacts badly; it wasn't designed
to be used with extended meta data) you can construct a specialized
instance of XMLHandler and set idAttribute directly.


John T.E. Timm wrote:
> Ed:
>
> Thanks for the reply. I don't want intrinsic IDs. After reviewing the
> source code, I see that in XMLHandler idAttribute is set to the value
> of xmlMap.getIDAttributeName() and in SAXXMLHandler, if an attribute
> exists with a name that is equal to idAttribute, then the extrinsic ID
> is set automatically. So I think what I want is something like:
>
> boolean useIDs() { return true; }
>
> XMLMap xmlMap = new XMLMapImpl();
> xmlMap.setIDAttributeName("ID");
> resource.getDefaultLoadOptions().put(XMLResource.OPTION_XML_ MAP, xmlMap);
>
> However, my concern is that I am already using ExtendedMetaData as an
> option on the same resource. I am wondering if it is a good idea to
> use both options simultaneously. From other posts, it seems that it is
> not recommended. Please advise.
>
> Thanks,
>
> JT


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:The feature 'mixed' of **** with 2 element values must have exactly 1 element value
Next Topic:EContentAdapter
Goto Forum:
  


Current Time: Thu Apr 18 23:38:38 GMT 2024

Powered by FUDForum. Page generated in 0.02445 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top