Hello Everyone,

The Java code in one of my pages:
div.addSimpleHTMLFragment(false, "<a href=\"#\"
id=\"howdoisearch\">test</a>");

generates the following:
<a href="#" class="">test</a>

and I want it to generate the following:
<a href="#" id="howdoisearch" class="">test</a>

but I am having difficulty.

What I have done so far is gone into the translate(Element parent) method in
the SimpleHTMLFragment.java class and changed the following from:
} else if ("a".equals(name)) {
    // The HTML <a> tag is translated into the DRI
    // <xref> tag.
    moveAttribute(element, "href", "target");
    *limitAttributes(element, "target");*
    element.setName("xref");

    translate(element);

to:
} else if ("a".equals(name)) {
    // The HTML <a> tag is translated into the DRI
    // <xref> tag.
    moveAttribute(element, "href", "target");
    *limitAttributes(element, "target", "id");*
    element.setName("xref");

    translate(element);

but this still has not changed the generated output. I suspect that it is
because the DRI <xref> tag has no id element (
http://www.dspace.org/1_5_2Documentation/ch13.html#N1502A). Does anyone know
how to change the DRI so that <xref> or how I can get
addSimpleHTMLFragmentto correct include the id element?

I know that alternatively I could use Javascript to edit the page after it
has been generated but I prefer to render the page right, the first time.

Thanks in advance,

Jason
------------------------------------------------------------------------------
Join us December 9, 2009 for the Red Hat Virtual Experience,
a free event focused on virtualization and cloud computing. 
Attend in-depth sessions from your desk. Your couch. Anywhere.
http://p.sf.net/sfu/redhat-sfdev2dev
_______________________________________________
DSpace-tech mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/dspace-tech

Reply via email to