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 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
            xmlns:tns="http://www.w3.org/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://www.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 phpsoa@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.co.uk/group/phpsoa?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to