You are viewing a plain text version of this content. The canonical link for it is here.
Posted to xmlbeans-user@xml.apache.org by Nikhil Dinesh <ni...@seas.upenn.edu> on 2004/07/06 02:42:18 UTC

XPath implementation extent

Hi,

Im using the CVS build of XMLBeans so I could work with XPath. However
attribute tests dont seem to work.

For example:

declare namespace xq='....'$this//xq:foo - works
declare namespace xq='....'$this//xq:foo[@type='bar'] - doesnt work

However:

declare namespace xq='....'$this//xq:foo/@type - selects the fragment

but I cant figure out a way to match content. Is there one?

Thanks,
Nikhil





- ---------------------------------------------------------------------
To unsubscribe, e-mail:   xmlbeans-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xmlbeans-user-help@xml.apache.org
Apache XMLBeans Project -- URL: http://xml.apache.org/xmlbeans/


Re: Elements from imported namespaces

Posted by Nikhil Dinesh <ni...@seas.upenn.edu>.
Im not using an explicit XmlAnyType. The type is FooElement. Im just
reading it in messaging the XmlSaxHandler. And as per the W3 recommendation
it is not the case that it has to be the last element. For example, I could
include attributes from another namespace which are not in any ModelGroup.
But there is some interaction between the targetNamespace and the imported
namespace which if I understand correctly is:

<element name="Foo" type="foo:FooElementType" > (the name Foo will now be
in the targetNamespace. I think the children preserve the old namsepace)

<element ref="foo:FooElement" > (the namespace is preserved)

The default value for processContents is 'strict' so they should be typed.

Finally, the schema below does not allow elements of AnyType. Thus seeing
such an element should cause errors. Right? And the validator should know
that it is of BarType because the container element will be of type
BarElementDocument thats how the instance of XmlSaxHandler is created.

-Nikhil


On Fri, 9 Jul 2004, Noah Campbell wrote:

> If memory serves, if you use an XmlAnyType you need to place it last
> in your sequence since the schema validator (and xmlbeans) won't know
> if BarType is part of BarType or FooElementDocument.
>
> Noah
>
> On Thu, 8 Jul 2004 21:53:57 -0400 (EDT), Nikhil Dinesh
> <ni...@seas.upenn.edu> wrote:
> > Hi,
> >
> > Im referencing a global element from an imported namespace in my schema.
> > But when I read an instance in, the referenced element takes the type
> > XmlAnyType instead of the correct one. The schema looks like:
> >
> > <schema xmlns:target="http://bar.com"
> >         xmlns:foo="http://foo.com"
> >         targetNamespace="http://bar.com"
> >         elementFormDefault="qualified">
> >
> >   <import namespace="http://foo.com" schemaLocation="..." />
> >
> >   <complexType name="BarType" >
> >     <sequence>
> >       <element ref="foo:FooElement" minOccurs="1" maxOccurs="1" />
> >       <element name="Bar" type="target:BarType" minOccurs="0" maxOccurs="unbounded" />
> >     </sequence>
> >   </complexType>
> >
> > </schema>
> >
> > Reading in a FooElementDocument works fine with the elements taking their
> > appropriate types. But reading a BarType document results in the
> > FooElements having XmlAnyType.
> >
> > Ive tried putting the FooElement in both namespaces and setting an
> > ErrorListener with the validateOnSet option. But no errors are flagged and
> > behaviour is the same whichever I choose. Im reading the document in by
> > messaging the SAXHandler.
> >
> > Any suggestions as to what I might be doing wrong?
> > Thanks,
> > Nikhil
> >
> > - ---------------------------------------------------------------------
> > To unsubscribe, e-mail:   xmlbeans-user-unsubscribe@xml.apache.org
> > For additional commands, e-mail: xmlbeans-user-help@xml.apache.org
> > Apache XMLBeans Project -- URL: http://xml.apache.org/xmlbeans/
> >
> >
>
> - ---------------------------------------------------------------------
> To unsubscribe, e-mail:   xmlbeans-user-unsubscribe@xml.apache.org
> For additional commands, e-mail: xmlbeans-user-help@xml.apache.org
> Apache XMLBeans Project -- URL: http://xml.apache.org/xmlbeans/
>

- ---------------------------------------------------------------------
To unsubscribe, e-mail:   xmlbeans-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xmlbeans-user-help@xml.apache.org
Apache XMLBeans Project -- URL: http://xml.apache.org/xmlbeans/


Re: Elements from imported namespaces

Posted by Nikhil Dinesh <ni...@seas.upenn.edu>.
Im not using an explicit XmlAnyType. The type is FooElement. Im just
reading it in messaging the XmlSaxHandler. And as per the W3 recommendation
it is not the case that it has to be the last element. For example, I could
include attributes from another namespace which are not in any ModelGroup.
But there is some interaction between the targetNamespace and the imported
namespace which if I understand correctly is:

<element name="Foo" type="foo:FooElementType" > (the name Foo will now be
in the targetNamespace. I think the children preserve the old namsepace)

<element ref="foo:FooElement" > (the namespace is preserved)

The default value for processContents is 'strict' so they should be typed.

Finally, the schema below does not allow elements of AnyType. Thus seeing
such an element should cause errors. Right? And the validator should know
that it is of BarType because the container element will be of type
BarElementDocument thats how the instance of XmlSaxHandler is created.

-Nikhil


On Fri, 9 Jul 2004, Noah Campbell wrote:

> If memory serves, if you use an XmlAnyType you need to place it last
> in your sequence since the schema validator (and xmlbeans) won't know
> if BarType is part of BarType or FooElementDocument.
>
> Noah
>
> On Thu, 8 Jul 2004 21:53:57 -0400 (EDT), Nikhil Dinesh
> <ni...@seas.upenn.edu> wrote:
> > Hi,
> >
> > Im referencing a global element from an imported namespace in my schema.
> > But when I read an instance in, the referenced element takes the type
> > XmlAnyType instead of the correct one. The schema looks like:
> >
> > <schema xmlns:target="http://bar.com"
> >         xmlns:foo="http://foo.com"
> >         targetNamespace="http://bar.com"
> >         elementFormDefault="qualified">
> >
> >   <import namespace="http://foo.com" schemaLocation="..." />
> >
> >   <complexType name="BarType" >
> >     <sequence>
> >       <element ref="foo:FooElement" minOccurs="1" maxOccurs="1" />
> >       <element name="Bar" type="target:BarType" minOccurs="0" maxOccurs="unbounded" />
> >     </sequence>
> >   </complexType>
> >
> > </schema>
> >
> > Reading in a FooElementDocument works fine with the elements taking their
> > appropriate types. But reading a BarType document results in the
> > FooElements having XmlAnyType.
> >
> > Ive tried putting the FooElement in both namespaces and setting an
> > ErrorListener with the validateOnSet option. But no errors are flagged and
> > behaviour is the same whichever I choose. Im reading the document in by
> > messaging the SAXHandler.
> >
> > Any suggestions as to what I might be doing wrong?
> > Thanks,
> > Nikhil
> >
> > - ---------------------------------------------------------------------
> > To unsubscribe, e-mail:   xmlbeans-user-unsubscribe@xml.apache.org
> > For additional commands, e-mail: xmlbeans-user-help@xml.apache.org
> > Apache XMLBeans Project -- URL: http://xml.apache.org/xmlbeans/
> >
> >
>
> - ---------------------------------------------------------------------
> To unsubscribe, e-mail:   xmlbeans-user-unsubscribe@xml.apache.org
> For additional commands, e-mail: xmlbeans-user-help@xml.apache.org
> Apache XMLBeans Project -- URL: http://xml.apache.org/xmlbeans/
>

- ---------------------------------------------------------------------
To unsubscribe, e-mail:   xmlbeans-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xmlbeans-user-help@xml.apache.org
Apache XMLBeans Project -- URL: http://xml.apache.org/xmlbeans/


Re: Elements from imported namespaces

Posted by Noah Campbell <no...@gmail.com>.
If memory serves, if you use an XmlAnyType you need to place it last
in your sequence since the schema validator (and xmlbeans) won't know
if BarType is part of BarType or FooElementDocument.

Noah

On Thu, 8 Jul 2004 21:53:57 -0400 (EDT), Nikhil Dinesh
<ni...@seas.upenn.edu> wrote:
> Hi,
> 
> Im referencing a global element from an imported namespace in my schema.
> But when I read an instance in, the referenced element takes the type
> XmlAnyType instead of the correct one. The schema looks like:
> 
> <schema xmlns:target="http://bar.com"
>         xmlns:foo="http://foo.com"
>         targetNamespace="http://bar.com"
>         elementFormDefault="qualified">
> 
>   <import namespace="http://foo.com" schemaLocation="..." />
> 
>   <complexType name="BarType" >
>     <sequence>
>       <element ref="foo:FooElement" minOccurs="1" maxOccurs="1" />
>       <element name="Bar" type="target:BarType" minOccurs="0" maxOccurs="unbounded" />
>     </sequence>
>   </complexType>
> 
> </schema>
> 
> Reading in a FooElementDocument works fine with the elements taking their
> appropriate types. But reading a BarType document results in the
> FooElements having XmlAnyType.
> 
> Ive tried putting the FooElement in both namespaces and setting an
> ErrorListener with the validateOnSet option. But no errors are flagged and
> behaviour is the same whichever I choose. Im reading the document in by
> messaging the SAXHandler.
> 
> Any suggestions as to what I might be doing wrong?
> Thanks,
> Nikhil
> 
> - ---------------------------------------------------------------------
> To unsubscribe, e-mail:   xmlbeans-user-unsubscribe@xml.apache.org
> For additional commands, e-mail: xmlbeans-user-help@xml.apache.org
> Apache XMLBeans Project -- URL: http://xml.apache.org/xmlbeans/
> 
>

- ---------------------------------------------------------------------
To unsubscribe, e-mail:   xmlbeans-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xmlbeans-user-help@xml.apache.org
Apache XMLBeans Project -- URL: http://xml.apache.org/xmlbeans/


Re: Elements from imported namespaces

Posted by Noah Campbell <no...@gmail.com>.
If memory serves, if you use an XmlAnyType you need to place it last
in your sequence since the schema validator (and xmlbeans) won't know
if BarType is part of BarType or FooElementDocument.

Noah

On Thu, 8 Jul 2004 21:53:57 -0400 (EDT), Nikhil Dinesh
<ni...@seas.upenn.edu> wrote:
> Hi,
> 
> Im referencing a global element from an imported namespace in my schema.
> But when I read an instance in, the referenced element takes the type
> XmlAnyType instead of the correct one. The schema looks like:
> 
> <schema xmlns:target="http://bar.com"
>         xmlns:foo="http://foo.com"
>         targetNamespace="http://bar.com"
>         elementFormDefault="qualified">
> 
>   <import namespace="http://foo.com" schemaLocation="..." />
> 
>   <complexType name="BarType" >
>     <sequence>
>       <element ref="foo:FooElement" minOccurs="1" maxOccurs="1" />
>       <element name="Bar" type="target:BarType" minOccurs="0" maxOccurs="unbounded" />
>     </sequence>
>   </complexType>
> 
> </schema>
> 
> Reading in a FooElementDocument works fine with the elements taking their
> appropriate types. But reading a BarType document results in the
> FooElements having XmlAnyType.
> 
> Ive tried putting the FooElement in both namespaces and setting an
> ErrorListener with the validateOnSet option. But no errors are flagged and
> behaviour is the same whichever I choose. Im reading the document in by
> messaging the SAXHandler.
> 
> Any suggestions as to what I might be doing wrong?
> Thanks,
> Nikhil
> 
> - ---------------------------------------------------------------------
> To unsubscribe, e-mail:   xmlbeans-user-unsubscribe@xml.apache.org
> For additional commands, e-mail: xmlbeans-user-help@xml.apache.org
> Apache XMLBeans Project -- URL: http://xml.apache.org/xmlbeans/
> 
>

- ---------------------------------------------------------------------
To unsubscribe, e-mail:   xmlbeans-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xmlbeans-user-help@xml.apache.org
Apache XMLBeans Project -- URL: http://xml.apache.org/xmlbeans/


Elements from imported namespaces

Posted by Nikhil Dinesh <ni...@seas.upenn.edu>.
Hi,

Im referencing a global element from an imported namespace in my schema.
But when I read an instance in, the referenced element takes the type
XmlAnyType instead of the correct one. The schema looks like:

<schema xmlns:target="http://bar.com"
        xmlns:foo="http://foo.com"
        targetNamespace="http://bar.com"
        elementFormDefault="qualified">

  <import namespace="http://foo.com" schemaLocation="..." />

  <complexType name="BarType" >
    <sequence>
      <element ref="foo:FooElement" minOccurs="1" maxOccurs="1" />
      <element name="Bar" type="target:BarType" minOccurs="0" maxOccurs="unbounded" />
    </sequence>
  </complexType>


</schema>

Reading in a FooElementDocument works fine with the elements taking their
appropriate types. But reading a BarType document results in the
FooElements having XmlAnyType.

Ive tried putting the FooElement in both namespaces and setting an
ErrorListener with the validateOnSet option. But no errors are flagged and
behaviour is the same whichever I choose. Im reading the document in by
messaging the SAXHandler.


Any suggestions as to what I might be doing wrong?
Thanks,
Nikhil

- ---------------------------------------------------------------------
To unsubscribe, e-mail:   xmlbeans-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xmlbeans-user-help@xml.apache.org
Apache XMLBeans Project -- URL: http://xml.apache.org/xmlbeans/


Elements from imported namespaces

Posted by Nikhil Dinesh <ni...@seas.upenn.edu>.
Hi,

Im referencing a global element from an imported namespace in my schema.
But when I read an instance in, the referenced element takes the type
XmlAnyType instead of the correct one. The schema looks like:

<schema xmlns:target="http://bar.com"
        xmlns:foo="http://foo.com"
        targetNamespace="http://bar.com"
        elementFormDefault="qualified">

  <import namespace="http://foo.com" schemaLocation="..." />

  <complexType name="BarType" >
    <sequence>
      <element ref="foo:FooElement" minOccurs="1" maxOccurs="1" />
      <element name="Bar" type="target:BarType" minOccurs="0" maxOccurs="unbounded" />
    </sequence>
  </complexType>


</schema>

Reading in a FooElementDocument works fine with the elements taking their
appropriate types. But reading a BarType document results in the
FooElements having XmlAnyType.

Ive tried putting the FooElement in both namespaces and setting an
ErrorListener with the validateOnSet option. But no errors are flagged and
behaviour is the same whichever I choose. Im reading the document in by
messaging the SAXHandler.


Any suggestions as to what I might be doing wrong?
Thanks,
Nikhil

- ---------------------------------------------------------------------
To unsubscribe, e-mail:   xmlbeans-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xmlbeans-user-help@xml.apache.org
Apache XMLBeans Project -- URL: http://xml.apache.org/xmlbeans/