Nesting datasets from same xml?
I have an xml file that has multiple nodes (this is an
example of the repeating node, the location attribute will repeat
and has multiple values Antiqua, Aruba, etc. - I need to loop
through locations then show list of names within that):
<row region="Caribbean" location="Antigua">
<name>Hotel 1000</name>
<location>Antigua - St. John's</location>
<description>Blah blah blah...</description>
<image>image.jpg</image>
</row>
So result would be:
Antiqua
---Hotel 1000
---Hotel 1001
---Hotel 1002
Aruba
---Hotel 2000
---Hotel 2001
I thought the nestedXMLDataSet would work, but the nodes are
nested. Any help would be appreciated.
Thanks,
Victor
Hi Victor,
Take a look at the source for the RSS Reader Demo:
http://labs.adobe.com/technologies/spry/demos/rssreader/index.html
The left column is an example of what you are trying to do.
Basically what we did was we created a data set that had unique
category names. In your case that would be unique @location values.
The 2nd data set had all of the feed information, which in your
case would be a row. We then used 2 nested loops, the outer to
write out each category, and the inner wone to write out all feeds
that matched the current category.
We have an enhancement request open internally to make
"grouping" easier.
--== Kin ==--
Similar Messages
-
Load Multiple Tables (schemas) from same XML file
Hi,
This is first time i am working XML files.
I have one XML file with two tables (schema). I need to load those two tables into two different Target tables.
This is the startegy to choose tables.
<Entry type="full"> --Table 1
<Entry type="short">--Table 2
I am try to find the tables like this using condition split (Type == "Full" ) but tables are not splitting as expected, is am i going with wrong approach??
Can anyone suggest me to process multiples tables from same XML file??Hi Naveen,
After the issue in my environment, the package works well that the data in the XML file load to two destination tables based on one column values. The screenshot is for your reference:
To troubleshoot this issue, could you please check the values in the type column? Verify the values have exactly the same characters, case sensitivity. It seems that you haven’t write correct values in the Conditional Split Transformation. They should be like
below:
If there are any other questions, please feel free to ask.
Thanks,
Katherine Xiong
If you have any feedback on our support, please click
here.
Katherine Xiong
TechNet Community Support -
I want to embed text AND image from same XML file
Hey,
I got following problem:
I want to put 1 image AND my text in 1 external XML file.
I can load either one of them in seperate XML files.
I need this because I want my content to be scrollable on my website and with this my image has to scroll with my text.
I got following AS3 put in now:
(ACTIONSCRIPT3.0)
//LOADING EXTERNAL XML & IMAGE//
var xml:XML;
var urlRequest:URLRequest = new URLRequest("externaltext/welkom_content.xml");
var urlLoader:URLLoader = new URLLoader();
urlLoader.dataFormat = URLLoaderDataFormat.TEXT;
urlLoader.addEventListener(Event.COMPLETE, urlLoader_complete);
urlLoader.load(urlRequest);
function urlLoader_complete(evt:Event):void {
xml = new XML(evt.target.data);
welkom_content_text.text = xml.toXMLString();
//LOADING EXTERNAL PICTURES//
var xmlData:XML=new XML();
var pHeight:Number = 200;
var pWidth:Number = 200;
var listLoader:URLLoader = new URLLoader( new URLRequest("externaltext/testxmlimage.xml") );
var picLoader:Loader = new Loader();
listLoader.addEventListener(Event.COMPLETE, gotList);
function gotList(evt:Event):void {
var xmlData:XML = XML(listLoader.data);
var numImages:Number = xmlData.pix.length();
var stImage:String = xmlData.image
picLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, gotPic);
picLoader.load( new URLRequest(stImage) );
listLoader.removeEventListener(Event.COMPLETE, gotList);
function gotPic(evt:Event):void {
var thisBmp:Bitmap = Bitmap(evt.target.content);
thisBmp.x = 0;
thisBmp.y = 0;
var thisWidth:Number = thisBmp.width;
var thisHeight:Number = thisBmp.height;
thisBmp.scaleX = pWidth/thisWidth;
thisBmp.scaleY = pHeight/thisHeight;
addChild(thisBmp);
picLoader.contentLoaderInfo.removeEventListener(Event.COMPLETE, gotPic);
(/ACTIONSCRIPT3.0)
And my XML file for the text content is as following:
(XML TEXT FILE)
<?xml version="1.0" encoding="utf-8"?>
.... ALL OF MY CONTENT
(/XML TEXT FILE)
And for my image the XML file is as following:
(XML IMAGE FILE)
<?xml version="1.0" encoding="utf-8"?>
<imagelist>
<image>externaltext/testpicxml.jpg</image>
</imagelist>
(/XML IMAGE FILE)
Does anyone know how to fix this and how to do it?
Thanks in advance!
Every help is appreciated!Thanks!
And again... I'm doing some things wrong.. I feel dumb!
Trying to make a website in ASP.NET almost whole day, so my head isn't set to AS3 at all..
My code now to embed XML looks like:
var xml:XML = new XML();
var XMLURL:String = "externaltext/welkom_content_pic.xml";
var myXMLURL:URLRequest = new URLRequest(XMLURL);
var myLoader:URLLoader = new URLLoader(myXMLURL);
var page:Sprite = new Sprite();
myLoader.addEventListener("complete", urlLoader_complete);
function urlLoader_complete(evt:Event):void {
addChild( page );
page.addChild( welkom_title_text );
page.addChild( welkom_content_text );
page.addChild( welkom_image_holder );
xml = new XML(evt.target.data);
welkom_title_text.text = [email protected]();
welkom_content_text.text = xml.item.toString();
//use URLLoader to load the image from the path [email protected]()
Probably set some things wrong..
And what exactly do I have to set to load my image with it?
We were all a beginner once.. but I'm the uber annoying beginner I think... hehe
I probably won't be answering untill thursday, because I got a day off, so..
Thanks!!!!!!!!!!!!!!!! -
Inserting nested records from XML to DB
Hi,
I am facing a problem with inserting nested records in XML to DB. For example, I have this XML:
<?xml version="1.0" encoding="utf-8" ?>
<ns0:CutLOTUpdate xmlns:ns0="http://LayoutTracking/v1.0">
<C>1</C>
<COMMENTS>Main1</COMMENTS>
<CUT_DATA>
<CUT>
<D>1</D>
<COMMENTS>2Main1</COMMENTS>
<IT>
<E>11</E>
<COMMENTS>3Det1</COMMENTS>
</IT>
<IT>
<E>12</E>
<COMMENTS>3Det2</COMMENTS>
</IT>
</CUT>
<CUT>
<D>2</D>
<COMMENTS>2Main2</COMMENTS>
<IT>
<E>21</E>
<COMMENTS>3Det1</COMMENTS>
</IT>
<IT>
<E>22</E>
<COMMENTS>3Det2</COMMENTS>
</IT>
</CUT>
</CUT_DATA>
</ns0:CutLOTUpdate>
I would like to insert these data into the following table in a denormalized form:
CREATE TABLE A (
C NUMBER,
D NUMBER,
E NUMBER,
C_COMMENTS VARCHAR2(50),
D_COMMENTS VARCHAR2(50),
E_COMMENTS VARCHAR2(50))
I have tried using this procedure:
CREATE OR REPLACE PROCEDURE insc (Cut_Clob CLOB) AS
Cut XMLType;
BEGIN
/*Converts Cut_Clob parameter into XML */
Cut := sys.xmltype.createXML(Cut_Clob);
/*Inserts data from XML to table*/
INSERT INTO a
( C ,
C_COMMENTS ,
D ,
D_COMMENTS ,
E ,
E_COMMENTS )
SELECT DISTINCT
ExtractVALUE(CUT, '/ns0:CutLOTUpdate/C' , 'xmlns:ns0="http://LayoutTracking/v1.0') C,
ExtractValue(CUT, '/ns0:CutLOTUpdate/COMMENTS', 'xmlns:ns0="http://LayoutTracking/v1.0') C_COMMENTS,
ExtractVALUE(value(ct), '/CUT/D') D,
ExtractValue(value(ct), '/CUT/D_COMMENTS') D_COMMENTS,
ExtractVALUE(value(it), '/IT/E') E,
ExtractValue(value(it), '/IT/E_COMMENTS') E_COMMENTS
FROM TABLE (xmlsequence(extract(CUT,'/ns0:CutLOTUpdate/CUT_DATA/CUT','xmlns:ns0="http://LayoutTracking/v1.0'))) ct,
TABLE (xmlsequence(extract(CUT,'/ns0:CutLOTUpdate/CUT_DATA/CUT/IT','xmlns:ns0="http://LayoutTracking/v1.0'))) it;
COMMIT;
END;
However, this resulted into a cartesian product.
Is it possible for me to insert this XML into such table? If yes, can anyone show me how?
I apologize if this seems trivial to you and I appreciate your time for helping me.
Thank you,
KayeHi,
I have tried:
FROM TABLE (xmlsequence(extract(CUT,'/ns0:CutLOTUpdate/CUT_DATA/CUT','xmlns:ns0="http://LayoutTracking/v1.0'))) ct,
TABLE (xmlsequence(extract(CUT,'/ns0:CutLOTUpdate/CUT_DATA/CUT/IT','xmlns:ns0="http://LayoutTracking/v1.0'))) it;
This did not work - resulting in Cartesian product.
I am working with Oracle 10g DB 10.2.0.1.
If it's not too much, I am hoping that someone could show me a script to parse this XML and actually place it in a denormalized form.
If you think this is not possible, can you please just point me to an example where the same XML (with nested information) can be inserted into 3 different tables (relational)?
I have tried searching on different sources, to no avail. I am a beginner on this... I apologize for any inconveniece caused. -
How to create xml file from Oracle and sending the same xml file to an url
How to create xml file from Oracle and sending the same xml file to an url
SQL/XML (XMLElement, XMLForest, XMLAgg, etc) and UTL_HTTP.
Whether that works for you with the version of Oracle you have, your requirements, and needs is another story. A little detail goes a long way. -
Generate two xml reports from same execution
I need to generate a summary report and detail report from the same execution.
Detail report will record all the steps marked as Record result
Summary report to record only the steps that are of type Pass/Fail, Numeric Limit Test, MultiNumeric Limit Test and String test.
So far I have been able to generate two detail report from same execution and can save each report in separate folder.
How to get the data for summary versus detail report from the running sequence?
CLD,CTD
Solved!
Go to Solution.
Attachments:
ReportFolders.JPG 115 KBThanks for the approach.
I have created a sequence which recursively looks through the Parameters.MainSequenceResults and if StepType is one of the Test Types then displays in summary report.
On the summary report I also wanted to get the name of the subsequcenCall if that subsequence call contained a valid TestType for summary report. For example if subsequenceCall step has a Action and String type. I wanted it to display as shown in Image1.jpg below. Currently it displays as shown in Image2.jpg.
Attached is the recursive sequence that I am using.
CLD,CTD
Attachments:
GenerateSummaryReport.seq 8 KB
Image1.jpg 35 KB
Image2.JPG 140 KB -
Problem w/ Nested Datasets and Master/Detail regions
Hi, I'm being using spry for a couple of applications and
really love it. This is the first time I've tried to utilize a
nested dataset and I'm having some difficulty loading the nested
data. I'm getting a js 'Object does not support this property or
method' error in IE and a 'Failed to retrieve data set (dsCreds)
for spry:repeat' in FF.
I've tried to map examples to my application but of course
it's slightly different. I have a master/detail region dynamically
generated from a .php file and part of the detail region has the
nested dataset. Maybe (hopefully) it's something obvious. I've
broken out a test case that demonstrates what's happing - If anyone
could take a look I would be extremely grateful!
The .htm file is on:
htm
file
The .PHP file that generates the dynamic XML is on:
PHP
file
A sample .XML (generated from the .PHP file is
Sample XML
file
Even without the Nested set getting generated the
Master/Detail section works fine.
Thanks so much for any help!
Edit - Apologies for all the inline css - still developing
:)Hi,
The dataset name in the NestedDataSet constructor does not go
in quotes.
Try var dsCreds = new Spry.Data.NestedXMLDataSet(dsAgents,
"credentials/cred");
and see if that helps.
Don -
Need to insert values into a table from a XML file
Hi,
I'm an Oracle 9i/10g DBA with quite a few years experience, but I'm new to XML and dealing with it in database terms. I've been given a project that entails pulling XML values out of a file (or 100's of them) and storing them in the database so that they are searchable by end-users. The project is classified as secret so I'm unable to upload the specific XML or any info relating to the structire of the XML or the table I will use to insert the values into - sorry!! So, I've created an XML file with a similar structure to help people understand my predicament.
The end-users only need to search on a subset of the total amount of columns from the table I'll insert data into, although the XML file has a lot more, so I dont need to store the other values - but I will need to store the name of the XML file (or a pointer to it so I know what XML file a particular set of values belong to) in another column of the table along with its associated values.
I've been using the XMLTABLE function with some degree of success, although I had better succes using the XMLSEQUENCE function. However, I found out this is deprecated in 10g and replaced with XMLTABLE, so I guess it's better if I use this in case we ever need to upgrade to 11g.
The main problem I've been having is that some elements in the XML files have multiple values for the one record when all the other records are the same. In terms of storing this in the database, I guess it would mean inserting multiple rows in the table for each element where the value differs. Here is a dumbed down XML file similar to what I've got along with the other SQL I've used:
+<?xml version="1.0" encoding="UTF-8"?>+
+<House>+
+<Warehouse>+
+<WarehouseId>1</WarehouseId>+
+<WarehouseName>+
+<Town>Southlake</Town>+
+<State>Texas</State>+
+</WarehouseName>+
+<Building>Owned</Building>+
+<Area>25000</Area>+
+<Docks>2</Docks>+
+<DockType>Rear load</DockType>+
+<WaterAccess>true</WaterAccess>+
+<RailAccess>N</RailAccess>+
+<Parking>Street</Parking>+
+<VClearance>10</VClearance>+
+</Warehouse>+
+<Warehouse>+
+<WarehouseId>2</WarehouseId>+
+<WarehouseName>+
+<Town>Poole</Town>+
+<State>Dorset</State>+
+</WarehouseName>+
+<WarehouseName>+
+<Town>Solihull</Town>+
+<County>West Midlands</State>+
+</WarehouseName>+
+<Building>Owned</Building>+
+<Area>40000</Area>+
+<Docks>5</Docks>+
+<DockType>Rear load</DockType>+
+<WaterAccess>true</WaterAccess>+
+<RailAccess>N</RailAccess>+
+<Parking>Bay</Parking>+
+<VClearance>10</VClearance>+
+</Warehouse>+
+<Warehouse>+
+<WarehouseId>3</WarehouseId>+
+<WarehouseName>+
+<Town>Fleet</Town>+
+<County>Hampshire</County>+
+</WarehouseName>+
+<Building>Owned</Building>+
+<Area>10000</Area>+
+<Docks>1</Docks>+
+<DockType>Side load</DockType>+
+<WaterAccess>false</WaterAccess>+
+<RailAccess>N</RailAccess>+
+<Parking>Bay</Parking>+
+<VClearance>20</VClearance>+
+</Warehouse>+
+</House>+
CREATE TABLE xmltest OF XMLTYPE;
INSERT INTO xmltest
VALUES(xmltype(bfilename('XML_DIR', 'test.xml'), nls_charset_id('AL32UTF8')));
Consequently, I need to...
1) Retrieve the results from the XML file for all 3 warehouses where multiple values for the same sub-element are shown as 2 rowsthe result set. (I am guessing there will be 4 rows returned as warehouse sub-2 has 2 different elements for <WarehouseName>.
2) Build a case statement into the query so that regardless of the sub-element name (i.e State or County), it is returned into the 1 column, for instance County.
So, if I run a query similar to the following...
select y.WarehouseId, y.Town, y.County, y.Area
from xmltest x, xmltable('/House/Warehouse' .......
I would like to get results back like this...
ID Town County Area
1 Southlake Texas 25000
2 Poole Dorset 40000
2 Solihull West Midlands 40000
3 Fleet hampshire 10000
Sorry for the non-formatting but I hope this all makessense to someone out there with what I'm trying to do.
I appreciate any help whatsoever because, as i said before, I'm totally new to XML and trying to read the vast amount of information there is out there on XML is all a bit daunting.
Many thanks in advance,
Shaun.Hi again,
Thanks for keeping the post open for me. I've had a look at the post illustrating the XFileHandler package, and tried to alter it to make it fit with my XML files. To help explain things, my XML file looks like this:
<?xml version="1.0"?>
<!DOCTYPE CMF_Doc SYSTEM "CMF_Doc.dtd">
<House>
<Warehouse>
<WarehouseId>1</WarehouseId>
<WarehouseName>
<Town>Southlake</Town>
<State>Texas</State>
</WarehouseName>
<Building>Owned</Building>
<Area>25000</Area>
<Docks>2</Docks>
<DockType>Rear load</DockType>
<WaterAccess>true</WaterAccess>
<RailAccess>N</RailAccess>
<Parking>Street</Parking>
<VClearance>10</VClearance>
</Warehouse>
<Warehouse>House
<WarehouseId>2</WarehouseId>
<WarehouseName>
<Town>Poole</Town>
<State>Dorset</State>
</WarehouseName>
<WarehouseName>
<Town>Solihull</Town>
<County>West Midlands</County>
</WarehouseName>
<Building>Owned</Building>
<Area>40000</Area>
<Docks>5</Docks>
<DockType>Rear load</DockType>
<WaterAccess>true</WaterAccess>
<RailAccess>N</RailAccess>
<Parking>Bay</Parking>
<VClearance>10</VClearance>
</Warehouse>
<Warehouse>
<WarehouseId>3</WarehouseId>
<WarehouseName>
<Town>Fleet</Town>
<County>Hampshire</County>
</WarehouseName>
<Building>Owned</Building>
<Area>10000</Area>
<Docks>1</Docks>
<DockType>Side load</DockType>
<WaterAccess>false</WaterAccess>
<RailAccess>N</RailAccess>
<Parking>Bay</Parking>
<VClearance>20</VClearance>
</Warehouse>
</House>
<?xml version="1.0" encoding="UTF-8"?>
<House>
<Warehouse>
<WarehouseId>4</WarehouseId>
<WarehouseName>
<Town>Dallas</Town>
<State>Texas</State>
</WarehouseName>
<Building>Owned</Building>
<Area>25000</Area>
<Docks>2</Docks>
<DockType>Rear load</DockType>
<WaterAccess>true</WaterAccess>
<RailAccess>N</RailAccess>
<Parking>Street</Parking>
<VClearance>10</VClearance>
</Warehouse>
<Warehouse>
<WarehouseId>5</WarehouseId>
<WarehouseName>
<Town>Dorchester</Town>
<State>Dorset</State>
</WarehouseName>
<WarehouseName>
<Town>Solihull</Town>
<County>West Midlands</County>
</WarehouseName>
<Building>Owned</Building>
<Area>40000</Area>
<Docks>5</Docks>
<DockType>Rear load</DockType>
<WaterAccess>true</WaterAccess>
<RailAccess>N</RailAccess>
<Parking>Bay</Parking>
<VClearance>10</VClearance>
</Warehouse>
<Warehouse>
<WarehouseId>6</WarehouseId>
<WarehouseName>
<Town>Farnborough</Town>
<County>Hampshire</County>
</WarehouseName>
<Building>Owned</Building>
<Area>10000</Area>
<Docks>1</Docks>
<DockType>Side load</DockType>
<WaterAccess>false</WaterAccess>
<RailAccess>N</RailAccess>
<Parking>Bay</Parking>
<VClearance>20</VClearance>
</Warehouse>
</House>
<?xml version="1.0" encoding="UTF-8"?>
<House>
<Warehouse>
<WarehouseId>7</WarehouseId>
<WarehouseName>
<Town>Southlake</Town>
<State>Texas</State>
</WarehouseName>
<Building>Owned</Building>
<Area>25000</Area>
<Docks>2</Docks>
<DockType>Rear load</DockType>
<WaterAccess>true</WaterAccess>
<RailAccess>N</RailAccess>
<Parking>Street</Parking>
<VClearance>10</VClearance>
</Warehouse>
<Warehouse>
<WarehouseId>8</WarehouseId>
<WarehouseName>
<Town>Bournemouth</Town>
<State>Dorset</State>
</WarehouseName>
<WarehouseName>
<Town>Shirley</Town>
<County>West Midlands</County>
</WarehouseName>
<Building>Owned</Building>
<Area>30000</Area>
<Docks>5</Docks>
<DockType>Rear load</DockType>
<WaterAccess>true</WaterAccess>
<RailAccess>N</RailAccess>
<Parking>Bay</Parking>
<VClearance>10</VClearance>
</Warehouse>
<Warehouse>
<WarehouseId>9</WarehouseId>
<WarehouseName>
<Town>Clapham</Town>
<County>London</County>
</WarehouseName>
<Building>Owned</Building>
<Area>10000</Area>
<Docks>1</Docks>
<DockType>Side load</DockType>
<WaterAccess>false</WaterAccess>
<RailAccess>N</RailAccess>
<Parking>Bay</Parking>
<VClearance>20</VClearance>
</Warehouse>
</House>And the XFilehandler package looks like this (I'm just trying to do a simple select only on WarehouseId & WaterAccess for the time being to keep things simple):
create or replace package XFileHandler as
TYPE TRECORD IS RECORD (
WID NUMBER(2)
, WACCESS VARCHAR2(5)
type TRecordTable is table of TRecord;
function getRows (p_directory in varchar2, p_filename in varchar2) return TRecordTable pipelined;
end;
create or replace package body XFileHandler is
function getRows (p_directory in varchar2, p_filename in varchar2)
return TRecordTable pipelined
is
nb_rec number := 1;
tmp_xml clob;
tmp_file clob;
rec TRecord;
begin
DBMS_LOB.CREATETEMPORARY(TMP_FILE, TRUE);
tmp_file := dbms_xslprocessor.read2clob(p_directory, p_filename);
LOOP
tmp_xml := regexp_substr(tmp_file, '<\?xml[^?]+\?>\s*<([^>]+)>.*?</\1>', 1, nb_rec, 'n');
exit when length(tmp_xml) = 0;
--dbms_output.put_line(tmp_rec);
nb_rec := nb_rec + 1;
select y.WID, y.WACCESS
into rec.WID, rec.WACCESS
from xmltable('/House' passing xmltype(tmp_xml)
columns WID NUMBER(2) PATH 'Warehouse/WarehouseId',
WACCESS VARCHAR2(5) PATH 'WaterAccess') y;
pipe row ( rec );
end loop;
dbms_lob.freetemporary(tmp_file);
return;
end;
end;Now, when I run the query:
select * from table(XFileHandler.getRows('XML_DIR', 'XFileHandler_test.xml'));I get the error: ORA-00600: internal error code, arguments: [17285], [0x5CFE8DC8], [4], [0x45ABE1C8], [], [], [], []
I had a look in the dump file for anything obvious, but nothing really stands out. Is there anything obvious in my code that I'm missing or something else which you may think could be causing this error, e.g in the regular expression regexp_substr?
Many thanks,
Shaun. -
Looping through nested datasets
My apologies in advance if this has been asked before, but the search function on these forums doesn't appear to be working at the moment...
Using: Spry 1.6.1
Dreamweaver CS5
IE 7 and 8, Firefox 4, and Chrome 10
The question:
I have a parent xml dataset, with two nested datasets, like this:
var dsCourse = new Spry.Data.XMLDataSet("menu2.xml", "menu");
var dsTopic = new Spry.Data.NestedXMLDataSet(dsCourse, "topic");
var dsLessons = new Spry.Data.NestedXMLDataSet(dsTopic, "lesson");
The data displays properly in the html, using regions, etc. However, when I try looping through them using javascript:
topics = dsTopic.getData();
for (var t = 0; t < topics.length; t++) { //loop through the topics dataset
dsTopic.setCurrentRowNumber(t);
var top = dsTopic.getCurrentRow();
alert('current topic row name: ' + top["@name"]); //for debug purposes, display the topic name
var rows = dsLessons.getData();
for (var i = 0; i < rows.length; i++) { //loop through the lessons dataset
dsLessons.setCurrentRowNumber(i);
alert("lesson name is: " + rows[i]['name']);//display the lesson name
It will perform both loops properly, displaying the correct information for each dataset in Firefox 4, but in IE 7 and 8, and in Chrome it will list each of the Topics correctly, but only displays the first set of lessons.
The xml looks like:
<topic name="Claims" default="true" complete="false">
<lesson>
<name>Getting Started</name>
<score>0</score>
</lesson>
<lesson>
<name>Adding a Claim</name>
<score>0</score>
</lesson>
<lesson>
<name>Adding a Claimant</name>
<score>0</score>
</lesson>
<topic name="Bills" default="false" complete="false">
<lesson>
<name>Bill Components</name>
<score>0</score>
</lesson>
etc.
For what it's worth, all of the topics and lessons display properly in the html using spry regions, etc. It only appears to have an issue in javascript. And then only in IE. Is there, perhaps, a better way to do this that I'm not aware of?
Thanks in advance!
JonathanThis might help http://labs.adobe.com/technologies/spry/samples/data_region/NestedXMLDataSample.html
Gramps -
Select data from an XML Column in a Relational Table
Hi guys,
I read a lot of documentation from Oracle how to select xml nodes from an XML Table. The following statement works perfectly for an XML table.
select extract(OBJECT_VALUE, '/loop/loop_data/description') "DESCRIPTION"
from loop_table
where xmlexists('/loop/loop_data[type_code="212"]' PASSING OBJECT_VALUE);
BUT: how to select xml nodes (data) from a relational table with an XML column???
I'm interested in the xml data.
Thanks!
MiroI've tried the same but i don't get any results
WITH BOL_JMS_MESSAGES_TMP AS
(SELECT 1 pk,
XMLTYPE('<MESSAGE_ENVELOPE>
<ORDER>
<DIRECT_TURNOVER>N</DIRECT_TURNOVER>
<DATE_PLACED>2010-05-06T17:14:35.189+02:00</DATE_PLACED>
<PAYMENT_TYPE>02</PAYMENT_TYPE>
<ACCOUNT_NUMBER>108317412</ACCOUNT_NUMBER>
<GIFT_FLAG>N</GIFT_FLAG>
<ID>7788783900</ID>
<NETPRICE>117.21</NETPRICE>
<VAT>7.69</VAT>
<TOTALPRICE>126.85</TOTALPRICE>
<SHIPHAND_COSTS>1.64</SHIPHAND_COSTS>
<SHIPHAND_VAT>0.31</SHIPHAND_VAT>
<SHIPEQUALBILL_FLAG>Y</SHIPEQUALBILL_FLAG>
<SHIPPING_METHOD>01</SHIPPING_METHOD>
</ORDER>
</MESSAGE_ENVELOPE>') rnd_col
from dual
select extract(rnd_col, '/message_envelope/order/direct_turnover/date_placed/payment_type/account_number/gift_flag/id/netprice/vat/totalprice/shiphand_costs/shiphand_vat/shipequalbill_flag/SHIPPING_METHOD') "Payment type"
FROM BOL_JMS_MESSAGES_TMP
WHERE existsNode(rnd_col,'/message_envelope') = 1;
No rows.
Eventually i want to update the payment type from 02 to 00. -
Read from an XML previously created by LabView
Hi everyone,
My problem is, as the title says, I need to read Data from an XML file, if the file does not exist, LabView creates it. So far it works. After the creation though, when I go through the subroutine again and want to read the data back from the XML file, it brings me the Error Code 1006 and tells me something about not being able to read it since "the XML-Tag isn't the same type as the type of the variable connected." (roughly translated from German)
The Variable I want to read something back to is a Cluster consisting of 2 Clusters constisting of 1) two numeric elements and 2) a string and a 1-D array of 12 numeric element.
The part that's confusing me is, that LabView saved the data itself w/o problems and in its own XML format. So it shouldn't really bring up any problems reading it back to the same variable, now should it?
If anyone has an answer, I'm happy about anything, this has been driving me nuts the whole day
Thanks in advance and Regards,
Pedro
Solved!
Go to Solution.Hi,
sorry for my vague description, lets try to fix this:
For writing the XML-File, I use "Write To XML File.vi", the LabView standard XML writing VI.
For reading from it again, I use "Read From XML File.vi", also the LabView standard.
My LabView version is 8.5
I'll attach some pictures and the created XML file which I hope will be of help.
"Limits Template.png" is my Cluster to save the data in. As I said previously, the data was written from this very cluster, yet it cannot be read back to it. As you can see in there, the array is created correctly with 12 elements and their corresponding sizes.
Thanks in advance,
Regards,
Pedro
EDIT: checked again, the error code indeed is 1106
Attachments:
Limits Template.png 13 KB
test123788_Limits.txt 2 KB -
How to extract a set of XML elements from an XML element
My XML, stored in a variable called v_XML_input, is as follows:
<Root>
<PackageName>MY_PKG</PackageName>
<ProcedureName>SAVE_ADJ_VALUES</ProcedureName>
<Parameters>
<Parameter>
<Name>p_xml_string</Name>
<Value><DocumentElement>
<tblAdjustments>
<EmpID>41439</EmpID>
<UserNTID>APPUSER</UserNTID>
<Comment>TEST RECORD</Comment>
<Amount>2000</Amount>
<RecordType>R</RecordType>
</tblAdjustments>
</DocumentElement>
</Value>
</Parameter>
</Parameters>
</Root>I want to extract only whatever is between <Value> and </Value>. In this case just this:
<DocumentElement>
<tblAdjustments>
<EmpID>41439</EmpID>
<UserNTID>APPUSER</UserNTID>
<Comment>TEST RECORD</Comment>
<Amount>2000</Amount>
<RecordType>R</RecordType>
</tblAdjustments>
</DocumentElement>The actual values between the <Value> and </Value> may not always be these same elements; they may be strings, numerical values, or other XML values.
I've tried the following in a LOOP, and it works for other strings and numerical values, but I get a ORA-30625: method dispatch on NULL SELF argument is disallowed when trying to extract an XML value as a string.
v_sql_str := v_XML_input .extract('//Parameters/Parameter[position() = '||i||']/Value/text()') .getstringVal()||'''';Any help is appreciated...TIA!Not sure what you are actually trying to accomplish.
What's wrong with
SQL> SELECT xmlserialize(content XMLTYPE
('<Root>
<PackageName>MY_PKG</PackageName>
<ProcedureName>SAVE_ADJ_VALUES</ProcedureName>
<Parameters>
<Parameter>
<Name>p_xml_string</Name>
<Value><DocumentElement>
<tblAdjustments>
<EmpID>41439</EmpID>
<UserNTID>APPUSER</UserNTID>
<Comment>TEST RECORD</Comment>
<Amount>2000</Amount>
<RecordType>R</RecordType>
</tblAdjustments>
</DocumentElement>
</Value>
</Parameter>
</Parameters>
</Root>'
).extract('//Value/*') indent)xml
FROM DUAL
XML
<DocumentElement>
<tblAdjustments>
<EmpID>41439</EmpID>
<UserNTID>APPUSER</UserNTID>
<Comment>TEST RECORD</Comment>
<Amount>2000</Amount>
<RecordType>R</RecordType>
</tblAdjustments>
</DocumentElement> ?
Note: xmlserialize is not necessary and is there just for pretty printing the result. -
Need help in extracting value from an xml tag.
Hi ALL,
Good Morning to all, i have problem in fetching a value from a xml tag. I have created a xml schema based on the schema i have created a xmltype table and inserted a value to the table. When i am trying to fetch a value from a particular tag i am unable to do so.. Kindly help me to solve this. Here by i am posting all the workings i have done...
I am using the following client:
SQL*Plus: Release 10.2.0.1.0 - Production on Mon Jan 31 11:44:59 2011
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
////////////////////////////////// XML Schema ///////////////////////
begin
dbms_xmlschema.registerSchema(
'http://www.oradev.com/chipsxml.xsd',
'<schema xmlns="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.oradev.com/chipsxml.xsd"
xmlns:samp="http://www.oradev.com/chipsxml.xsd"
version="1.0">
<element name="Field1">
<complexType>
<sequence>
<element name="UTI">
<complexType>
<sequence>
<element name = "U01" type = "string"/>
<element name = "U02" type = "string"/>
<element name = "U03" type = "string"/>
<element name = "U03a" type = "string"/>
<element name = "U03b" type = "string"/>
<element name = "U03c" type = "string"/>
<element name = "U04" type = "string"/>
<element name = "U05" type = "string"/>
</sequence>
</complexType>
</element>
</sequence>
</complexType>
</element>
</schema>',
TRUE, TRUE, FALSE, FALSE);
end;
////////////////////////// Table which has multiple Column //////////////////////////
CREATE TABLE chipsxmltable1 (
id number, XMLDATA XmlType)
XMLTYPE XMLDATA STORE AS OBJECT RELATIONAL
XMLSCHEMA "http://www.oradev.com/chipsxml.xsd"
ELEMENT "Field1";
///////////////////////////////// Insert Query in chipsxmltable //////////////////////////
INSERT INTO chipsxmltable VALUES(
xmltype.createxml('<?xml version="1.0"?>
<samp:Field1 xmlns:samp="http://www.oradev.com/chipsxml.xsd" >
<UTI>
<U01>No</U01>
<U02>Y</U02>
<U03>Y</U03>
<U03a>Y</U03a>
<U03b>Y</U03b>
<U03c>Y</U03c>
<U04>Y</U04>
<U05>Y</U05>
</UTI>
</samp:Field1>'));
To show the data as a field with structure:
1. Query:
Select * from chipsxmltable1;
Output:
ID XMLDATA
1 <?xml version="1.0"?>
<samp:Field1 xmlns:samp="http://www.oradev.com/chipsxml.xsd">
<UTI>
<U01>No</U01>
<U02>No</U02>
<U03>Y</U03>
<U03a>Y</U03a>
<U03b>Y</U03b>
<U03c>Y</U03c>
<U04>Y</U04>
<U05>Y</U05>
</UTI>
</samp:Field1>
2. Query: (Both the query displays the same Output)
SELECT X.xmldata.getClobVal() "XMLDATA" FROM chipsxmltable1 X;
select extract(XMLDATA, '/Field1').getstringval() "XMLDATA" from chipsxmltable1 x;
Output:
XMLDATA
<?xml version="1.0"?>
<samp:Field1 xmlns:samp="http://www.oradev.com/chipsxml.xsd">
<UTI>
<U01>No</U01>
<U02>No</U02>
<U03>Y</U03>
<U03a>Y</U03a>
<U03b>Y</U03b>
<U03c>Y</U03c>
<U04>Y</U04>
<U05>Y</U05>
</UTI>
</samp:Field1>
To show the data as a single string without structure using "getstringval()":
3. Query
select extract(XMLDATA, '//text()').getstringval() "CHIPS - XML" from chipsxmltable1 x;
OUtput:
CHIPS - XML
NoNoYYYYYY
To show the data as a single string without structure using "getclobval()":
4.Query
select extract(XMLDATA, '//text()').getClobVal() "CHIPS - XML" from chipsxmltable1 x;
Output:
CHIPS - XML
NoNoYYYYYY
To show the data in a particular tag with/Without structure (Which is not working) using "EXTRACT" function:
6.Query:
select extract(XMLDATA, '/Field1/text()').getstringval() "XMLDATA" from chipsxmltable1 x;
select extract(XMLDATA, '/Field1/UTI').getstringval() "XMLDATA" from chipsxmltable1 x;
select extract(XMLDATA, '/Field1/UTI/U01').getstringval() "XMLDATA" from chipsxmltable1 x;
select extract(XMLDATA, '/Field1/UTI/U01/text()').getstringval() "XMLDATA" from chipsxmltable1 x;
Output:
CHIPS - XML
The above queries are not fetching the value.
To show the data in a particular tag with/Without structure (Which is not working) using "EXTRACTVALUE" function:
7. Query:
select extractValue(XMLDATA, '/Field1/UTI') "XMLDATA" from chipsxmltable1 x;
select extractValue(XMLDATA, '/Field1/UTI/U01') "XMLDATA" from chipsxmltable1 x;
Output:
X
The above queries are not fetching the value.
My question is:
How to fetch values from xml tag when the value are inserted through xml schema?
Apologies if the description is not clear. Kindly let me know if further details are needed. Many thanks for your help.
Very best regards,
Godwin Jebakumar C.V.Hi,
You need to declare the namespace of each element used in the XPath expression, like this :
SQL> select extractvalue( XMLDATA
2 , '/samp:Field1/UTI/U01'
3 , 'xmlns:samp="http://www.oradev.com/chipsxml.xsd"' ) "XMLDATA"
4 from chipsxmltable1 x
5 ;
XMLDATA
No
SQL> select extract( XMLDATA
2 , '/samp:Field1/UTI'
3 , 'xmlns:samp="http://www.oradev.com/chipsxml.xsd"'
4 ).getstringval() "XMLDATA"
5 from chipsxmltable1 x
6 ;
XMLDATA
<UTI>
<U01>No</U01>
<U02>Y</U02>
<U03>Y</U03>
<U03a>Y</U03a>
<U03b>Y</U03b>
<U03c>Y</U03c>
<U04>Y</U04>
<U05>Y</U05>
</UTI>
Please see EXTRACT and EXTRACTVALUE documentation :
http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/functions051.htm#i1006712
http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/functions052.htm#SQLRF06173
BTW, "XMLDATA" is a pseudo-column used by Oracle. I don't know if it'll ever cause any conflict but maybe you should rename your column.
http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/pseudocolumns010.htm#SQLRF00256
Regards. -
Loading an xml file from an xml file
I'm trying to load an xml file from an xml file, but I'm
having problems. My first xml file is really simple - it only
contains one attribute with the name of another xml file in it
(eventually I will have multiple xml files in here and run a loop
on them...this is why I want to load an xml file from an xml file).
Currently, with the code below, I can get the main xml file
to load ("main.xml"), but I cannot get the secondary xml files to
load FROM the main.xml.
I want to then take childNode values from the secondary xml
file and use them within my .swf in text boxes and whatnot.
Any guidance? I think I'm going wrong on the line where I'm
saying "i.newxml.load(i.attributes.location);"
- How can I get this to work?johnypeter:
I tried changing the code inside the loop to use just
"newxml" instead of "i.newxml", and I declared with "var newxml =
new XML();" - was this what you were thinking?
kglad:
The reason I tried to use the loadXML() function in the loop
was so that for each node in my "main.xml" it would load the new
xml file listed - this is a no-no? Do you have any ideas as to what
I could do?
For the for-loop, what should I change in it? I'm not great
with loops so I tried to modify some code from another loop I found
in another forum thread - not the right way to do it here?
Also, what should I trace? The value of the _root.address, or
i.attributes.location? I have created dynamic text boxes on my
stage to see if the correct value from the xml file loads (ie. the
name of the xml file within the xml file) and it does, but now I
don't know how to put that information into ANOTHER loadXML()
function and get the node information from it - does that make
sense???
Below are the examples of the xml files I am using. In the
first one, main.xml, I will have a list of multiple xml files, each
with the same nodes and elements as in the details.xml file
(different values, of course).
This is just to give you an example of what I'm trying to
accomplish - pulling ALL the addresses and phone numbers from
multiple xml files. I cannot manually collect this information, as
it is dynamic, and will be updated in each individual details.xml.
I was hoping to collect the information by simply adding to and
updating ONE xml file - main.xml.
Do you think this can be done? Am I going about it the wrong
way? I'm quite limited in AS knowledge, which is why I'm piecing
together code from other posts! -
Multiple Target from an XML file problem
I've an XLM file from which I import (using a pluggable mapping generated from xml_etl_ulils) data into a table.
I need to execute some controls and log errors on these data.
I created a splitter to split correct data (and put them into the table) and bad data (to log).
However the generated mapping goes into an error because it tries to read 2 times the same XML data.
The only way I found is to put all data (good and bad) into a temporary table and then apply the splitter to move data from that table to the targets.
However that is not a clean solution because I need to have and manage 2 tables for each real table.
Any clever suggestion ?
Tks
TullioWhat is the exact error you get (what db version also), could you post a simplified version of the SQL which fails also? I have splitter based maps that successfully read from file via the XMLType(bfilename....) style code and insert into multiple targets, I did this on 11g though.
Cheers
David
Maybe you are looking for
-
Hi All, Im installing EHP6 on windows server 2008 r2 (VM ware 10). After getting past my initial problems, im stuck on step 21/29. Create Instance. Im getting the attached error. I can make out from this file that it is network related issue, but can
-
I am the IT support for a big company and we use a lot of iPad's. The one problem we are running into is when an employee leaves the company and their i Pad is still link, we need to use this iPad for another employe but we are unable to wipe it and
-
Help!!! I need the java desktop download, but it seems the page is unavailable, and has been for 2 days now. I can get JRE1.3 from the achieves, but I don't think that supports applets from a browser, or Java Web Start?? Could some kind sole please E
-
Error message after running Software Update
Please help. I cannot do the latest Software Update. I have tried multiple time and each time I have gotten the same error message. Here it is: "The update could not be expanded and verified. It may have been corrupted or tampered with during downloa
-
How to get repeat/shuffle blue arrow to display in the 12.1.1.4 version
I am able to right click at the top where the timer is and see the shuffle songs and repeat but nothing happens and it does not show the blue arrow so that I can click on to repeat song...It just went away and I can't get it back since I downloaded t