> > From [EMAIL PROTECTED]  Mon Dec 10 21:26:06 2001
> > An XUpdate is defined in an XML document (while an XPath is a
string), 
> > so there should be no problem including the requisite
prefix/namespace 
> > bindings on an element in the XUpdate document itself.
> > 
> > If I am missing something could you provide an example of what needs

> > to be done?
> > 

No, you are not missing anything. I suspect that the approach you have
suggested could be made to work. I have verified that it does not
currently
work with dbXML, but perhaps it should work that way. However, it might
still
be nice to have an API mechanism to set namespace mappings.

Here is an example of what I've been trying to do. Consider the
following
XML document which is stored in my database:

  <?xml version="1.0" encoding="UTF-8"?>
  <RootElement xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
      xmlns="http://www.mydomain.com/MyDocument";
      xsi:schemaLocation="http://www.mydomain.com/MyDocument
Document.xsd">
      <Subelement id="sub1"/>
      <Subelement id="sub2"/>
      <Subelement id="sub3"/>
  </RootElement>

Now suppose I want to perform an Xupdate on the above document. For the
sake
of this example, I will attempt to append a new Subelement node. The
XUpdate
document I would use if there were no default would be as follows:

  <xupdate:append select="/RootElement">
      <xupdate:element name="Subelement">
          <xupdate:attribute name="id">sub4</xupdate:attribute>
      </xupdate:element>
  </xupdate:append> 

This Xupdate query, as expected, has no results because the select comes
back
with no nodes due to the fact that I have not qualified RootElement with
a
namespace. So, what I want to do is add a namespace to my select as
follows:

  <xupdate:append select="/doc:RootElement">
      ...
  </xupdate:append>

Now I need a way to specify the mapping from the "doc" namespace prefix
to an
appropriate URI. If I understand your suggestion correctly, you are
suggesting
that I should do something like:

  <xupdate:append xmlns:doc="http://www.mydomain.com/MyDocument";
      select="/doc:RootElement">
      ...
  </xupdate>

Is this what you are suggesting? I was curious if this was the way
selection was
supposed to work within XUPdate. If this is supposed to work, then I
will shift
my attention to understanding why it doesn't appear to be working for me
within
the dbXMLb4 implementation (or perhaps the problem is within the Lexus
code?).

I believe that my suggestion might still be a more convenient way of
mapping
namespaces from the API. Rather than having to add the namespace
mappings to
my XUpdate document, I would be able to set the namespace mappings
programatically - Much like I can with the XPathQueryService.

You do make a good point about the difference between XPath and XUpdate.
It seems
likely that namespace mapping methods were added to XPathQueryService
because
there was no way to do it conveniently within the query string. On the
other hand,
an XUpdate document at least has the option of putting namespace
mappings directly
in the document. Even so, I still think it would be a lot more
convenient if you
could define your mappings via the XUpdateQueryService API.

- Tim

----------------------------------------------------------------------
Post a message:         mailto:[EMAIL PROTECTED]
Unsubscribe:            mailto:[EMAIL PROTECTED]
Contact administrator:  mailto:[EMAIL PROTECTED]
Read archived messages: http://archive.xmldb.org/
----------------------------------------------------------------------

Reply via email to