You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Robin Green <gr...@hotmail.com> on 2001/01/19 22:40:04 UTC
Fwd: [C1][XInclude][PATCH] - XInclude DOM2 problem
This never got applied. This was a fix for running XInclude after XSLT.
>From: "Kirk Woerner" <ki...@stoneseeker.com>
>Reply-To: cocoon-dev@xml.apache.org
>To: "Cocoon Development List" <co...@xml.apache.org>
>Subject: [C1][XInclude][PATCH] - XInclude DOM2 problem
>Date: Tue, 14 Nov 2000 08:58:29 -0700
>
>This is a little ugly, but it works and I think it's valid. The bug
>appears when attempting to process xinclude elements that were generated
>from a stylesheet. The DOM nodes generated from within xsl are apparently
>not DOM II so the checks for "getAttributeNS()" in scanForXInclude() do
>not work when they should.
>
>I do not have "diff" so I just have to explain where the fix goes.
>scanForXInclude currently looks like the following.
>
>boolean scanForXInclude(Element element, Element parent) {
> if ( element.hasAttributeNS(processor.XINCLUDE_NAMESPACE_URI,
> processor.XINCLUDE_HREF_ATTRIBUTE) &&
> element.hasAttributeNS(processor.XINCLUDE_NAMESPACE_URI,
> processor.XINCLUDE_PARSE_ATTRIBUTE)) {
> String href = element.getAttributeNS(processor.XINCLUDE_NAMESPACE_URI,
>
>processor.XINCLUDE_HREF_ATTRIBUTE);
> String parse =
>element.getAttributeNS(processor.XINCLUDE_NAMESPACE_URI,
> processor.XINCLUDE_PARSE_ATTRIBUTE);
> xinclude_elements.addElement(new XIncludeElement(element,
>
>parent,href,parse,current_xmlbase));
> return true;
> }
> return false;
>}
>
>
>I propose that we add two static variables to the class
>
> public static final String XINCLUDE_NAMESPACE_TAG = "xinclude:";
> public static final String XINCLUDE_TAG = "include";
>
>and change scanForXInclude to be the following
>
>boolean scanForXInclude(Element element, Element parent) {
> if ( element.hasAttributeNS(processor.XINCLUDE_NAMESPACE_URI,
> processor.XINCLUDE_HREF_ATTRIBUTE) &&
> element.hasAttributeNS(processor.XINCLUDE_NAMESPACE_URI,
> processor.XINCLUDE_PARSE_ATTRIBUTE)) {
> String href = element.getAttributeNS(processor.XINCLUDE_NAMESPACE_URI,
>
>processor.XINCLUDE_HREF_ATTRIBUTE);
> String parse =
>element.getAttributeNS(processor.XINCLUDE_NAMESPACE_URI,
> processor.XINCLUDE_PARSE_ATTRIBUTE);
> xinclude_elements.addElement(new XIncludeElement(element,
>
>parent,href,parse,current_xmlbase));
> return true;
> }
>
> // also allow that if the NodeName is "include" or "xinclude:include"
>and there are
> // attributes "xinclude:href" and "xinclude:parse" then it's also an
>XInclude Node
> if ( ( element.getNodeName().equals(processor.XINCLUDE_TAG) ||
> element.getNodeName().equals(processor.XINCLUDE_NAMESPACE_TAG +
> processor.XINCLUDE_TAG)) &&
> element.hasAttribute(processor.XINCLUDE_NAMESPACE_TAG +
> processor.XINCLUDE_HREF_ATTRIBUTE) &&
> element.hasAttribute(processor.XINCLUDE_NAMESPACE_TAG +
> processor.XINCLUDE_PARSE_ATTRIBUTE)) {
> String href = element.getAttribute(processor.XINCLUDE_NAMESPACE_TAG +
> processor.XINCLUDE_HREF_ATTRIBUTE);
> String parse = element.getAttribute(processor.XINCLUDE_NAMESPACE_TAG +
>
>processor.XINCLUDE_PARSE_ATTRIBUTE);
> xinclude_elements.addElement(new XIncludeElement(element,
>
>parent,href,parse,current_xmlbase));
> return true;
> }
> return false;
>}
>
_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.