You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cxf.apache.org by Benson Margulies <bi...@gmail.com> on 2010/10/13 01:26:49 UTC

XmlSchema, error checking, RFSB, hmm?

Line 1250 of RFSB sets an element's qname to a message part qname.

The thing is, in the situation at hand, that message part lives in a
different namespace than the schema of the element. And, so far as
I've understood it, all the elements of schema 'x' have to live in the
namespace of schema 'x'. The name of an element is an NCName, not a
qname. XmlSchema 2.0 still has an API to set a qname but checks the
namespace for sensibility. I am inclined to eliminate this, and make
it so that the only setter for names of these things takes strings.

When I do that, what do I do with RFSB? Just pull out the local part
of the mpi name and hope for a lack of collisions?

Re: XmlSchema, error checking, RFSB, hmm?

Posted by Daniel Kulp <dk...@apache.org>.
On Wednesday 13 October 2010 3:42:31 pm Benson Margulies wrote:
> My view of this sort of thing is that the first thing we need is a
> test case: a wsdl that somehow ends up with parts in multiple
> namespaces.

Looking at the  RFSB at that location:

        // We hope that we can't have parts that different only in namespace.
            el.setName(mpi.getName().getLocalPart());
            Map<Class, Boolean> jaxbAnnoMap = getJaxbAnnoMap(mpi);
            if (mpi.isElement()) {
                addImport(schema, mpi.getElementQName().getNamespaceURI());
                el.setName(null);
                XmlSchemaUtils.setElementRefName(el, mpi.getElementQName());

That covers this usecase.   The mpi would be set as an element already and it 
resets the element name back to null and sets the reference.

TECHNICALLY, the el.setName(...) call could be moved into the other "if" 
cases.


-- 
Daniel Kulp
dkulp@apache.org
http://dankulp.com/blog

Re: XmlSchema, error checking, RFSB, hmm?

Posted by Benson Margulies <bi...@gmail.com>.
My view of this sort of thing is that the first thing we need is a
test case: a wsdl that somehow ends up with parts in multiple
namespaces.

Re: XmlSchema, error checking, RFSB, hmm?

Posted by Daniel Kulp <dk...@apache.org>.
On Wednesday 13 October 2010 7:58:08 am Benson Margulies wrote:
> We're in createWrappedMessageSchema. here's what I have today ...
> 
>  for (MessagePartInfo mpi : unwrappedMessage.getMessageParts()) {
>             el = new XmlSchemaElement(schema, false);
>             // We hope that we can't have parts that differe only in
> namespace. el.setName(mpi.getName().getLocalPart());
> 
> 
> The last line used to be ...
> 
>         XmlSchemaUtils.setElementQName(el, wrapperName);
> 
> That in turn called XmlSchemaElement.setQName, which put whatever you
> asked into a QName in the element. And then serialization ignored it.
> So the old code was doing, in effect, exactly what the new code is
> doing.

I'm not claiming the old code was correct either.  :-)

I THINK this should get the concrete name of the part and if it's namespace 
qualified, check the namespace and grab the correct schema and such.  If in a 
different namespace, setup the ref.   Definitely a little more involved.

Dan


> 
> On Tue, Oct 12, 2010 at 10:23 PM, Daniel Kulp <dk...@apache.org> wrote:
> > On Tuesday 12 October 2010 7:26:49 pm Benson Margulies wrote:
> >> Line 1250 of RFSB sets an element's qname to a message part qname.
> > 
> > I think your RFSB has mods.  Line 1250 doesn't line up with anything
> > useful.
> > 
> >> The thing is, in the situation at hand, that message part lives in a
> >> different namespace than the schema of the element. And, so far as
> >> I've understood it, all the elements of schema 'x' have to live in the
> >> namespace of schema 'x'. The name of an element is an NCName, not a
> >> qname. XmlSchema 2.0 still has an API to set a qname but checks the
> >> namespace for sensibility. I am inclined to eliminate this, and make
> >> it so that the only setter for names of these things takes strings.
> > 
> > If it's a top level element, then yes, it must match the namespace.
> >  However, I think you are in the method that creates the wrapper types,
> > right?  In that case, it's a child element of a sequence.  In THAT case,
> > it can be a different namespace, sort of.  It would be a ref to an
> > element off in that namespace.
> > 
> > Does that help explain it?
> > 
> > Dan
> > 
> >> When I do that, what do I do with RFSB? Just pull out the local part
> >> of the mpi name and hope for a lack of collisions?
> > 
> > --
> > Daniel Kulp
> > dkulp@apache.org
> > http://dankulp.com/blog

-- 
Daniel Kulp
dkulp@apache.org
http://dankulp.com/blog

Re: XmlSchema, error checking, RFSB, hmm?

Posted by Benson Margulies <bi...@gmail.com>.
We're in createWrappedMessageSchema. here's what I have today ...

 for (MessagePartInfo mpi : unwrappedMessage.getMessageParts()) {
            el = new XmlSchemaElement(schema, false);
            // We hope that we can't have parts that differe only in namespace.
            el.setName(mpi.getName().getLocalPart());


The last line used to be ...

        XmlSchemaUtils.setElementQName(el, wrapperName);

That in turn called XmlSchemaElement.setQName, which put whatever you
asked into a QName in the element. And then serialization ignored it.
So the old code was doing, in effect, exactly what the new code is
doing.


On Tue, Oct 12, 2010 at 10:23 PM, Daniel Kulp <dk...@apache.org> wrote:
> On Tuesday 12 October 2010 7:26:49 pm Benson Margulies wrote:
>> Line 1250 of RFSB sets an element's qname to a message part qname.
>
> I think your RFSB has mods.  Line 1250 doesn't line up with anything useful.
>
>>
>> The thing is, in the situation at hand, that message part lives in a
>> different namespace than the schema of the element. And, so far as
>> I've understood it, all the elements of schema 'x' have to live in the
>> namespace of schema 'x'. The name of an element is an NCName, not a
>> qname. XmlSchema 2.0 still has an API to set a qname but checks the
>> namespace for sensibility. I am inclined to eliminate this, and make
>> it so that the only setter for names of these things takes strings.
>
> If it's a top level element, then yes, it must match the namespace.  However,
> I think you are in the method that creates the wrapper types, right?  In that
> case, it's a child element of a sequence.  In THAT case, it can be a different
> namespace, sort of.  It would be a ref to an element off in that namespace.
>
> Does that help explain it?
>
> Dan
>
>
>>
>> When I do that, what do I do with RFSB? Just pull out the local part
>> of the mpi name and hope for a lack of collisions?
>
> --
> Daniel Kulp
> dkulp@apache.org
> http://dankulp.com/blog
>

Re: XmlSchema, error checking, RFSB, hmm?

Posted by Daniel Kulp <dk...@apache.org>.
On Tuesday 12 October 2010 7:26:49 pm Benson Margulies wrote:
> Line 1250 of RFSB sets an element's qname to a message part qname.

I think your RFSB has mods.  Line 1250 doesn't line up with anything useful.

> 
> The thing is, in the situation at hand, that message part lives in a
> different namespace than the schema of the element. And, so far as
> I've understood it, all the elements of schema 'x' have to live in the
> namespace of schema 'x'. The name of an element is an NCName, not a
> qname. XmlSchema 2.0 still has an API to set a qname but checks the
> namespace for sensibility. I am inclined to eliminate this, and make
> it so that the only setter for names of these things takes strings.

If it's a top level element, then yes, it must match the namespace.  However, 
I think you are in the method that creates the wrapper types, right?  In that 
case, it's a child element of a sequence.  In THAT case, it can be a different 
namespace, sort of.  It would be a ref to an element off in that namespace.  

Does that help explain it?

Dan


> 
> When I do that, what do I do with RFSB? Just pull out the local part
> of the mpi name and hope for a lack of collisions?

-- 
Daniel Kulp
dkulp@apache.org
http://dankulp.com/blog