You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by Olle Sundblad <ol...@eris.se> on 2002/10/03 17:22:50 UTC
Problem with end element
Hello,
I couldn't reach the archives so I dont know if this has already been
answered before.
Since upgrading to Xerces 2_2_0 (from version 1_2_3), I don't receive any
uri in the endElement callback (see bleow) when using the SAX-parser that is
uri is null even though there is a namespace (I do get the uri namespace in
the startElement method). With Xerces 1_2_3 I got the namespace at both
locations.
Example when parsing the following document:
<message xmlns:html="http://www.eris.se/html">
<html:p>Test paragraph</html:p>
</message>
with
public void startElement(String uri, String local, String raw, Attributes
attrs)
{ ... }
public void endElement(String uri, String local, String raw)
{ ... }
I get:
startElement -> uri == "http://www.eris.se/html"
endElement -> uri == null
Is this a bug or have I missed something in how you are allowd to use it.
/Olle
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org
Re: Problem with end element
Posted by Andy Clark <an...@apache.org>.
James Bates wrote:
> I just did; I got the two JARs from the URL you indicated, but the following
> Java still returns empty namespace in endElement. Maybe I should get the CVS
> source?
Gump only runs once a day, right? So you will have
to wait until tomorrow for a change entered today.
The best way is to update your source from CVS and
rebuild the jars.
--
Andy Clark * andyc@apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org
Re: Problem with end element
Posted by James Bates <ja...@amplexor.com>.
On Monday 07 October 2002 16:18, Elena Litani wrote:
> Andy Clark wrote:
> > Olle Sundblad wrote:
> > > Since upgrading to Xerces 2_2_0 (from version 1_2_3), I don't receive
> > > any uri in the endElement callback (see bleow) when using the
> > > SAX-parser that is
> >
> > I'm really surprised something like this could happen.
>
> I've just committed the fix. There was a bug in the new scanner (that
> also does namespace binding).
>
> Please, pick up the new code from CVS or the jars from
> http://gump.covalent.net/jars/latest/xml-xerces2/ and verify the fix.
> Thanks!
I just did; I got the two JARs from the URL you indicated, but the following
Java still returns empty namespace in endElement. Maybe I should get the CVS
source?
James
[NoEndNamespace.java]
/*
* NoEndNamespace.java: contains NoEndNamespace class
*
* Created on Oct 7, 2002
*/
import org.xml.sax.XMLReader;
import org.xml.sax.Attributes;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;
import javax.xml.parsers.SAXParserFactory;
import java.io.StringReader;
/**
* Demonstrate missing namespace URI in SAX endElement
*
* @author James Bates <ja...@amplexor.com>
* @version 1
*/
public class NoEndNamespace {
public static String xml = "<?xml version=\"1.0\"?>\n"
+ "<h:hello xmlns:h=\"http://www.james.net/Hello\">\n"
+ " Hello, world\n"
+ "</h:hello>\n";
public static void main(String[] args) throws Exception {
SAXParserFactory spf = SAXParserFactory.newInstance();
spf.setNamespaceAware(true);
XMLReader xr = spf.newSAXParser().getXMLReader();
xr.setContentHandler( new DefaultHandler() {
public void startElement(String nsURI, String localName,
String qName, Attributes att) throws SAXException {
System.out.println("start element: ns=" + nsURI
+ "; local-name=" + localName);
}
public void endElement(String nsURI, String localName,
String qName) throws SAXException {
System.out.println("end element: ns=" + nsURI
+ "; local-name=" + localName);
}
});
xr.parse(new InputSource(new StringReader(xml)));
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org
RE: Problem with end element
Posted by Olle Sundblad <ol...@eris.se>.
It works now (at least for the simple test case I have).
but as Andy Clark wrote I had to wait for (I didn't have time to set up and
compile the sources, but I might look into that someday in the future):
> Gump only runs once a day, right? So you will have
> to wait until tomorrow for a change entered today.
> The best way is to update your source from CVS and
> rebuild the jars.
Thanks for the fast response!
/Olle
> -----Original Message-----
> From: Elena Litani [mailto:elitani@ca.ibm.com]
> Sent: den 7 oktober 2002 16:19
> To: xerces-j-user@xml.apache.org
> Subject: Re: Problem with end element
>
>
> Andy Clark wrote:
> > Olle Sundblad wrote:
> > > Since upgrading to Xerces 2_2_0 (from version 1_2_3), I don't
> receive any
> > > uri in the endElement callback (see bleow) when using the
> SAX-parser that is
> > I'm really surprised something like this could happen.
>
> I've just committed the fix. There was a bug in the new scanner (that
> also does namespace binding).
>
> Please, pick up the new code from CVS or the jars from
> http://gump.covalent.net/jars/latest/xml-xerces2/ and verify the fix.
> Thanks!
> --
> Elena Litani / IBM Toronto
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-j-user-help@xml.apache.org
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org
Re: Problem with end element
Posted by Elena Litani <el...@ca.ibm.com>.
Andy Clark wrote:
> Olle Sundblad wrote:
> > Since upgrading to Xerces 2_2_0 (from version 1_2_3), I don't receive any
> > uri in the endElement callback (see bleow) when using the SAX-parser that is
> I'm really surprised something like this could happen.
I've just committed the fix. There was a bug in the new scanner (that
also does namespace binding).
Please, pick up the new code from CVS or the jars from
http://gump.covalent.net/jars/latest/xml-xerces2/ and verify the fix.
Thanks!
--
Elena Litani / IBM Toronto
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org
Re: Problem with end element
Posted by Andy Clark <an...@apache.org>.
Olle Sundblad wrote:
> Since upgrading to Xerces 2_2_0 (from version 1_2_3), I don't receive any
> uri in the endElement callback (see bleow) when using the SAX-parser that is
Verified.
I'm really surprised something like this could happen.
--
Andy Clark * andyc@apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org