You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by Per Kreipke <pe...@onclave.com> on 2001/04/20 21:31:27 UTC

Bug???

All,

I'm using Xerces 1.3.1 and Xalan 1.2.2 (and JDOM 1.0b6 which is important
later).

I create a transformer and transform a DOM Document (from the 'Getting
Started' docs):

public static void transform(
	XSLTInputSource xmlIn,
	XSLTInputSource xslIn,
	XSLTResultTarget out)
	throws SAXException, FileNotFoundException, IOException
{
	XSLTProcessor xslt = XSLTProcessorFactory.getProcessor(
		new org.apache.xalan.xpath.xdom.XercesLiaison());

	// Do it.
	xslt.process(xmlIn, xslIn, out);
}

The transform succeeds but it seems to be creating DOM level 1 Elements,
that is Elements without any localname nor namespace.

If I walk the results and call the following the DOM Level 2 methods:

	StringBuffer buffer = new StringBuffer();
	buffer.append("[ELEM: "
		+ element.getLocalName() + ","
		+ element.getNodeName() + ","
		+ element.getNamespaceURI() + ","
		+ element.getPrefix() + ","
		+ element.getTagName()
		+ "]");

I get the following for _every_ Element in the result (in this example, the
node is 'notes'):

[ELEM: null,notes,null,null,notes]

It's true, there isn't supposed to be a namespace on the elements (there's
no default namespace or any other ns for that matter). However, shouldn't
getLocalName() still return the nodename or tagname then?

Per.

That is, there is no local name for the element.


> -----Original Message-----
> From: alok [mailto:alokkumar510@yahoo.com]
> Sent: Thursday, August 10, 2000 2:45 PM
> To: xerces-j-dev@xml.apache.org; bjoern.martin@gmx.net
> Subject: Re: Samples with xerces-j 1.3.1
>
>
> > In my xerces.jar file, I can find the Node.class file in the
> org.w3c.dom
> package. Further, there is a NodeImpl.class file in > package
> org.apache.xerces.dom
> > Hope this helps.
> > Regards.
> > --
> > Bjoern Martin                                bjoern.martin@gmx.net
>
> thanx Bjoern,
> it really helped. and here are the findings from my little
> weekend research
> :-) :
> 1) the problem is actually with the DOMParser class whose instance is
> created in the IteratorView.java class.
> 2) In this when the default constructor is called with DOMParser(), its
> init() method is called subsequently. In the init(), a variable called
> fDocument is set to null, and this null value is returned when the
> getDocument() of DOMParser is called.
> 3) Actually this fDocument is assigned a appropriate value in
> startDocument() method of DOMParser.
> 4) In the sample IteratorView class, the getDocument() method is called
> directly after parse() method. Now i guess startDocument() is
> supposed to be
> called automatically by the parser during parsing. But it is not,
> resulting
> in a null pointer( value for the "document" variable in the sample) being
> returned. This results in a null pointer exception when
> isSupported method()
> is called later on the (null) "document" field.
> 5) The problem is solved when you call explicititly the startDocument()
> method in the sample IteratorView class on DOMParser, before actually
> calling "getDocument()".
>
> Now my question is:
> 1) Really, should the startDocument() of DOMParser class, be called
> automatically after the parse method() ??
> thanx in advance..
> regards
>
> alok
>
>
>
> _________________________________________________________
> Do You Yahoo!?
> Get your free @yahoo.com address at http://mail.yahoo.com
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-j-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-j-dev-help@xml.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-dev-help@xml.apache.org


RE: Bug???

Posted by Per Kreipke <pe...@onclave.com>.
P.s. I forgot this part....

So, the reason I conclude that the Elements are DOM Level 1, is the
following section of the Node definition in 'DOM  Core Level 2' document
(http://www.w3.org/TR/DOM-Level-2-Core/core.html):

"localName of type DOMString, readonly, introduced in DOM Level 2

Returns the local part of the qualified name of this node.
For nodes of any type other than ELEMENT_NODE and ATTRIBUTE_NODE and nodes
created with a DOM Level 1 method, such as createElement from the Document
interface, this is always null."

I'm wondering if in fact Xerces/Xalan should be setting the local name of
the node since the latest versions should presumably be building Level 2
nodes.

Per.


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-dev-help@xml.apache.org