List Info

Thread: ATOMPUB binding




Re: Experiences with the ATOMPUB binding #2
user name
2007-08-17 12:29:34
Caroline,
I've been looking at problem 5 in your list here - the
server
rejecting the generated XML. I think our Atom1.0.xsd is
wrong.

Our xsd has no elementFormDefault attribute on the schema
definition.
This means that we get the default behaviour, which is that
only top
level elements defined in the schema are in the target
namespace, and
elements that are not defined at the top level e.g.
<author> and
<name> and so on are in the no-namespace namespace.

Consequently the XML we generate has lower level elements
like author
and name not in any namespace, which is correct according to
the
schema that we have.

I am tempted to add elementFormDefault="qualified"
as an attribute to
the schema element, putting all the lower level elements
into the atom
namespace. I have checked this out with XERCES, which I take
to be the
authority in this matter - with the xsd as we have it the
hand-cranked
xml fails to validate but add the elementFormDefault
attribute to the
schema and it passes.

This did all change around the time of jira 1112 - the xml
we were
generating was all wrong before and the elementFormDefault
attribute
was being ignored but it should be behaving according to
spec now.

Incidentally, could you paste in a little of the code that
used to add
the fields to the entry? I am finding it very hard to write
the code
that creates an entry - something to do with the weird
many-valued
nature of entry and author....

Matthew


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "phpsoa" group.
To post to this group, send email to phpsoagooglegroups.com
To unsubscribe from this group, send email to
phpsoa-unsubscribegooglegroups.com
For more options, visit this group at http://
groups.google.co.uk/group/phpsoa?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: Experiences with the ATOMPUB binding #5
user name
2007-08-20 06:10:35
Matthew Peters wrote:

> I've been looking at problem 5 in your list here - the
server
> rejecting the generated XML. I think our Atom1.0.xsd is
wrong.
> 
> Our xsd has no elementFormDefault attribute on the
schema definition.
> This means that we get the default behaviour, which is
that only top
> level elements defined in the schema are in the target
namespace, and
> elements that are not defined at the top level e.g.
<author> and
> <name> and so on are in the no-namespace
namespace.
> 
> Consequently the XML we generate has lower level
elements like author
> and name not in any namespace, which is correct
according to the
> schema that we have.
> 
> I am tempted to add
elementFormDefault="qualified" as an attribute to
> the schema element, putting all the lower level
elements into the atom
> namespace. I have checked this out with XERCES, which I
take to be the
> authority in this matter - with the xsd as we have it
the hand-cranked
> xml fails to validate but add the elementFormDefault
attribute to the
> schema and it passes.
> 
> This did all change around the time of jira 1112 - the
xml we were
> generating was all wrong before and the
elementFormDefault attribute
> was being ignored but it should be behaving according
to spec now.

Your analysis makes sense - I experimented with changing the
schema as 
you suggest, and the following popped out:

<?xml version="1.0"
encoding="UTF-8"?>
<tns:entry xmlnssi=&q
uot;http:
//www.w3.org/2001/XMLSchema-instance"
            xmlns:tns="http://www.w3.o
rg/2005/Atom">
<tns:author>
<name>Caroline Maynard</name>
</tns:author>
<tns:title>
     ...
</tns:title>
<more stuff here/>
</tns:entry>

which probably is technically correct, as it now has the
author in the 
atom namespace. However the problem for me is that this
particular 
server still doesn't like it - it gives me a response code
400, but 
instead of the "Could not parse" message I got
previously, there's now 
no accompanying message.

> Incidentally, could you paste in a little of the code
that used to add
> the fields to the entry? I am finding it very hard to
write the code
> that creates an entry - something to do with the weird
many-valued
> nature of entry and author....

OK, here are the gory details. These are mostly open
(therefore 
typically multi-valued) sequenced types, which is why the
code is rather 
cumbersome:

         $entry = $document->getRootDataObject();

	$entry_author = $entry->createDataObject('author');
	$entry_author->name[] = $author;

	$entry_title = $entry->createDataObject('title');
	$entry_title->getSequence()->insert($title);

	$entry_content = $entry->createDataObject('content');
	$entry_content->type = 'html';
	$entry_content->getSequence()->insert(
              "I posted this from PHP using
SDO");

	$category_content =
$entry->createDataObject('category');
	$category_content->term = "bookmark";
	$category_content->scheme =
              "http://w
ww.ibm.com/xmlns/prod/sn/type";

	if ($categories) {
	  $categories = (array)$categories;
	  foreach ($categories as $category) {
	    $category_content =
$entry->createDataObject('category');
	    $category_content->term= $category;
	  }
	}

	$link_content = $entry->createDataObject('link');
	$link_content->href = $link;


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "phpsoa" group.
To post to this group, send email to phpsoagooglegroups.com
To unsubscribe from this group, send email to
phpsoa-unsubscribegooglegroups.com
For more options, visit this group at http://
groups.google.co.uk/group/phpsoa?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: Experiences with the ATOMPUB binding #5
user name
2007-08-21 07:39:25
Oh dear.

> <tns:author>
> <name>Caroline Maynard</name>
> </tns:author>
.../...
> atom namespace. However the problem for me is that this
particular
> server still doesn't like it - it gives me a response
code 400, but

I hoped we had seen the back of namespace problems but this
looks like
Tuscany is still generating the wrong XML. <name>
should also be
coming out in the target namespace. Once again the generated
XML will
not validate with XERCES, whereas if I make <name>
into <tns:name> it
will (this is with the extra change to add
elementFormDefault="qualified")

The output shoud be
<tns:author>
<tns:name>Caroline Maynard</tns:name>
</tns:author>

I will open a JIRA.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "phpsoa" group.
To post to this group, send email to phpsoagooglegroups.com
To unsubscribe from this group, send email to
phpsoa-unsubscribegooglegroups.com
For more options, visit this group at http://
groups.google.co.uk/group/phpsoa?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: Experiences with the ATOMPUB binding #5
user name
2007-08-21 07:45:39


On Aug 20, 12:10 pm, Caroline Maynard <c...php.net> wrote:
> Matthew Peters wrote:
> > Incidentally, could you paste in a little of the
code that used to add
> > the fields to the entry? I am finding it very hard
to write the code
> > that creates an entry - something to do with the
weird many-valued
> > nature of entry and author....
>
> OK, here are the gory details. These are mostly open
(therefore
> typically multi-valued) sequenced types, which is why
the code is rather
> cumbersome:

Thank you. The mistake I was making was putting
   $entry_author->name = $author;
when I should have had
   $entry_author->name[] = $author;

Isn't it all horrid. When you try to write it from scratch,
and if you
do not know what you are doing (that was me) it's baffling.
The code I
had (i.e. without the []) executes, but nothing comes out in
the
generated xml, or var_dump, so where the author value goes
in that
case I don't know.

And as far as I know there is not an example of it in the
examples.
The only places I could see where content was being built
up, the code
was using heredocs instead. It looks like our examples need
a
considerable overhaul (I am remembering your point 1. above
also.)


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "phpsoa" group.
To post to this group, send email to phpsoagooglegroups.com
To unsubscribe from this group, send email to
phpsoa-unsubscribegooglegroups.com
For more options, visit this group at http://
groups.google.co.uk/group/phpsoa?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: Experiences with the ATOMPUB binding #5
user name
2007-08-22 05:33:22
Matthew Peters wrote:

> 
> I hoped we had seen the back of namespace problems 

Told you so: http://groups.google.com/group/phpsoa/msg/11a5c7ea4f6d
d260 

> I will open a JIRA.

You'll have noticed that Pete has provided fixes for 
htt
p://issues.apache.org/jira/browse/TUSCANY-1564 and 
ht
tp://issues.apache.org/jira/browse/TUSCANY-1566. These
do fix up the 
generated xml in the way you describe, and it is probably
now valid.

However I am still getting the 400 status code (with no
error message) 
from the atompub server. I think the code in question just
can't cope 
with not having a default namespace - it likes:

<?xml version="1.0"
encoding="UTF-8"?>
<entry xmlnssi=&q
uot;http:
//www.w3.org/2001/XMLSchema-instance"
        xmlns="http://www.w3.o
rg/2005/Atom">
<author>
   <name>Caroline Maynard</name>
</author>
...
</entry>

but dislikes:

<?xml version="1.0"
encoding="UTF-8"?>
<tns:entry xmlnssi=&q
uot;http:
//www.w3.org/2001/XMLSchema-instance"
            xmlns:tns="http://www.w3.o
rg/2005/Atom">
<tns:author>
   <tns:name>Caroline Maynard</tns:name>
</tns:author>
...
</tns:entry>

It may non-compliant - and I can try raising this as a
problem - but it 
probably isn't the only server in the world to work like
this.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "phpsoa" group.
To post to this group, send email to phpsoagooglegroups.com
To unsubscribe from this group, send email to
phpsoa-unsubscribegooglegroups.com
For more options, visit this group at http://
groups.google.co.uk/group/phpsoa?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: Experiences with the ATOMPUB binding #5
user name
2007-08-22 05:33:22
Matthew Peters wrote:

> 
> I hoped we had seen the back of namespace problems 

Told you so: http://groups.google.com/group/phpsoa/msg/11a5c7ea4f6d
d260 

> I will open a JIRA.

You'll have noticed that Pete has provided fixes for 
htt
p://issues.apache.org/jira/browse/TUSCANY-1564 and 
ht
tp://issues.apache.org/jira/browse/TUSCANY-1566. These
do fix up the 
generated xml in the way you describe, and it is probably
now valid.

However I am still getting the 400 status code (with no
error message) 
from the atompub server. I think the code in question just
can't cope 
with not having a default namespace - it likes:

<?xml version="1.0"
encoding="UTF-8"?>
<entry xmlnssi=&q
uot;http:
//www.w3.org/2001/XMLSchema-instance"
        xmlns="http://www.w3.o
rg/2005/Atom">
<author>
   <name>Caroline Maynard</name>
</author>
...
</entry>

but dislikes:

<?xml version="1.0"
encoding="UTF-8"?>
<tns:entry xmlnssi=&q
uot;http:
//www.w3.org/2001/XMLSchema-instance"
            xmlns:tns="http://www.w3.o
rg/2005/Atom">
<tns:author>
   <tns:name>Caroline Maynard</tns:name>
</tns:author>
...
</tns:entry>

It may non-compliant - and I can try raising this as a
problem - but it 
probably isn't the only server in the world to work like
this.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "phpsoa" group.
To post to this group, send email to phpsoagooglegroups.com
To unsubscribe from this group, send email to
phpsoa-unsubscribegooglegroups.com
For more options, visit this group at http://
groups.google.co.uk/group/phpsoa?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: Experiences with the ATOMPUB binding #5
user name
2007-08-22 05:33:22
Matthew Peters wrote:

> 
> I hoped we had seen the back of namespace problems 

Told you so: http://groups.google.com/group/phpsoa/msg/11a5c7ea4f6d
d260 

> I will open a JIRA.

You'll have noticed that Pete has provided fixes for 
htt
p://issues.apache.org/jira/browse/TUSCANY-1564 and 
ht
tp://issues.apache.org/jira/browse/TUSCANY-1566. These
do fix up the 
generated xml in the way you describe, and it is probably
now valid.

However I am still getting the 400 status code (with no
error message) 
from the atompub server. I think the code in question just
can't cope 
with not having a default namespace - it likes:

<?xml version="1.0"
encoding="UTF-8"?>
<entry xmlnssi=&q
uot;http:
//www.w3.org/2001/XMLSchema-instance"
        xmlns="http://www.w3.o
rg/2005/Atom">
<author>
   <name>Caroline Maynard</name>
</author>
...
</entry>

but dislikes:

<?xml version="1.0"
encoding="UTF-8"?>
<tns:entry xmlnssi=&q
uot;http:
//www.w3.org/2001/XMLSchema-instance"
            xmlns:tns="http://www.w3.o
rg/2005/Atom">
<tns:author>
   <tns:name>Caroline Maynard</tns:name>
</tns:author>
...
</tns:entry>

It may non-compliant - and I can try raising this as a
problem - but it 
probably isn't the only server in the world to work like
this.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "phpsoa" group.
To post to this group, send email to phpsoagooglegroups.com
To unsubscribe from this group, send email to
phpsoa-unsubscribegooglegroups.com
For more options, visit this group at http://
groups.google.co.uk/group/phpsoa?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: Experiences with the ATOMPUB binding #5
user name
2007-08-22 08:23:27
How beastly of it. Now, who wants to be the one to tell
Pete...

On Aug 22, 11:33 am, Caroline Maynard <c...php.net> wrote:

> However I am still getting the 400 status code (with no
error message)
> from the atompub server. I think the code in question
just can't cope
> with not having a default namespace - it likes:
>
> <?xml version="1.0"
encoding="UTF-8"?>
> <entry xmlnssi=&q
uot;http:
//www.w3.org/2001/XMLSchema-instance"
>         xmlns="http://www.w3.o
rg/2005/Atom">
> <author>
>    <name>Caroline Maynard</name>
> </author>
> ...
> </entry>
>
> but dislikes:
>
> <?xml version="1.0"
encoding="UTF-8"?>
> <tns:entry xmlnssi=&q
uot;http:
//www.w3.org/2001/XMLSchema-instance"
>             xmlns:tns="http://www.w3.o
rg/2005/Atom">
> <tns:author>
>    <tns:name>Caroline Maynard</tns:name>
> </tns:author>
> ...
> </tns:entry>
>
> It may non-compliant - and I can try raising this as a
problem - but it
> probably isn't the only server in the world to work
like this.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "phpsoa" group.
To post to this group, send email to phpsoagooglegroups.com
To unsubscribe from this group, send email to
phpsoa-unsubscribegooglegroups.com
For more options, visit this group at http://
groups.google.co.uk/group/phpsoa?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: Experiences with the ATOMPUB binding #5
user name
2007-08-23 14:45:09
Matthew Peters wrote:

> Thank you. The mistake I was making was putting
>    $entry_author->name = $author;
> when I should have had
>    $entry_author->name[] = $author;
> 
> Isn't it all horrid. When you try to write it from
scratch, and if you
> do not know what you are doing (that was me) it's
baffling. 

It is quite horrid, but there is a way you can examine the
structures - 
if you create an SDO_Model_ReflectionDataObject from the sdo

representing the atom entry, it will show you the details.
For example, 
the author property is described as:
         http://ww
w.w3.org/2005/Atom#personConstruct $author[] {
             commonj.sdo#String $name[];
             commonj.sdo#String $uri[];
             http://www.w3.o
rg/2005/Atom#emailType $email[];
             http://www.
w3.org/2005/Atom#extensionType $extension[] {
             }
         }
which was how I knew that $author->name must be
many-valued.

> The code I
> had (i.e. without the []) executes, but nothing comes
out in the
> generated xml, or var_dump, so where the author value
goes in that
> case I don't know.

Hmm, neither do I. Sounds like an sdo bug.

> And as far as I know there is not an example of it in
the examples.
> The only places I could see where content was being
built up, the code
> was using heredocs instead. It looks like our examples
need a
> considerable overhaul (I am remembering your point 1.
above also.)

Agreed, I only found examples that sent pre-canned xml from
heredocs, 
which seems to miss one of the benefits of using SCA.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "phpsoa" group.
To post to this group, send email to phpsoagooglegroups.com
To unsubscribe from this group, send email to
phpsoa-unsubscribegooglegroups.com
For more options, visit this group at http://
groups.google.co.uk/group/phpsoa?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: Experiences with the ATOMPUB binding #5
user name
2007-08-30 03:29:00
The many-valued nature of a lot of the properties is
unfortunately due
to the inability of XML schema to accurately describe the
Atom
Syndication Format.  It's a while since I wrote the schema,
but I seem
to recall it was to do with the use of <choice
maxOccurs="unbounded" /
>.  The Atom XML is defined in terms of Relax NG which
does a far
better job.  On the plus side, the SDO model could do quite
a good job
of representing Atom, so one thought I had was to
programmatically
build up an SDO Atom model in the binding.  Applications
could work
with this cleaner version and then in the binding we would
use the XML
schema-based version to handle the
serialization/deserialization.
Another thought was to define PHP classes to represent the
Atom format
and again use the XML schema-based SDO to do the
serialization/
deserialization.

I quite like the heredoc approach as an alternative, which
is why I
write the sample code to do that :-D

For the XML serialization using the default namespace, would
we want
this to be determined from the XML schema?  So for example,
our
Atom1.0.xsd has the default namespace being that of Atom, so
the
instance documents could do the same.

Graham.

On 23 Aug, 20:45, Caroline Maynard <c...php.net> wrote:
> Matthew Peters wrote:
> > Thank you. The mistake I was making was putting
> >    $entry_author->name = $author;
> > when I should have had
> >    $entry_author->name[] = $author;
>
> > Isn't it all horrid. When you try to write it from
scratch, and if you
> > do not know what you are doing (that was me) it's
baffling.
>
> It is quite horrid, but there is a way you can examine
the structures -
> if you create an SDO_Model_ReflectionDataObject from
the sdo
> representing the atom entry, it will show you the
details. For example,
> the author property is described as:
>          http://ww
w.w3.org/2005/Atom#personConstruct$author[] {
>              commonj.sdo#String $name[];
>              commonj.sdo#String $uri[];
>              http://www.w3.o
rg/2005/Atom#emailType$email[];
>              http://www.
w3.org/2005/Atom#extensionType$extension[] {
>              }
>          }
> which was how I knew that $author->name must be
many-valued.
>
> > The code I
> > had (i.e. without the []) executes, but nothing
comes out in the
> > generated xml, or var_dump, so where the author
value goes in that
> > case I don't know.
>
> Hmm, neither do I. Sounds like an sdo bug.
>
> > And as far as I know there is not an example of it
in the examples.
> > The only places I could see where content was
being built up, the code
> > was using heredocs instead. It looks like our
examples need a
> > considerable overhaul (I am remembering your point
1. above also.)
>
> Agreed, I only found examples that sent pre-canned xml
from heredocs,
> which seems to miss one of the benefits of using SCA.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "phpsoa" group.
To post to this group, send email to phpsoagooglegroups.com
To unsubscribe from this group, send email to
phpsoa-unsubscribegooglegroups.com
For more options, visit this group at http://
groups.google.co.uk/group/phpsoa?hl=en
-~----------~----~----~----~------~----~------~--~---


[1-10] [11-20] [21-23]

about | contact  Other archives ( Real Estate discussion Medical topics )