Post

1 follower Follow
0
Avatar

Reconstructing URNs

So I am storing URN references to documents in a database, and then trying to re-instantiate them on retrieval. I am not storing the documents or URNs as XML as it doesn't make sense for my particular purposes.

 

I can get the "string" version of the URN just fine, but when I try to turn this back into a URN, I can't find a good method.

 

URN a = new URN(someString);

Just creates a new URN using that string as input. Is there any way, simply using the result of urn.toString(), to recreate the same URN?

Lmccarthy

Please sign in to leave a comment.

1 comment

0
Avatar

Hi there,

Sorry for the late reply.  We seem to have missed this post.  

There is no way to get the exact same object.  But creating it using new URN(oldUrnString) should be fine.  URN implements the .equals method so even if you have two objects, they can be equal if they were created with the same String representation.

Is there a reason why this doesn't work for you?

Cheers,
Matthew

Matthew Cheung 0 votes
Comment actions Permalink