Re: modify() Top-level attribute nodes are not supported Error
- From: "BradR" <bdrhoa@xxxxxxxxx>
- Date: 5 Apr 2007 14:12:47 -0700
On Apr 5, 2:44 pm, "BradR" <bdr...@xxxxxxxxx> wrote:
On Apr 5, 11:21 am, "BradR" <bdr...@xxxxxxxxx> wrote:
I'm trying to return the following:
<person>
<personal_info>
...
</personal_info>
<prof_quals>
...
</prof_quals>
</person>
I thought I'd simplify this down to just the XML:
DECLARE @xPerson XML, @xUpdate XML
SET @xPerson = ('
<person>
<personal_info>
<first_name>Some</first_name>
<last_name>Guy</last_name>
</personal_info>
</person>'
)
SET @xUpdate = ('
<prof_quals>
<license_number>ADM</license_number>
<licensing_agency>Unknown</licensing_agency>
<state_issued>XX</state_issued>
<start_date>1983</start_date>
</prof_quals>'
)
--XQuery [#xPerson.xPerson.modify()]: Top-level attribute nodes are
not supported
SET @xPerson.modify('
insert @xUpdate
after (/person/personal_info[1])')
-- XQuery [#xPerson.xPerson.modify()]: The target of 'insert' must be
a single node, found 'element(personal_info,xdt:untyped) *'
SET @xPerson.modify('
insert
<prof_quals>
<license_number>ADM</license_number>
<licensing_agency>Unknown</licensing_agency>
<state_issued>XX</state_issued>
<start_date>1983</start_date>
</prof_quals>
after (/person/personal_info[1])')
Here's where I'm I'm at:
This works (moved the [1]):
SET @xPerson.modify('
insert
<prof_quals>
<license_number>ADM</license_number>
<licensing_agency>Unknown</licensing_agency>
<state_issued>XX</state_issued>
<start_date>1983</start_date>
</prof_quals>
after (/person/personal_info)[1]')
but even if I use the same xpath, doing:
SET @xPerson.modify('
insert @xUpdate
after (/person/personal_info)[1]')
still fails.
Plus even with the example that works, I can't add more than one
<prof_qual></prof_qual> in the insert - every new node needs a
separate insert statement.
Ultimately, what I want to do is build very complex xml structures in
clean way, e.g. get all the occurances of <prof_qual> into the
variable and then just insert the variable.
.
- Follow-Ups:
- Re: modify() Top-level attribute nodes are not supported Error
- From: Kent Tegels
- Re: modify() Top-level attribute nodes are not supported Error
- References:
- Prev by Date: Re: modify() Top-level attribute nodes are not supported Error
- Next by Date: How to define the XML schema for a SQLXMLBulkLoad
- Previous by thread: Re: modify() Top-level attribute nodes are not supported Error
- Next by thread: Re: modify() Top-level attribute nodes are not supported Error
- Index(es):
Relevant Pages
|
Loading