You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by Ernesto Santos <er...@mog-solutions.com> on 2003/02/04 15:32:30 UTC

prefix resolving problem

Hi

I sent this message on February 1st but I don't see it in the list archive
so I'm sending
it again in case there was some problem.

I've been using XalanC 1.4 and have the following problem:

I loaded the following XML document (which happens to be an XSD)

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified" attributeFormDefault="unqualified">
   <xs:annotation>
       <xs:appinfo source="my_app">my_schema</xs:appinfo>
   </xs:annotation>
</xs:schema>

Using XPathEvaluator::selectNodeList I executed the expression "/xs:schema"
and it worked fine, I got back one node.

But then I added a default namespace to the first elemennt

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns="some_uri" xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified" attributeFormDefault="unqualified">
   <xs:annotation>
       <xs:appinfo source="my_app">my_schema</xs:appinfo>
   </xs:annotation>
</xs:schema>

executing the spath expressions I got the following results

"/xs:schema" - the returned NodeList is empty
"/*" - the returned NodeList has one node
"/*[local-name()='schema']" - the returned NodeList has one node

So it seemed to me there was a problem resolving prefixes

I went to the source code and found the
DOMServices::getNamespaceForPrefix
The algorithm doesn't seem to take into account the presenc of a default
namespace so I patched it with this

"(equals(prefix,"")) && "

the code excerpt follows

if ( (equals(prefix,"")) && (equals(aname, s_XMLNamespace) == true))
{
      theNamespace = &attr->getNodeValue();
      break;
}
else if (startsWith(aname, s_XMLNamespaceWithSeparator) == true)
{
      if (equals(
                    prefix,
                    c_wstr(aname) + s_XMLNamespaceWithSeparatorLength) ==
true)
       {
                theNamespace = &attr->getNodeValue();
                break;
       }
}

It seems to work now but I'm not sure if this will break any other part of
the code.

Thanks in advance

Ernesto







Re: prefix resolving problem

Posted by Ernesto Santos <er...@mog-solutions.com>.
Ok. Thanks

Ernesto

----- Original Message -----
From: "David N Bertoni/Cambridge/IBM" <da...@us.ibm.com>
To: <xa...@xml.apache.org>
Sent: Wednesday, February 05, 2003 3:40 PM
Subject: Re: prefix resolving problem


>
>
>
>
> Hi Ernesto,
>
> The next version of Xalan will be 1.5.  I'm not sure when we'll do the
next
> release, but I suspect within the month is about right.  We're waiting on
> the Xerces 2.2 release before we do ours.
>
> Dave
>
>
>
>
>                       "Ernesto Santos"
>                       <ernesto.santos@mog-sol         To:
<xa...@xml.apache.org>
>                       utions.com>                     cc:      (bcc: David
N Bertoni/Cambridge/IBM)
>                                                       Subject: Re: prefix
resolving problem
>                       02/05/2003 02:02 AM
>                       Please respond to
>                       xalan-dev
>
>
>
>
> David,
>
> Thank you for your prompt reply
>
> I'll get it from CVS then. But can you tell me when is this going to be
> available as a binary release from the Apache web site
> and which release number it will be? because I need to specify it in my
> documentation... can I assume it's 1.4.1?
>
> Thanks
> Ernesto
>
> ----- Original Message -----
> From: "David N Bertoni/Cambridge/IBM" <da...@us.ibm.com>
> To: <xa...@xml.apache.org>
> Sent: Tuesday, February 04, 2003 7:40 PM
> Subject: Re: prefix resolving problem
>
>
> >
> >
> >
> >
> > Hi Ernesto,
> >
> > This bug has already been fixed, so you might want to try building from
> the
> > latest CVS code, or from a CVS snapshot.
> >
> > Thanks!
> >
> > Dave
> >
> >
> >
> >
> >                       "Ernesto Santos"
> >                       <ernesto.santos@mog-sol         To:
> <xa...@xml.apache.org>
> >                       utions.com>                     cc:      (bcc:
> David
> N Bertoni/Cambridge/IBM)
> >                                                       Subject: prefix
> resolving problem
> >                       02/04/2003 06:32 AM
> >                       Please respond to
> >                       xalan-dev
> >
> >
> >
> >
> > Hi
> >
> > I sent this message on February 1st but I don't see it in the list
> archive
> > so I'm sending
> > it again in case there was some problem.
> >
> > I've been using XalanC 1.4 and have the following problem:
> >
> > I loaded the following XML document (which happens to be an XSD)
> >
> > <?xml version="1.0" encoding="UTF-8"?>
> > <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
> > elementFormDefault="qualified" attributeFormDefault="unqualified">
> >    <xs:annotation>
> >        <xs:appinfo source="my_app">my_schema</xs:appinfo>
> >    </xs:annotation>
> > </xs:schema>
> >
> > Using XPathEvaluator::selectNodeList I executed the expression
> "/xs:schema"
> > and it worked fine, I got back one node.
> >
> > But then I added a default namespace to the first elemennt
> >
> > <?xml version="1.0" encoding="UTF-8"?>
> > <xs:schema xmlns="some_uri" xmlns:xs="http://www.w3.org/2001/XMLSchema"
> > elementFormDefault="qualified" attributeFormDefault="unqualified">
> >    <xs:annotation>
> >        <xs:appinfo source="my_app">my_schema</xs:appinfo>
> >    </xs:annotation>
> > </xs:schema>
> >
> > executing the spath expressions I got the following results
> >
> > "/xs:schema" - the returned NodeList is empty
> > "/*" - the returned NodeList has one node
> > "/*[local-name()='schema']" - the returned NodeList has one node
> >
> > So it seemed to me there was a problem resolving prefixes
> >
> > I went to the source code and found the
> > DOMServices::getNamespaceForPrefix
> > The algorithm doesn't seem to take into account the presenc of a default
> > namespace so I patched it with this
> >
> > "(equals(prefix,"")) && "
> >
> > the code excerpt follows
> >
> > if ( (equals(prefix,"")) && (equals(aname, s_XMLNamespace) == true))
> > {
> >       theNamespace = &attr->getNodeValue();
> >       break;
> > }
> > else if (startsWith(aname, s_XMLNamespaceWithSeparator) == true)
> > {
> >       if (equals(
> >                     prefix,
> >                     c_wstr(aname) + s_XMLNamespaceWithSeparatorLength)
==
> > true)
> >        {
> >                 theNamespace = &attr->getNodeValue();
> >                 break;
> >        }
> > }
> >
> > It seems to work now but I'm not sure if this will break any other part
> of
> > the code.
> >
> > Thanks in advance
> >
> > Ernesto
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
>
>
>
>
>



Re: prefix resolving problem

Posted by David N Bertoni/Cambridge/IBM <da...@us.ibm.com>.



Hi Ernesto,

The next version of Xalan will be 1.5.  I'm not sure when we'll do the next
release, but I suspect within the month is about right.  We're waiting on
the Xerces 2.2 release before we do ours.

Dave



                                                                                                                                             
                      "Ernesto Santos"                                                                                                       
                      <ernesto.santos@mog-sol         To:      <xa...@xml.apache.org>                                                    
                      utions.com>                     cc:      (bcc: David N Bertoni/Cambridge/IBM)                                          
                                                      Subject: Re: prefix resolving problem                                                  
                      02/05/2003 02:02 AM                                                                                                    
                      Please respond to                                                                                                      
                      xalan-dev                                                                                                              
                                                                                                                                             



David,

Thank you for your prompt reply

I'll get it from CVS then. But can you tell me when is this going to be
available as a binary release from the Apache web site
and which release number it will be? because I need to specify it in my
documentation... can I assume it's 1.4.1?

Thanks
Ernesto

----- Original Message -----
From: "David N Bertoni/Cambridge/IBM" <da...@us.ibm.com>
To: <xa...@xml.apache.org>
Sent: Tuesday, February 04, 2003 7:40 PM
Subject: Re: prefix resolving problem


>
>
>
>
> Hi Ernesto,
>
> This bug has already been fixed, so you might want to try building from
the
> latest CVS code, or from a CVS snapshot.
>
> Thanks!
>
> Dave
>
>
>
>
>                       "Ernesto Santos"
>                       <ernesto.santos@mog-sol         To:
<xa...@xml.apache.org>
>                       utions.com>                     cc:      (bcc:
David
N Bertoni/Cambridge/IBM)
>                                                       Subject: prefix
resolving problem
>                       02/04/2003 06:32 AM
>                       Please respond to
>                       xalan-dev
>
>
>
>
> Hi
>
> I sent this message on February 1st but I don't see it in the list
archive
> so I'm sending
> it again in case there was some problem.
>
> I've been using XalanC 1.4 and have the following problem:
>
> I loaded the following XML document (which happens to be an XSD)
>
> <?xml version="1.0" encoding="UTF-8"?>
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
> elementFormDefault="qualified" attributeFormDefault="unqualified">
>    <xs:annotation>
>        <xs:appinfo source="my_app">my_schema</xs:appinfo>
>    </xs:annotation>
> </xs:schema>
>
> Using XPathEvaluator::selectNodeList I executed the expression
"/xs:schema"
> and it worked fine, I got back one node.
>
> But then I added a default namespace to the first elemennt
>
> <?xml version="1.0" encoding="UTF-8"?>
> <xs:schema xmlns="some_uri" xmlns:xs="http://www.w3.org/2001/XMLSchema"
> elementFormDefault="qualified" attributeFormDefault="unqualified">
>    <xs:annotation>
>        <xs:appinfo source="my_app">my_schema</xs:appinfo>
>    </xs:annotation>
> </xs:schema>
>
> executing the spath expressions I got the following results
>
> "/xs:schema" - the returned NodeList is empty
> "/*" - the returned NodeList has one node
> "/*[local-name()='schema']" - the returned NodeList has one node
>
> So it seemed to me there was a problem resolving prefixes
>
> I went to the source code and found the
> DOMServices::getNamespaceForPrefix
> The algorithm doesn't seem to take into account the presenc of a default
> namespace so I patched it with this
>
> "(equals(prefix,"")) && "
>
> the code excerpt follows
>
> if ( (equals(prefix,"")) && (equals(aname, s_XMLNamespace) == true))
> {
>       theNamespace = &attr->getNodeValue();
>       break;
> }
> else if (startsWith(aname, s_XMLNamespaceWithSeparator) == true)
> {
>       if (equals(
>                     prefix,
>                     c_wstr(aname) + s_XMLNamespaceWithSeparatorLength) ==
> true)
>        {
>                 theNamespace = &attr->getNodeValue();
>                 break;
>        }
> }
>
> It seems to work now but I'm not sure if this will break any other part
of
> the code.
>
> Thanks in advance
>
> Ernesto
>
>
>
>
>
>
>
>
>
>





Re: prefix resolving problem

Posted by Ernesto Santos <er...@mog-solutions.com>.
David,

Thank you for your prompt reply

I'll get it from CVS then. But can you tell me when is this going to be
available as a binary release from the Apache web site
and which release number it will be? because I need to specify it in my
documentation... can I assume it's 1.4.1?

Thanks
Ernesto

----- Original Message -----
From: "David N Bertoni/Cambridge/IBM" <da...@us.ibm.com>
To: <xa...@xml.apache.org>
Sent: Tuesday, February 04, 2003 7:40 PM
Subject: Re: prefix resolving problem


>
>
>
>
> Hi Ernesto,
>
> This bug has already been fixed, so you might want to try building from
the
> latest CVS code, or from a CVS snapshot.
>
> Thanks!
>
> Dave
>
>
>
>
>                       "Ernesto Santos"
>                       <ernesto.santos@mog-sol         To:
<xa...@xml.apache.org>
>                       utions.com>                     cc:      (bcc: David
N Bertoni/Cambridge/IBM)
>                                                       Subject: prefix
resolving problem
>                       02/04/2003 06:32 AM
>                       Please respond to
>                       xalan-dev
>
>
>
>
> Hi
>
> I sent this message on February 1st but I don't see it in the list archive
> so I'm sending
> it again in case there was some problem.
>
> I've been using XalanC 1.4 and have the following problem:
>
> I loaded the following XML document (which happens to be an XSD)
>
> <?xml version="1.0" encoding="UTF-8"?>
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
> elementFormDefault="qualified" attributeFormDefault="unqualified">
>    <xs:annotation>
>        <xs:appinfo source="my_app">my_schema</xs:appinfo>
>    </xs:annotation>
> </xs:schema>
>
> Using XPathEvaluator::selectNodeList I executed the expression
"/xs:schema"
> and it worked fine, I got back one node.
>
> But then I added a default namespace to the first elemennt
>
> <?xml version="1.0" encoding="UTF-8"?>
> <xs:schema xmlns="some_uri" xmlns:xs="http://www.w3.org/2001/XMLSchema"
> elementFormDefault="qualified" attributeFormDefault="unqualified">
>    <xs:annotation>
>        <xs:appinfo source="my_app">my_schema</xs:appinfo>
>    </xs:annotation>
> </xs:schema>
>
> executing the spath expressions I got the following results
>
> "/xs:schema" - the returned NodeList is empty
> "/*" - the returned NodeList has one node
> "/*[local-name()='schema']" - the returned NodeList has one node
>
> So it seemed to me there was a problem resolving prefixes
>
> I went to the source code and found the
> DOMServices::getNamespaceForPrefix
> The algorithm doesn't seem to take into account the presenc of a default
> namespace so I patched it with this
>
> "(equals(prefix,"")) && "
>
> the code excerpt follows
>
> if ( (equals(prefix,"")) && (equals(aname, s_XMLNamespace) == true))
> {
>       theNamespace = &attr->getNodeValue();
>       break;
> }
> else if (startsWith(aname, s_XMLNamespaceWithSeparator) == true)
> {
>       if (equals(
>                     prefix,
>                     c_wstr(aname) + s_XMLNamespaceWithSeparatorLength) ==
> true)
>        {
>                 theNamespace = &attr->getNodeValue();
>                 break;
>        }
> }
>
> It seems to work now but I'm not sure if this will break any other part of
> the code.
>
> Thanks in advance
>
> Ernesto
>
>
>
>
>
>
>
>
>
>



Re: prefix resolving problem

Posted by David N Bertoni/Cambridge/IBM <da...@us.ibm.com>.



Hi Ernesto,

This bug has already been fixed, so you might want to try building from the
latest CVS code, or from a CVS snapshot.

Thanks!

Dave



                                                                                                                                             
                      "Ernesto Santos"                                                                                                       
                      <ernesto.santos@mog-sol         To:      <xa...@xml.apache.org>                                                    
                      utions.com>                     cc:      (bcc: David N Bertoni/Cambridge/IBM)                                          
                                                      Subject: prefix resolving problem                                                      
                      02/04/2003 06:32 AM                                                                                                    
                      Please respond to                                                                                                      
                      xalan-dev                                                                                                              
                                                                                                                                             



Hi

I sent this message on February 1st but I don't see it in the list archive
so I'm sending
it again in case there was some problem.

I've been using XalanC 1.4 and have the following problem:

I loaded the following XML document (which happens to be an XSD)

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified" attributeFormDefault="unqualified">
   <xs:annotation>
       <xs:appinfo source="my_app">my_schema</xs:appinfo>
   </xs:annotation>
</xs:schema>

Using XPathEvaluator::selectNodeList I executed the expression "/xs:schema"
and it worked fine, I got back one node.

But then I added a default namespace to the first elemennt

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns="some_uri" xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified" attributeFormDefault="unqualified">
   <xs:annotation>
       <xs:appinfo source="my_app">my_schema</xs:appinfo>
   </xs:annotation>
</xs:schema>

executing the spath expressions I got the following results

"/xs:schema" - the returned NodeList is empty
"/*" - the returned NodeList has one node
"/*[local-name()='schema']" - the returned NodeList has one node

So it seemed to me there was a problem resolving prefixes

I went to the source code and found the
DOMServices::getNamespaceForPrefix
The algorithm doesn't seem to take into account the presenc of a default
namespace so I patched it with this

"(equals(prefix,"")) && "

the code excerpt follows

if ( (equals(prefix,"")) && (equals(aname, s_XMLNamespace) == true))
{
      theNamespace = &attr->getNodeValue();
      break;
}
else if (startsWith(aname, s_XMLNamespaceWithSeparator) == true)
{
      if (equals(
                    prefix,
                    c_wstr(aname) + s_XMLNamespaceWithSeparatorLength) ==
true)
       {
                theNamespace = &attr->getNodeValue();
                break;
       }
}

It seems to work now but I'm not sure if this will break any other part of
the code.

Thanks in advance

Ernesto