is there a function to update attributes?
Sunday, 9 May 2010 · 3 messages · last reply 10 May 2010
BS
Beatriz Sancho9 May 2010 17:28 #
Hello,
I'm trying to update or create some attributes in a node.
¿how can i do that with BaseX?
This is my DTD:
<!ELEMENT SITUATION ((ROLES)?,(USERS)?,(GROUPS)?,(OBJECTS)?)> <!ATTLIST SITUATION
id ID #REQUIRED
name CDATA #IMPLIED
desc CDATA #IMPLIED
start CDATA #IMPLIED
finish CDATA #IMPLIED>
category_scope (small | large | community | other) #IMPLIED size_scope CDATA #IMPLIED
environment ( synchronous | asynchronous | face-to-face | blended | others) #IMPLIED
educational_level CDATA #IMPLIED
experience_level (none|elementary|advanced|expert) #IMPLIED>
and i want to update or create attributes in the SITUATION node. I have seen a function called insertAttributes but i don't know how to use it with baseX, with the prefix basex: it doesn't works... i am a little lost. Could you help me, please?
AW
Andreas Weiler10 May 2010 08:02 #
Hello Beatriz,
you can insert attributes like in the following example:
xquery insert node attribute name{'value'} into /target
for updating attribute values use the following:
xquery replace value of node //target/@name with 'value'
for renaming an attribute:
xquery rename node //target/@name as 'value'
If you want to update more nodes in one query, you have to call like this: xquery for $node in //target return 'update function'
I hope this helps,
don't hesitate to ask for more.
Kind regards,
Andreas (BaseXTeam)
Quoted text · Beatriz Sancho · 31 lines
Beatriz Sancho schrieb: > Hello, > I'm trying to update or create some attributes in a node. > ¿how can i do that with BaseX? > This is my DTD: > <!ELEMENT SITUATION ((ROLES)?,(USERS)?,(GROUPS)?,(OBJECTS)?)> > <!ATTLIST SITUATION > id ID #REQUIRED > name CDATA #IMPLIED > desc CDATA #IMPLIED > start CDATA #IMPLIED > finish CDATA #IMPLIED> > category_scope (small | large | community | other) #IMPLIED > size_scope CDATA #IMPLIED > environment ( synchronous | asynchronous | face-to-face | > blended | others) #IMPLIED > educational_level CDATA #IMPLIED > experience_level (none|elementary|advanced|expert) #IMPLIED> > > and i want to update or create attributes in the SITUATION node. I > have seen a function called insertAttributes but i don't know how to > use it with baseX, with the prefix basex: it doesn't works... i am a > little lost. > Could you help me, please? > ------------------------------------------------------------------------ > > _______________________________________________ > BaseX-Talk mailing list > BaseX-Talk at mailman.uni-konstanz.de > https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk >
BS
Beatriz Sancho10 May 2010 09:45 #
That is exactly what i needed! Thank you very much Andreas :D
2010/5/10 Andreas Weiler <andreas.weiler at uni-konstanz.de>
Quoted text · Andreas Weiler · 54 lines
> Hello Beatriz, > > you can insert attributes like in the following example: > xquery insert node attribute name{'value'} into /target > > for updating attribute values use the following: > xquery replace value of node //target/@name with 'value' > > for renaming an attribute: > xquery rename node //target/@name as 'value' > > If you want to update more nodes in one query, you have to call like this: > xquery for $node in //target return 'update function' > > I hope this helps, > don't hesitate to ask for more. > > Kind regards, > Andreas (BaseXTeam) > > Beatriz Sancho schrieb: > >> Hello, >> I'm trying to update or create some attributes in a node. >> żhow can i do that with BaseX? >> This is my DTD: >> <!ELEMENT SITUATION ((ROLES)?,(USERS)?,(GROUPS)?,(OBJECTS)?)> >> <!ATTLIST SITUATION >> id ID #REQUIRED >> name CDATA #IMPLIED >> desc CDATA #IMPLIED >> start CDATA #IMPLIED >> finish CDATA #IMPLIED> >> category_scope (small | large | community | other) #IMPLIED >> size_scope CDATA #IMPLIED >> environment ( synchronous | asynchronous | face-to-face | >> blended | others) #IMPLIED >> educational_level CDATA #IMPLIED >> experience_level (none|elementary|advanced|expert) #IMPLIED> >> >> and i want to update or create attributes in the SITUATION node. I have >> seen a function called insertAttributes but i don't know how to use it with >> baseX, with the prefix basex: it doesn't works... i am a little lost. >> Could you help me, please? >> ------------------------------------------------------------------------ >> >> _______________________________________________ >> BaseX-Talk mailing list >> BaseX-Talk at mailman.uni-konstanz.de >> https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk >> >> > >
Written for BaseX 6. BaseX may have changed since: please check the current documentation.
⚡Generated with XQuery