You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by Tarun Garg <ta...@ebprovider.com> on 2001/03/16 07:38:53 UTC

xpath parsing

I am trying to use XPathParser for my XPath parsing requirement.
The code is attached.
The code works fine enough for XPaths like
/high/medium/low
but crashes out for XPaths like
//HI[@C='32']

It gives me a java.lang.ClassCastException when I try to cast '32' into a
string.

I am sorry if this is a very stupid question to ask, but I am a java/Xalan
newbie.
Actually I've seen a similar statement in the function nextToken() in
XPathParser and it works there.

  private final void nextToken()
  {

    if (m_queueMark < m_ops.m_tokenQueueSize)
    {
      m_token = (String) m_ops.m_tokenQueue[m_queueMark++];
..................
     }
}

I am working on Win2k, jdk1.3 and xalan2.0


Re: xpath parsing

Posted by Tarun Garg <ta...@ebprovider.com>.
I could get rid of ClassCastException by replacing

String token = (String) compiler.m_tokenQueue[ i];

with

XObject obj = new XObject(compiler.m_tokenQueue[ i]);
String token = obj.str();

but I still could'nt figure out how is this thing working in
XPathParser::nextToken()


----- Original Message -----
From: "Tarun Garg" <ta...@ebprovider.com>
To: <xa...@xml.apache.org>
Cc: "Tarun Garg" <ta...@ebprovider.com>
Sent: Friday, March 16, 2001 12:08 PM
Subject: xpath parsing


> I am trying to use XPathParser for my XPath parsing requirement.
> The code is attached.
> The code works fine enough for XPaths like
> /high/medium/low
> but crashes out for XPaths like
> //HI[@C='32']
>
> It gives me a java.lang.ClassCastException when I try to cast '32' into a
> string.
>
> I am sorry if this is a very stupid question to ask, but I am a java/Xalan
> newbie.
> Actually I've seen a similar statement in the function nextToken() in
> XPathParser and it works there.
>
>   private final void nextToken()
>   {
>
>     if (m_queueMark < m_ops.m_tokenQueueSize)
>     {
>       m_token = (String) m_ops.m_tokenQueue[m_queueMark++];
> ..................
>      }
> }
>
> I am working on Win2k, jdk1.3 and xalan2.0
>
>