POOR RECOVERY OF THE XML ATTRIBUTE VALUES
Hi allI searched this forum and the web a way to get the value of an xml attribute. The solutions I found always had a problem, the values returned when concatenated without any separators, so I can't know every value.
Here's how:
BEGIN
l_bfile: = BFILENAME ('CTEMP1', nome_fich);
DBMS_LOB. FileOpen (l_bfile);
DBMS_LOB. LoadFromFile (l_clob, l_bfile, DBMS_LOB.lobmaxsize);
DBMS_LOB. FileClose (l_bfile);
xmlx: = XMLTYPE (l_clob);
Str: = xmlx. Extract('rowset/Row/@id'). GETSTRINGVAL();
dbms_output.put_line (' :'|| id values) (STR);
END;
Returns the string str: 123456654321 for this example
<? XML version = "1.0" encoding = "UTF-8"? >
rowset <>
< row id = "123456" >
< name > Peter < / name >
< / row >
< row id '654321' = >
< name > Louis < / name >
< / row >
< / lines >
I want to get each id concatenated for example values (123456:654321) instead, I get the concatenated values (123456654321).
Does anyone know a work around for this problem?
Cordially Pedro.
11.2 you can use listagg()
SQL> with t as (select xmltype('
2
3 Peter
4
5
6 Louis
7
8 ') xcol from dual)
9 select listagg(v.val,':') within group (order by null) val
10 from t,xmltable('/rowset/row/@id'
11 passing t.xcol
12 columns val varchar2(1000) path '.') v;
VAL
------------------------------------------------------------------------------------------------------------------------
123456:654321
If not 11.2
SQL> with t as (select xmltype('
2
3 Peter
4
5
6 Louis
7
8 ') xcol from dual)
9 select xmlquery('fn:string-join(/rowset/row/@id,'':'')'
10 passing by value t.xcol returning content) val
11 from t;
VAL
------------------------------------------------------------------------------------------------------------------------
123456:654321
Tags: Database
Similar Questions
-
How to remove the value of the XML attribute in the Indesign file with javascript
Hi all
How to remove the value of the XML attribute in the Indesign file.
What error is this?
in any case try this as well (one another),
var myDoc = app.activeDocument; attrDelete(myDoc); function attrDelete(elm) { for (var i = 0; i < elm.xmlElements.length; i++) { try{ for(j=0; j
Vandy
-
Retrieves the value of the XML attribute for multiple element sequence
Guys,
I have already posted this in the forum XML DB, but some of you could help me.
I have searched for a solution for this and couldn't quite. I'm trying to get multiple entries in a node attribute values. It workes for a single node, but for many nodes, it fails. Could you please give me a solution?
When I execute the same for several nodes, it fails, please guide me. Please also let me know how to handle if I have an XML file that contains this data.SQL> select extractvalue(column_value, '/WORLD/COUNTRY/@NAME') COUNTRY_NAME 2 ,extractvalue(column_value, '/WORLD/COUNTRY/CITY/@NAME') CITY_NAME 3 ,extractvalue(column_value, '/WORLD/COUNTRY/CITY/@POPULATION') POPULATION 4 from xmltable('WORLD' passing xmltype(' 5 <WORLD> 6 <COUNTRY NAME="INDIA"> 7 <CITY NAME="MUMBAI" POPULATION="10000"></CITY> 8 </COUNTRY> 9 </WORLD>' 10 )); COUNTRY_NAME CITY_NAME POPULATION ---------------------- ------------------ ------------------- INDIA MUMBAI 10000
See you soonSQL> select extractvalue(column_value, '/WORLD/COUNTRY/@NAME') COUNTRY_NAME 2 ,extractvalue(column_value, '/WORLD/COUNTRY/CITY/@NAME') CITY_NAME 3 ,extractvalue(column_value, '/WORLD/COUNTRY/CITY/@POPULATION') POPULATION 4 from xmltable('WORLD' passing xmltype(' 5 <WORLD> 6 <COUNTRY NAME="INDIA"> 7 <CITY NAME="MUMBAI" POPULATION="10000"></CITY> 8 <CITY NAME="CHENNAI" POPULATION="2000"></CITY> 9 <CITY NAME="BANGALORE" POPULATION="13000"></CITY> 10 <CITY NAME="HYDERABAD" POPULATION="14000"></CITY> 11 </COUNTRY> 12 </WORLD>' 13 )); select extractvalue(column_value, '/WORLD/COUNTRY/@NAME') COUNTRY_NAME * ERROR at line 1: ORA-19025: EXTRACTVALUE returns value of only one node
Sarma.So, this is the first step:
SQL> with test as 2 (select xmltype('
3 ') resp from dual) 10 select country 11 , cities 12 from xmltable('WORLD/COUNTRY' passing (select resp from test) 13 columns country varchar2(50) path '/COUNTRY/@NAME' 14 , cities xmltype path '/COUNTRY/CITY') world 15 / COUNTRY CITIES --------------- -------------------------------------------------- INDIA4 95 6 7 8 two columns, a varchar2 and an xmltype.
Then do the same with the second column, pass the XML to the function XMLTABLE
SQL> with test as 2 (select xmltype('
3 ') resp from dual) 10 select country 11 , cit.name 12 , cit.population 13 from xmltable('WORLD/COUNTRY' passing (select resp from test) 14 columns country varchar2(50) path '/COUNTRY/@NAME' 15 , cities xmltype path '/COUNTRY/CITY') world 16 , xmltable ('CITY' passing cities 17 columns name varchar2(50) path '@NAME' 18 , population number path '@POPULATION' 19 ) cit 20 ; COUNTRY NAME POPULATION --------------- -------------------------------------------------- ---------- INDIA MUMBAI 10000 INDIA CHENNAI 2000 INDIA BANGALORE 13000 INDIA HYDERABAD 140004 95 6 7 8 -
Hide the XML attribute if no data value / doesn't exist
Hello
I have a xsd defined as the following structure:
--------------
< xsd: complexType name = "PersonImageType" >
< xsd: attribute name = "ID" type = "xsd: Integer" / >
< xsd: attribute name = "FileName" type = "xsd: String" / >
< xsd: attribute name = "ErrorMessage" type = "xsd: String" use = "optional" / >
< xsd: attribute name = "Fetched" type = "xsd: String" / >
< xsd: attribute name = "S1" type = "xsd: String" / >
< xsd: attribute name = "S2" type = "xsd: String" / >
< / xsd: complexType >
--------------
When I run my BPEL process, I get the reply/output as follows:
--------------
< PersonImage >
"" < PersonImage ID = "12410276" FileName = "12410276.jpg" ErrorMessage ="" recovered = "Y" S1 = S2 "Y" = "Y" / >
< / PersonImage >
--------------
When you look at the output, the xml 'ErrorMessage' attribute has no value in it.
I want to:
(a) hide this attribute - when there is no data and
(b) display this attribute - when it has all the data.
Very appreciated if someone help me solve this problem.
Thank you and best regards,
Rakeshwithout double quotes around the @ErrorMessage
see you soon
James -
Get separate paths and the depth attribute value using the XQuery function
Hi otn.
I want to write the function XQuery that accept the following input document nodes.
< counter Root = "8" >
< has counter = "3" >
< meter B '2' = >
< C meter = "1" >
< meter D = "1" / >
/ < C >
< /B >
< C meter = "2" >
< counter E = "1" / >
/ < C >
< /A >
< meter B = "4" >
< C meter = "3" / >
< /B >
< C meter = "6" >
< counter E = "3" / >
< counter D '2' = >
< counter E = "1" / >
/ < d: >
/ < C >
< meter D = "2" / >
< counter E = "4" >
< counter F = "1" / >
< /E >
< counter F = "1" / >
< / root >
Then returns many things at the same time as follows:
1 - list of all of the separate paths
2 - meter of the depth of each path element attribute value
3 - the value of the previous counter in 2, is divided by the value of the attribute root counter.
Thanks in advance :)))I'm sorry that not all xml input data correctly.
You must use the {code} tag to enclose the code snippets. Formatting will be preserved and content not interpreted by the forum software.
Here's an XQuery query that should work:
declare function local:list-paths($d as element()) as element()* { let $root := name($d) let $rootcnt := xs:integer($d/@counter) for $i in $d/descendant::* return element path { attribute value { substring-after( string-join( for $j in $i/ancestor-or-self::* return name($j) , "/" ) , $root ) } , attribute counter {$i/@counter} , attribute percentage {xs:integer($i/@counter) div $rootcnt} } };
-
How to add the XML attribute to an element using BPEL assign
I have a xml request to a bpel process that contains no attribute.
After some process, I need to create this missing attribute and specify a value.
I tried to use the XML fragment in the business to be divested. But how do I create an attribute?
This XML node which I am trying to create an attribute is a very large knot with many dynamic typing(xsi:type). I can just re - create the complete xml code with the required nodes.
Anyone know how I can create an attribute xml using the BPEL entitlement? I don't want to use the Java code in my process.
Thank you.You can use the attribute bpelx:insertMissingToData on the item to copy, for example:
Query="/client:process/@time"/ >
If not there is time of the attribute in the process element, it will be added.
-
How to display the different attribute value in the ToolTip of selectonechoice
In the selectonechoice when hovering over the values in the drop-down list, it displays the same value in the ToolTip too. I want to see the value of another attribute in the ToolTip.
For example if the list displays the name of the lov, ToolTip should show its description attribute value. I tried assigning a different value to shorDesc, but have no effect on the values of the ToolTip.
< af:selectOneChoice value = "#{row.bindings.TfesNdx.inputValue} '"
label = "#{row." Bindings.TfesNdx.label}.
required = "#{bindings." ATfes.hints.TfesNdx.mandatory}.
shortDesc = "#{bindings." ATfes.hints.TfesNdx.tooltip}"/ / changed it to shortDesc =" #{row.bindings.Notes.inputValue} "does not yet "
ID = "soc17" autoSubmit = "true" >
< f: selectItems value = "#{row.bindings.TfesNdx.items} '"
ID = "si17" / >
< / af:selectOneChoice >
PS: Using 11.1.1.7.0 version adf
You probably need property shortDesc on af:selectItem http://jdevadf.oracle.com/adf-richclient-demo/docs/tagdoc/af_selectItem.html
For example, you can use af:forEach to make your items to select like in this blog post: http://learnfrommike.blogspot.com/2013/11/adf-using-selectonechoice-in-afiterator.html
Dario
-
Dear java expert,
I was trying to export script attribute value to the .txt format. I have attached the screenshot for your reference. Please me friends suggestion.
I use the system: Mac, indesign Cs6.
Thanks in advance to all
Dear friends,
I share my java coding below, based on this question.
myDocument var = app.activeDocument;
Var log = new File(app.activeDocument.filePath+"/log.html");
log. Encoding = "UTF-8";
log. Open ("w");
log.writeln(")
");
");log.writeln(")
");Text (in the template) Found (Href tag) FindEmail (myDocument);
log.writeln(")
log. Close();
Alert ("completed");
function FindEmail (elm)
{
for (var i = 0; i)< elm.xmlelements.length;="">
{
XMLelementName = elm.xmlElements [i].markupTag.name.toString ();
if(XMLelementName=="img")
{
for (j = 0; j
{
var cc = elm.xmlElements [i] .silence
Alert (CC);
var aa = elm.xmlElements [i] .xmlAttributes [j] .name
if(AA=="src")
{
alert (aa);
var BB = elm.xmlElements [i] .xmlAttributes [j] .value;
log.writeln(")
");« + cc + » ' + elm.xmlElements [i] .xmlAttributes [j] .value + ". alert (cc + ' ~ ~ ' + aa + "~ ~" + bb);
}
}
}
FindEmail (elm.xmlElements [i]);
}
}
Thank you
-
Hi all
I want to rename the attribute in the indesign document. I found no reference in this forum.
Here are the attribute appear in the palette of structure in the Indesign Document:
News[@North=N01]
And want to change the line above to:
News[@South=N01]
I only want to change of name not the attribute value.
Need help.
Thank you
LUN
Post edited by: designmon79
var doc = app.activeDocument, elements = doc.xmlElements[0].evaluateXPathExpression("//news[@north='n01']"), i, l; for (i = 0, l = elements.length; i < l; i++) { elements[i].xmlAttributes.item("north").name = "south"; }
Jeff
-
[CS5 - JS] Definition of the XML attributes from variables...
Hello
I'm building a XML variable to store the information needed to run my script.
The XML structure is quite simple:
var = new XML document ("< document > < pages > < page / > < / pages > < / document >");
Every 'page' nodes are added using a simple statement.
If I need to add an attribute to a node of 'page' I usually use this method:
document.pages.page.@height= 210;
What happens if I need to add an attribute without knowing its name (because it is stored in a variable)?
Y at - it something like that? :
document.pages.page.setAttribute (Name, 210);
Have no idea how to handle this...
Try this:
document.pages.page['@'+var_name] = 210;
@+
Marc
-
With the help of the XML attributes in itemRenderer and labelFunction
Hello!
I searched for hours and read the Devguide but always impossible to find the solution to my problem.
I have a xml returned from php like this:
< files >
< record id = "1" name = "name_1" type = "0" / >
< record id = "2" name = "name_2" type = "0" / >
< record id = "3" name = "name_3" type = "1 / >"
< / documents >
I can bind the result returned from the HTTPService to a data grid:
< mx:DataGrid dataProvider = "{ret_XML.record}" width = "500" number of rows = "20" editable = "false" id = "dg" > "
< mx:columns >
<!-NEXT WORK! ->
"< mx:DataGridColumn headerText ="Name" dataField="@name " width ="300"/ >
<!- LABELFUNC don't DO NOT WORK IN LINE NEXT->
"< headerText ="Type"dataField="@type mx:DataGridColumn " labelFunction ="labelFunc">
< / mx:DataGridColumn >
"< headerText ="Id"mx:DataGridColumn dataField="@id " editable ="false">
< mx:itemRenderer >
< mx:Component >
<!-LINE FOLLOWING IS don't DO NOT WORK! ->
"{< mx:Button label="{data.@id} '/ >
< / mx:Component >
< / mx:itemRenderer >
< / mx:DataGridColumn >
< / mx:columns >
< / mx:DataGrid >
and I have a labelFunction like this:
private void labelFunc(item:Object,_column:DataGridColumn):String {}
return "Type:"+ item.@type; "
}
So, my problem is that when I bind the column to an XML attribute, it works fine but when I try to link it to an itemRenderer or use it in a function, it does not work. I'm trying for hours now, but just can't make it work.
I tried:
"{< mx:Button label="{data.@id} '/ >
< mx:Button label = "{data. () @id)} »/ >
"{< mx:Button label="{@data.id} '/ >
and perhaps others but no luck...
Please someone help me with this one!
Ty:
[Pig]Problem solved!
Well, post it on the forum after I solved my problem as follows:
So in itemRenderer just use data.attribute () with the desired XML attribute name
And in the labelFunction:
private void labelFunc(item:Object,_column:DataGridColumn):String {}
return "Type:"+ item.attribute ('type'); '.
}
Even with itemRenderer but rather data use () item.attributeI hope that this is the 'official' solution too...
[Pig]
-
Hello
I export xml data into our database files. Since the xsd has changed it can be exported directly to another db to a third-party tool and I (among others) remove an attribute of an element
< TransferHeader xsi: Nil = 'true' / > should become < TransferHeader / >.CREATE TABLE xml_test( message XMLTYPE ) / INSERT INTO xml_test VALUES (q'[<?xml version="1.0" encoding="ISO-8859-1"?> <ZusyMeldung xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.zusy.de/2002/XMLSchema" xsi:schemaLocation="http://www.zusy.de/2002/XMLSchema ZusyAZ01.xsd"> <TransferHeader xsi:nil="true"/> <Daten> A lot more elements </Daten> </ZusyMeldung>]') / COMMIT;
I want to write files directly with the script next and tried to use updateXML in my SELECTION, but somehow I don't understand well.
ConcerningDECLARE CURSOR cur_out IS SELECT message FROM xml_test; BEGIN FOR r_out IN cur_out LOOP dbms_xslprocessor.clob2file ( r_out.message ,'DIR_XMLOUT' ,'out_name.xml' ,0 ); END LOOP; END; /
MarcusHi Marcus,
Given that you want to remove, try deleteXML :
select xmlserialize(document deletexml( message , '/ZusyMeldung/TransferHeader/@xsi:nil' , 'xmlns="http://www.zusy.de/2002/XMLSchema", xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"' ) ) from xml_test ;
Note that the functions of XML DML Oracle (updateXML, deleteXML etc.) are not recommended in 11.2.0.3 for the update of XQuery:
select xmlquery( 'declare default element namespace "http://www.zusy.de/2002/XMLSchema"; (: :) copy $d := . modify ( delete node $d/ZusyMeldung/TransferHeader/@xsi:nil ) return $d' passing message returning content ) from xml_test ;
-
Update the xml string values.
Hello
I'm on 11.2.0.2 and got table with column nclob that stores the long xml string.
{code}
"<? XML version = "1.0" encoding = "UTF - 8"? >
<? Fuego version = "6.5.2" build "101272 =? >
< Game >
< configuration name = "TEST database" type = subtype "SQL" = "DDORACLE" >
< name = "jdbc.pool.idle_timeout property" value = "5" / > "
< name = "jdbc.pool.entry.max property" value = "10" / > "
< name = "oracle.dateEqualsTimestamp property" value = "false" / > "
< name = "jdbc.schema property" value = "user1" / > "
< name = "jdbc.host property" value = "hostname" / > "
< property name = "user" value = "user1" / >
< name = "jdbc.port property" value = "1521" / > "
< name = "jdbc.pool.min property" value = "0" / > "
< name = "jdbc.pool.maxopencursors property" value = "50" / > "
< name = "oracle.sid property" value = "dbsid" / > "
< property name = "password" value = "user101" / >
< name = "jdbc.xa property" value = "false" / > "
< name = "jdbc.pool.max property" value = "10" / > "
< / configuration >
< configuration name = 'TEST base2' type = subtype "SQL" = "DDORACLE" >
< name = "jdbc.pool.idle_timeout property" value = "5" / > "
< name = "jdbc.pool.entry.max property" value = "10" / > "
< name = "oracle.dateEqualsTimestamp property" value = "false" / > "
< name = "jdbc.schema property" value = "user2" / > "
< name = "jdbc.host property" value = "hostname" / > "
< property name = "user" value = "user2" / >
< name = "jdbc.port property" value = "1521" / > "
< name = "jdbc.pool.min property" value = "0" / > "
< name = "jdbc.pool.maxopencursors property" value = "50" / > "
< name = "oracle.sid property" value = "dbsid2" / > "
< property name = "password" value = "user201" / >
< name = "jdbc.xa property" value = "false" / > "
< name = "jdbc.pool.max property" value = "10" / > "
< / configuration >
< / set >
"
{code}
My goal is to update the value of the password so that it is equal to the value of jdbc.schema value < property name = "jdbc.schema" value = "user2" / > in this case user2 | " '01'
< property name = "password" value = "user201" / > <-that's my goal.
Concerning
Greg
Hello
You can find a few methods here: How To: nodes of XML update with values from the same document. Oracle of Odie's blog
They are not applicable to your options and version though.
This is the first applied to your case:
declare
v_xmldoc xmltype.
Start
Select xmlparse (document to_clob (t.xmldoc))
in v_xmldoc
of my_nclob_table t
where t.id = 1;
for r in)
Select idx, schema_name
of my_nclob_table t
xmltable)
"/ game/configuration.
passage v_xmldoc
columns idx for ordinalite
, schema_name varchar2 (30) path 'property[@name="jdbc.schema"]/@value '.
)
)
loop
Select updatexml)
v_xmldoc
, "configuration/game / ['|]» [to_char (r.idx) |'] Property[@name="password"]/@value'
r.schema_name | '01'
)
in v_xmldoc
Double;
end loop;
Update my_nclob_table t
Set t.xmldoc = to_nclob (xmlserialize (dash, document v_xmldoc))
where t.id = 1;
end;
/
Here's another, using DOM:
declare
CLOB doc;
p dbms_xmlparser. Analyzer;
domdoc dbms_xmldom. DOMDocument;
docnode dbms_xmldom. DOMNode;
conf_list dbms_xmldom. DOMNodeList;
conf_node dbms_xmldom. DOMNode;
password_node dbms_xmldom. DOMNode;
schema_name varchar2 (30);
password_value varchar2 (256);
Start
Select to_clob (xmldoc)
in the doc
of my_nclob_table
where id = 1;
p: = dbms_xmlparser.newParser;
dbms_xmlparser.parseClob (p, doc);
domdoc: = dbms_xmlparser.getDocument (p);
dbms_xmlparser.freeParser (p);
docnode: = dbms_xmldom.makeNode (domdoc);
conf_list: = dbms_xslprocessor.selectNodes (docnode, ' / game/configuration ');
for i from 0... dbms_xmldom.GetLength (conf_list) - 1 loop
conf_node: = dbms_xmldom.item(conf_list, i);
dbms_xslprocessor.valueOf (conf_node, 'property[@name="jdbc.schema"]/@value', schema_name);
password_node: = dbms_xslprocessor.selectSingleNode (conf_node, 'property[@name="password"]/@value');
dbms_xmldom.setNodeValue (password_node, schema_name |) '01');
end loop;
dbms_xmldom.writeToClob (domdoc, doc);
dbms_xmldom.freeDocument (domdoc);
Update my_nclob_table t
Set t.xmldoc = to_nclob (doc)
where t.id = 1;
end;
/
Post edited by: odie_63 - added DOM example
-
Certificate of IOM in the child attribute value form
In SAP, we have role 'SAP_ALL. And we want to control, that no one in the system doesn't have this role.
We decided to make it through the certificate in Oracle Identity Manager, but found that it doesn't have this capability, because roles are listed in the form of child resource and Attestation cannot compare something with the value of the attribute on the child form.
Maybe, I don't know something about certification in Oracle Identity Manager? Can someone help me?According to my understanding on the affidavit, it deals with access to the resource, not on the type of access to the resource.
And your condition is some sort of access to the resource.
Can you elaborate more on your condition, there will be another solution for the same.
Like putting the validation at the time of the filing of the application.
Concerning
Alabhya Grondin -
Right now I work with a very simple .xml file that retrieves data ultimately resulting in the generation of run-time components. Here is a simplified version:
< data >
< article type = "Button" x = "50" y = "100" label = "Button 1" / >
< article type = "Button" x = "50" y = "300" label = "Button 2" / >
< / data >
I figured out how to remove an attribute, such as the "label" with this:
If (. name(). attributes() [i] myXML.item [0] == "label" "")
{
delete myXML.build.item [0]. attributes() [i];
i-- ;
}
Now, the question is how can I add another attribute - like the "height"? Any help would be greatly appreciated. Thank you.Okay, I just stumbbled on the solution:
x 1. @["name"] = "test 2"; "
This seems to do. I don't know if the reverse works just not or if I did it all just bad. Thanks for your help.
Maybe you are looking for
-
What is different between iPod and iPhone
Feel it between iPod and iPhone please.
-
HP 1102w: new 1102w HP printer will not install
This is a brand new 1102w right out of the box. When I turn it on, I get an orange light flashes on the top (after alternating green and light orange light for a few seconds. I tried to install it as a wireless printer and a USB printer, but no work.
-
Problem mit Kennfelddarstellung/Interpolation
Hallo, Combi DIADEM-Neuling (Version 2012) bin und habe zwei problem: Dazu: Die representation meines efficiency-Kennfeldes mit dem Diadem Viewer values ranges erzeugt, die're enter kann nicht (rote Beriech über 100% Max-Wert bei obwohl ~ 92%), see 1
-
help the waves non-sinusoidales export to spreadsheet vi
Hello I use the "export to spreadsheet waves" vi to save the data of an LVDT in a csv file. However, when I use this vi, my csv contains two columns. One is the time stamp and the other is the: value LVDT. I would like the first column contains the t
-
Visual studio runs on windows 95
most of the people said .net is complete platform independent... agree there but visual studio works on windows 95... ? VS 2005 can added a few drastic changes, these are developed after windows 95... u will specify me Sorry for the bad English Kind