Bug #2172
closed& is replaced by &
0%
Description
Need to check for &XXX; in MetaCatUtil.normalize() function. This problem was
reported by Sven. Below are the emails describing the bug.
----------------------------------------------------
Saurabh Garg wrote:
Ah ok. I looked into the code and the patch from Johnoel only takes care
of cases which has xxx;
It doesnt take care of & situation.I did a lot of testing to check the normalize() function before Metacat
1.5 release - I am not sure why I didnt think about this case. I will
add a bug and fix it for the next release.Sid
Duane Costa wrote:
Sid,
To see & you have to view the page source in your browser. The browser
itself will not show it.
Duane
-----Original Message-----
From: Saurabh Garg [mailto:sgarg@nceas.ucsb.edu]
Sent: Tuesday, August 16, 2005 3:57 PM
To: Matt Jones
Cc: Duane Costa; 'Sven Bohm'; metacat-dev@ecoinformatics.org
Subject: Re: [metacat-dev] & and & in metacatHi,
Metacat 1.5 does the escaping for you even if you have
already done it.
The patch submitted by Johnoel fixes this and will be part of
the next Metacat release.However the normalize function is called during document insertion.
Hence the document inserted already has & in it. I
think Duane's first idea might be better for the time being.Though I didnt see & in the document which Duane sent.
Maybe I missed something or maybe it is already fixed.Sid
Matt Jones wrote:
I think this should be fixed in Metacat's normalize()
method. Sid --
will you file a bug please? Thanks.
Matt
Duane Costa wrote:
Sven,
Yes, it looks like the ampersand in the online URL does get
escaped by
Metacat. I found a Metacat method, MetacatUtil.normalize(),
that does
this replacement, though I'm not sure at what point in the process
it's happending: during document insertion or duringdocument retrieval. I think the assumption Metacat is making
is that your document will not have the escaped characters in
the URL already, so it happily does the service of escaping
them for you.There are two possible solutions I can think of (though, of
course, there are probably better ones I haven't thought of):
1. Remove the escaped ampersands from the EML and let
Metacat do the
escaping for you. However, if you need to keep the
ampersands escaped
because you are using the documents for purposes other than
just Metacat, you might need to maintain a separate
stylesheet just for Metacat harvests that does not escape the
ampersands.2. MetacatUtil.normalize() might be modified to check for an
already-escaped ampersand before it decides to escape anampersand. I noticed that a patch had already been added to
check for character references:case '&': {
/*
- patch provided by Johnoel
Ancheta from U of Hawaii
*/
// check if & is for a character reference
nnnn;I am cc:ing metacat-dev for their thoughts.
To see an example of a document that exhibits this behavior:
http://prairie.lternet.edu:8080/knb/metacat?action=read&qformat=xml&do
cid=knb-lter-kbs.1.5 Look at the <distribution><online><url> value.
Duane
-----Original Message-----
From: Sven Bohm [mailto:bohms@msu.edu]
Sent: Tuesday, August 16, 2005 1:03 PM
To: duane Costa
Subject: & and & in metacatHi Duane
In my metacat stylesheet
http://lter.kbs.msu.edu/Data/LTER_Metadata.jsp?Dataset=KBS002x%x%
stylesheet=LTER_Metadata-eml.xslI set the data url to something like this:
http://lter.kbs.msu.edu/Data/taple.jsp?Product=KBS002-006&format=csv&stylesheet=data.xsl
It comes to this in the browser:
http://lter.kbs.msu.edu/Data/table.jsp?Product=KBS002-006&form
at=csv&stylesheet=data.xslYet in the online distribution line on the lter metacat it gives me
this line (notice the double amp;'s:
http://lter.kbs.msu.edu/Data/table.jsp?Product=KBS002-006&amp;format=csv&stylesheet=data.xsl
It looks like metacat bindly escapes &'s even if they are
part of an
escape sequence. Any thoughts?
--
Sven Bohm.- ... ---.. .-
KBS-LTER Information Manager http://www.msu.edu/~bohms/key_______________________________________
Metacat-dev mailing list
Metacat-dev@ecoinformatics.org
http://mercury.nceas.ucsb.edu/ecoinformatics/mailman/listinfo/metacat-
dev
_______________________________________
Metacat-dev mailing list
Metacat-dev@ecoinformatics.org
http://mercury.nceas.ucsb.edu/ecoinformatics/mailman/listinfo/metacat-d
ev
_______________________________________
Metacat-dev mailing list
Metacat-dev@ecoinformatics.org
http://mercury.nceas.ucsb.edu/ecoinformatics/mailman/listinfo/metacat-dev_______________________________________
Metacat-dev mailing list
Metacat-dev@ecoinformatics.org
http://mercury.nceas.ucsb.edu/ecoinformatics/mailman/listinfo/metacat-dev