How to extract an XML data that have different namespace prefixes?
HelloI have inserted XMLs in an XMLTYPE column which are based on a common XSD that allows different namespaces.
How can I extract some data from these XMLs using extractvalue when will be preceded different namespaces for this node?
Thank you and best regards,
A
Hello
You can use XPath:
//*[local-name()="node_name"]
For example:
with t as (
select xmltype(
'
mark
del
'
) doc
from dual union all
select xmltype(
'
john
mum
'
)
from dual
)
select extractvalue(t.doc,'//*[local-name()="name"]') as name,
extractvalue(t.doc,'//*[local-name()="place"]') as place
from t;
or,
with t as (
select xmltype(
'
mark
del
'
) doc
from dual union all
select xmltype(
'
john
mum
'
)
from dual
)
select x.*
from t, XMLTable(
'
{
element name { //*[local-name()="name"] },
element place { //*[local-name()="place"] }
}
'
passing t.doc
columns
place varchar2(30) path 'place',
name varchar2(30) path 'name'
) x;
Tags: Database
Similar Questions
-
{color: #800000} Dear friends,
It's kind of a matter of newbie on XML queries. Our DotNet developers send documents to xml by CLOB column. So I want to extract data from an xml file
Please help me...
I will wait for the response
Title Description
--------------------------------
Project Title01
Title02 demo
Title03 test
Is this possible...? {color}
It's xml content:
"& lt; NewDataSet & gt;
& lt; Schema id = "NewDataSet" xmlns = "" xmlns: XS = "http://www.w3.org/2001/XMLSchema" xmlns:msdata = "urn: schemas-microsoft-com: xml-msdata"& gt;
& lt; xs: element name = "NewDataSet" msdata:IsDataSet = "true" msdata:MainDataTable = "planAddfield" msdata:UseCurrentLocale = "true" & gt;
& lt; complexType & gt;
& lt; xs: Choice minOccurs = "0" maxOccurs = "unbounded" & gt;
& lt; xs: element name = "planAddfield" & gt;
& lt; complexType & gt;
& lt; xs: Sequence & gt;
& lt; xs: element name = "Sno" type = "xs: int" minOccurs = "0" / & gt;
& lt; xs: element name = "Title" type = "xs: String" minOccurs = "0" / & gt;
& lt; xs: element name = "Description" type = "xs: String" minOccurs = "0" / & gt;
& lt; xs: element name = "Flag" type = "xs: int" minOccurs = "0" / & gt;
& lt; / xs: Sequence & gt;
& lt; / xs: complexType & gt;
& lt; / xs: ELEMENT & gt;
& lt; / xs: Choice & gt;
& lt; / xs: complexType & gt;
& lt; / xs: ELEMENT & gt;
& lt; / xs: Schema & gt;
& lt; planAddfield & gt;
& lt; SNO & gt; 0 & lt; / Sno & gt;
& lt; Title & gt; Title01 & lt; / title & gt;
& lt; Description & gt; project & lt; / Description & gt;
& lt; Flag & gt; 0 & lt; / flag & gt;
& lt; / planAddfield & gt;
& lt; planAddfield & gt;
& lt; SNO & gt; 0 & lt; / Sno & gt;
& lt; Title & gt; Title02 & lt; / title & gt;
& lt; Description & gt; Demo & lt; / Description & gt;
& lt; Flag & gt; 0 & lt; / flag & gt;
& lt; / planAddfield & gt;
& lt; planAddfield & gt;
& lt; SNO & gt; 0 & lt; / Sno & gt;
& lt; Title & gt; Title03 & lt; / title & gt;
& lt; Description & gt; test & lt; / Description & gt;
& lt; Flag & gt; 0 & lt; / flag & gt;
& lt; / planAddfield & gt;
& lt; / NewDataSet & gt; »Hello
This will make...DECLARE x XMLTYPE := XMLTYPE('
0 Title01 project 0 0 Title02 demo 0 0 Title03 test 0 See you soon,.
Kadoch -
How the filter E4x Xml data in a tile list?
Hello!
I am trying to use a search box for some xml data that I have in a tile list. Can someone point me in the right direction?
Here is the list of tile:
< mx:HTTPService id = "GetXmlService".
resultFormat = "e4x".
Fault = "getXMLFault (Event); »
result = "getXMLResult (Event); »
showBusyCursor = "true" / >
< mx:TileList id = 'tileList '.
dataProvider = "{GetXmlService.lastResult.image}" "
itemRenderer = "CustomItemRenderer."
columnCount = "4".
columnWidth = "125".
number of lines = '2 '.
rowHeight = '150 '.
themeColor = "haloSilver".
verticalScrollPolicy = "on".
itemClick = "tileList_itemClick (event); "backgroundAlpha ="0"height ="487"borderStyle ="none"="30"right ="10"left ="10"/ >
And here is the XML data:
<? XML version = "1.0"? >
< Gallery >
< user name image = "People1' rating ="5"="yes"/ >
< / Gallery >
Hello
protected function searchFunc(item:Object):Boolean
{
var username:String = .@username (XML topic);
var insession: String = .@insession (XML topic);
username = (username.substr(0,ti.text.length)) .toUpperCase ();
var chkUser:String = (ti.text) .toUpperCase ();
If (username == chkUser & insession.toUpperCase () == "YES")
Returns true
on the other
Returns false;
}
I changed the variable names to make it a little clearer. Now whenever you perform a search it will only show according to Yes (Yes). You can have nested If more more complex application but remember there is always need to be a return to true or false for each record (item).David. -
How can I check for dates that are the same for today.
If I have a bunch of dates in a datetime colum. How can I check for dates that are the same for today.
"For example, this value of days would be ' #dateFormat (now (),"mm dd yyyy") #
The best I could come up with was:
Select * from data where data.userID =
2635 AND
"Convert (varchar, dateAdded, 101) = ' #dateFormat (now (),"mm dd yyyy") #
How can I get this to work smart peeople :)It is best to make the comparison on the datetime values. One technique is to get the current date at midnight. Then add one day to get tomorrow's date. In your sql query finds all values is greater than or equal to today and less than tomorrow.
One solution is to do everything in MS SQL
WHERE the dateAdded > = convert (datetime, convert (varchar, getdate(), 112), 112)
AND dateAdded = dateAdd (d, 1, convert (datetime, convert (varchar, getdate(), 112), 112))Another option could be to use CF to calculate dates:
WHERE the dateAdded > =.
AND dateAdded<> -
And how one removes the Christmas lights that have been offered as a decoration for the top and bottom of the screen. They tend to hide the navigation bar. Several days ago Firefox gave the 'dress-up' in a message.
It seems that https://addons.mozilla.org/firefox/addon/christmas-lights/ is added as an extension, but is categorized as a character (lightweight themes). Go to tools > Modules then check extensions and themes, and then uninstall it.
Now that the status bar is now the toolbar addons that I see those that are listed are all personas and they do not affect the toolbar addons you would also find a theme, and think that it must be very confused now that I no longer able to filter topics with a Google addons research - phooey.
Extensions can be identified with intitle: Add - ons and have changed my research of extension add-ons accordingly.
-
How do you get older emails that have not been deleted?
How do you get older emails that have not been deleted?
You have not really us given enough to go. According to the application or device, you may be able to change the settings to display a larger number of messages, or those received over a long period of time.
TT2
-
I received an error message telling me that my display driver was not at the height, & that some improvements would not be enabled. I've since updated my display driver. How can I get the improvements that have been initially disabled?
Thank you...
If you have all the features you need and there is no problem. let alone ps.
-
How to extract the party date XML dateTime data type
Hi all
I have a problem with the extraction of the date part of the dateTime data type. I am getting my output * 2012-09 - 28 T 21: 49:45 * in this format. I need to extract the date part which is
* 2012-09-28 * excluding the time. Kindly help me out by doing this. I'm new to the world of xml. Sorry if this question seems to be too stupid, but I'm quite help less.
Thank youWhat error do you get?
These two work for me:
let $myDateTime := xs:dateTime("2012-09-28T21:49:45") return
{$myDateTime cast as xs:date} let $myDateTime := xs:dateTime("2012-09-28T21:49:45") return
{xs:date($myDateTime)} -
How to list all the tables that have no data
Hi all
I want to list all the tables that have no data. (registration number is 0)
Someone help me.
Thank you
Thiensu2810Select owner, table_name from dba_tables where num_rows = 0;
This assumes that the table statistics are COMMON.
-
Hello
I have a requirement to extract data from XML and insert in a custom table.
XML structure is
< A >
< Column1 >
< Column2 >
< Column3 >
< Column4 >
< column > 5
< A >
< A1 >
< Column1 >
< Column2 >
< Column3 >
< Column4 >
< column > 5
< A1 >
.
.
.
.
< a >
< Column1 >
< Column2 >
< Column3 >
< Column4 >
< column > 5
< a >
I need to extract all the values in the column and insert it into a custom table.
Number of nodes one will increase every day, and columns can be of the order of 50-100.
With the help of EXTRACTVALUE and bulk collect I m doing this process, but taking almost 2 hours for the processing of 3000 records.
Please let me know is there better way (in terms of performance) to extract XML data?
Thank you
Kumar.
Why the node is called as A1, A2... One? Why can it not be Just A? Here's an example of how to represent XML report and analyzed data to a relational structure.
SQL> with t 2 as 3 ( 4 select xmltype 5 ( 6 '
7
' 38 ) xmldata 39 from dual 40 ) 41 select t1.* 42 from t 43 , xmltable 44 ( 45 '/table/row' passing xmldata 46 columns 47 empno number path 'empno', 48 ename varchar2(10) path 'ename', 49 doj varchar2(10) path 'doj', 50 sal number path 'sal' 51 ) t1; EMPNO ENAME DOJ SAL ---------- ---------- ---------- ---------- 1 ram 01-01-2016 10000 2 karthick 01-01-2016 10000 3 subha 01-01-2016 10000 4 vimal 01-01-2016 10000 5 vijay 01-01-2016 100008
131 9ram 1001-01-2016 1110000 1214
192 15karthick 1601-01-2016 1710000 1820
253 21subha 2201-01-2016 2310000 2426
314 27vimal 2801-01-2016 2910000 3032
375 33vijay 3401-01-2016 3510000 36 -
How to read an XML string that is not an XML file?
I have a script I'm trying to setup that communicates via a socket to retrieve the different directions of a custom Java program. The Java program listening to requests from the Adobe scripting engine (in my case it is a Photoshop script) on a socket and respond immediately with the next set of directions. These directions are currently in XML format. The question I have, is that I can not parse XML data because he entered a new XML object from a string rather than be read from a file. Even without the socket code, you can see the problem as follows:
var xml = new XML("<test><data>hey!</data></test>"); alert(xml.test.data); alert(xml);
The first alert "must" return "Hey!" (without the quotes, of course), but it doesn't, while the second warning refers to what you would expect it to:
<test> <data>hey!</data> </test>
It works very well if read from an XML file, but from a string, as indicated above, it is just an empty box when attempting to access 'xml.test.data '. Any ideas on how to solve this problem? Can it be fixed? Has it been fixed in more recent versions (I am currently using CS4)?
Thanks in advance for any help!
Duh... found my mistake... I was trying to access the data by making reference to the created element 'root '. Given that
is the first tag of the element, it is the installer as the root element, which you don't need to reference. Change alert to alert (xml.data); fixed. Now I feel stupid, lol...
-
How can I store the passwords that have been deleted
I had the usernames and passwords stored for multiple accounts of e-mail on the same site. These have been accidentally deleted from the list of saved passwords, and now I can't get Firefox (23.0) to remember once again. I have no password check enabled (behind a master password), and this site does not appear on the list of "exceptions." In the password management utility, there is no facility to add new passwords, not to remove them. It seems, once removed, Firefox assumes one will never want to save this site again.
I'm in and out of these accounts literally dozens of times a day and now connect in the manual every time. How can I get Firefox saves these combinations of name of user and password for me again?
Yes. AutoComplete = off is a direction that web sites can give a browser to instruct them not to store the data that you enter in an input field. This can be search terms that you enter on a Web site like Google, but also the privacy and security of sensitive data such as a credit card number.
If you use the bookmarklet so you know what you are doing and give it a second thought.
If you use the extension that you don't notice that a Web site prefers that you do not to save this data.With recording a password, you will need to confirm a prompt, but the other form data can be recalled if imperceptible autocomplete = off is removed.
-
How to recover programs and files that have been written too by a full system restore?
Original title: data recovery
Is there a program that will allow me to recover programs and files that have been written too by a full system restore? I had to do a complete system restore, because the computer has been locked up in a start of the closed loop cycle.
Hi Apmech9,
1. don't you restore the computer to factory settings?
2. do you just restore the computer to an earlier time by using the system restore feature in Windows XP?If you restore the computer to its factory settings, you will then get in touch with the manufacturer of the system for more support options.
If you had just restored the computer to an earlier time using System Restore, you can undo the system restore to revert back the changes.
See the article "How to undo a restoration of the system after performing a system restore" in this article of theVisit our Microsoft answers feedback Forum and let us know what you think.
-
Extraction of XML data and display new line
I have a table named, SAPDATABROWSER, which has several columns and lines. A column named SAPTEXT (data type: CLOB) consist of xml data. Each XML data are different in terms of number of nodes, but has the same following structure:
< SAP_BAPI_PROP >
< SelectedProperty >
< structure >
< field > < / field >
< length > < / length >
< FieldValue > < / FieldValue >
< type > < / Type >
< priority > < / priority >
< / structure >
< / SelectedProperty >
< / SAP_BAPI_PROP >
So now, what I would do is, to extract the values: field, FieldValue and the length of each line (total 72) and see the result as follows.
Length of track FieldValue
XXXX YYYY ZZZZ
PPPP QQQQ RRRR
AAAA BBBB CCCC
MMMM OOOO NNNN
Again, each line (total 72) has several XML Data nodes, IE there are several nodes FieldType, length and field and no two XML data/line are similar!
I use the following code:
SELECT
EXTRACT (xmltype (saptext), ' / SAP_BAPI_PROP/SelectedProperty/Structure/Field / text () ');
EXTRACT (xmltype (saptext), ' / SAP_BAPI_PROP/SelectedProperty/Structure/Length / text () ');
EXTRACT (xmltype (saptext), ' / SAP_BAPI_PROP/SelectedProperty/Structure/FieldValue / text () ')
OF sapdatabrowser;
The code above produces the following result:
SAP_BAPI_PROP/.../Field/Text () SAP_BAPI_PROP/.../Length/text () SAP_BAPI_PROP/.../FieldValue/text)
1 XXXXPPPPAAAA YYYYQQQQBBBB ZZZZRRRRCCCC
2 MMMM OOOO NNNN
Any suggestions? Thank you very much. :)Based on your sample data:
SQL> select x.* 2 from sapdatabrowser t 3 , xmltable( 4 '/SAP_BAPI_PROP/SelectedProperty/Structure' 5 passing xmltype(t.saptext) 6 columns field_name varchar2(30) path 'Field' 7 , field_len varchar2(30) path 'Length' 8 , field_val varchar2(30) path 'FieldValue' 9 ) x 10 ; FIELD_NAME FIELD_LEN FIELD_VAL ------------------------------ ------------------------------ ------------------------------ X Y Z P Q R A B C M N O
(adjust the projected if necessary data types)
-
How can I embed XML data in a PDF file?
I want to embed XML data in a PDF file if the file can be scanned for data behind the document. Is there a standard way to do this?
For example, if the PDF file is a bank statement, the embedded XML would be his number and bank account balances. He would not understand the standard text in the statement such as the name of the Bank, etc.
I read about the XMP specification, but this seems to be more than the document metadata (title, subject, etc.). And it contained are tagged but it's a different view of the entire document.
??? -Thanks - dave
Although the XMP block are stored in XML format, you can just embed any XML file. The block must follow the standard, which means that each data packet must be defined in a schema - as the name suggests, XMP is extensible, you can set the new scheme for local use, but you can't mess with standard seals and add random new tags. The schema itself is not embedded in the file, it is referenced by a unique ID number and URI. of course have a lot of data in a custom schema does not mean that any software will see it - advanced search of Acrobat can be said to sweep the XMP block, but the search engines only tend to bother with tags such as "title" and "description".
To see what is currently in a PDF file, open Document properties > Description > additional metadata > advanced.
You can save the current XMP block in a text (.xmp extension) file and replace/add other files XMP. If you click on the 'i' icon in the upper right corner of the Advanced dialog box, you can access the system profiles - these can be created in other applications such as the bridge, but there is no Manager profile in Acrobat itself.
For more technical information on the use of XMP and creating new schema, see http://www.adobe.com/devnet/xmp.html
Note that the XMP SDK for CS6 does not work in the Acrobat family.
Maybe you are looking for
-
I have updated to iOS 10 but can not see the new emoticons in my lists of emoji. Is there a problem with them, or what I have to do something for the keyboard to be updated?
-
ThinkCentre M92p - Linux boot problem
Hi all! I recently bought a new Lenovo ThinkCentre M92p. unfortunately I can't seem to run with Linux. I tried the two openSUSE 12.2 x 64 and Ubuntu LTS 12.04.1 x 64 (just to make sure that it is not only a problem of the OS or the installation media
-
Office jet Pro 8610: office jet pro scan settings
My scan settings are not higher than 300 dpi? Am I missing something? Everything else is fine. on Asus win computer 8.1
-
How can I put a calendar on my desktop? I have XP Home Edition
Where can I get a calendar for my office? and how he do there?
-
What is a mshtml.hpl help file and can it be reinstalled?
an access denied message appears when I try to set a background image. peak daily Bing... he say I have a filethat mshtml missing, I don't remember remove... can it be reinstalled and if then...?