On 3/30/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > > > On 29 Mar, 19:27, "Charlie Moad" <[EMAIL PROTECTED]> wrote: > > On 3/29/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > > > > > > > > > > > > On 29 Mar, 17:30, "Charlie Moad" <[EMAIL PROTECTED]> wrote: > > > > On 3/29/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > > > > > > On 28 Mar, 20:59, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > > > > > > Hi all, > > > > > > I just started using SDO_XML and it is proving extremely > > > > > > useful. > > > > > > I just wanted to ask a quick question that someone might know. I > > > > > > have > > > > > > several schemas that use qualified elements, so I have to put a > > > > > > prefix > > > > > > on the element names. Is there anyway I can force the saved xml to > > > > > > have a prefix on the default namespace? > > > > > > > > Thanks, > > > > > > Charlie > > > > > > > Hi Charlie, I don't have a difinitive answer for you but looking at > > > > > the code it looks like this is the way that libxml2 does things so you > > > > > may be stuck with it for the time being. This is the line from > > > > > SDOXMLWriter.cpp that writes out the root element: > > > > > > > rc = xmlTextWriterStartElementNS(writer, NULL, elementName, > > > > > elementURI); > > > > > > > So it looks like its down to how libxml2 handles the elementName and > > > > > namespace URI. There may be a way of changing this so I'm hoping one > > > > > of the SDO experts will jump in if that is the case. > > > > > > > I have found the qualification (or not) of elements to be a bit of a > > > > > minefield. Can I just check that when you say "force the saved xml to > > > > > have a prefix on the default namespace?" I assume you are talking > > > > > about having: > > > > > > > <tns:SomeElement xmlns:tn="my namespace"/> > > > > > > > as opposed to > > > > > > > <SomeElement xmlns="mynamesapce"/> > > > > > > > At the root element level. Is that right? > > > > > > That's the gist of it. I should clarify that the validation problems > > > > really only pop up when I am required to use qualified attributes. I > > > > think a way to address this would be to have a function to bridge to > > > > DOM. DOM allows you to control prefixes. How hard would it be to add > > > > a new function: > > > > > > DOMDocument SDO_DAS_XML::saveDOM(SDO_XMLDocument $xdoc) > > > > > > Just writing to a string and file can be somewhat limiting. > > > > > > Thanks, > > > > Charlie > > > > > That's an interesting idea. Would we need to go the other way as well? > > > Do you know much about the PHP DOM implementation? > > > > I started suggesting the two-way bridge, but I think it would require > > a lot more work to make a DOM-to-SDOXML function. It would have to > > make sure the document is a valid schema or schema instance. > > > > I only know the DOM api is a cover of libxml. I have not looked at the > > c-api. > Ok, off the top my head, we could look at doing a simple PHP user > space conversion from SDO to DOM, I.e. we could do the write side of a > DOM DAS (Data Access Service). I made a simple JSON DAS a little > while back and that wasn't too hard. > > It would be more efficient to do it in the C extension but harder to > code I guess. If in the future someone wanted to convert it to work at > the libxml level I'm sure it could be done. What do you think? If you > feel like having a go at it let me know.
I can always do the following: DOMDocument::loadXML($xmldas->saveString($doc)); I was just hoping the underlying implementation was using libxml, and it would be trivial to return a DOMDocument instance. I just won't have time in the near future to look at this since it will require me to understand a lot of php/c-api stuff I have never worked with. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "phpsoa" group. To post to this group, send email to [email protected] 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 -~----------~----~----~----~------~----~------~--~---
