OK, this is becoming an issue I can't solve. Since I can't pull the URL
off the cache, I decided to clear the cache:
URLImageCache.getDefaultCache().flush();
Then I run the following in the JSVGCanvas update manager:
Node nextNode = null;
final String nextId = NodeUtil.getNextNodeId(element);
final Node parentNode = element.getParentNode();
final String parentId = NodeUtil.getNodeId(parentNode);
if (nextId != null) {
nextNode = element.getNextSibling();
}
parentNode.removeChild(element);
if (nextId == null) {
parentNode.appendChild(element);
} else {
parentNode.insertBefore(element, nextNode);
}
where "element" is the element I wish to remove and replace in the
document. I still get no changes in my image. Any ideas? I just want
to refresh the state of the xlink:href target.
Michael Bishop
-----Original Message-----
From: Bishop, Michael W. CONTR J9C880
[mailto:[EMAIL PROTECTED]
Sent: Thursday, October 19, 2006 10:55 AM
To: [email protected]
Subject: RE: Resolving xlink:href at a later time?
Hi, I found it was a protected method. I ended up using
AbstractNode.getBaseURI(Element).
Unfortunately, once I create the ParsedURL, it is not found in the
URLImageCache. URLImageCache.isPresent(ParsedURL) returns false.
Is there any way to iterate through the cached entries? My code reports
the URL as:
file:/C:/path/to/file/image.jpg
which is correct. I see no method to compare it against what's in the
cache, so I don't know how to figure out what's wrong.
Michael Bishop
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Tuesday, October 17, 2006 9:05 PM
To: [email protected]
Cc: [email protected]
Subject: RE: Resolving xlink:href at a later time?
Hi Michael,
"Bishop, Michael W. CONTR J9C880" <[EMAIL PROTECTED]> wrote on
10/16/2006 02:07:05 PM:
> Is this XMLBaseSupport class in certain versions of Batik? I build
from
> an older nightly build source from SVN (March 2006) and I don't see
this
> class in the source tree.
Sorry this method moved to batik.dom.AbstractNode.getBaseURI().
(It's part of DOM now) in trunk (the svg11 branch has it in
XMLBaseSupport).
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> Sent: Monday, October 16, 2006 1:05 PM
> To: [email protected]
> Cc: [email protected]
> Subject: RE: Resolving xlink:href at a later time?
>
> Hi Michael,
>
> "Bishop, Michael W. CONTR J9C880" <[EMAIL PROTECTED]> wrote
on
>
> 10/16/2006 10:49:09 AM:
>
> > Which URL is cached? Is the base URL of the SVGDocument taken into
> > account?
>
> Yes the base URL of the document is taken into account.
> > Example: <image xlink:href="somePic.jpg"/>
> >
> > But that works because:
> >
> > svgomDocument.setURLObject(new
> > File("pathWhereDocumentResides").toURL());
> >
> > So what is the parsed URL?
>
> Element imgElem = /* what ever */;
> String baseURI = XMLBaseSupport.getCascadedXMLBase(imgElem);
> ParsedURL purl;
> if (baseURI == null)
> purl = new ParsedURL(uriStr);
> else
> purl = new ParsedURL(baseURI, uriStr);
>
>
> >
> > file://complete/path/to/somePic.jpg
> >
> > or
> >
> > somePic.jpg
> >
> > Michael Bishop
> >
> > -----Original Message-----
> > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> > Sent: Friday, October 13, 2006 7:39 PM
> > To: [email protected]
> > Cc: [email protected]
> > Subject: Re: Resolving xlink:href at a later time?
> >
> > Hi Michael,
> >
> > "Bishop, Michael W. CONTR J9C880" <[EMAIL PROTECTED]>
wrote
> on
> >
> > 10/12/2006 05:07:13 PM:
> >
> > > An image element is placed and the xlink:href points to a
> non-existant
> >
> > file.
> > > The standard ?broken image? image appears on the JSVGCanvas
instead,
> > per
> >
> > > Batik. Next, the correct file appears in the correct place. How
do
> I
> >
> > tell
> > > Batik to try and resolve that again? JSVGCanvas.setDocument(?)
> > doesn?t
> > seem
> > > to have an effect, the image still appears broken.
> >
> > You need to clear the entry in the URLCache:
> >
> >
>
org.apache.batik.ext.awt.image.URLImageCache.getDefaultCache().clear(Par
> > sedURL
> > purl);
> >
> > Then removing the image Element form it's parent and reinserting
> > should cause it to reload the image.
> >
> >
> >
---------------------------------------------------------------------
> > To unsubscribe, e-mail:
[EMAIL PROTECTED]
> > For additional commands, e-mail:
> [EMAIL PROTECTED]
> >
> >
---------------------------------------------------------------------
> > To unsubscribe, e-mail:
[EMAIL PROTECTED]
> > For additional commands, e-mail:
> [EMAIL PROTECTED]
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail:
[EMAIL PROTECTED]
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail:
[EMAIL PROTECTED]
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]