create table from the XML file at several levels
Hello
I'm working on the provision of an app to display xml data, which are currently using data from the settings file where the data was stored in a table.
CONT =]
[{txt: 'Perfume'} //main menu]
[[{txt: 'Top Note', framework: 'topNote'}, {txt: 'Heart notes', frame: "heartNote"}, {txt: frame, 'Note of Base': 'gaps'}] / / submenu]
,[
{txt: 'Packaging', field: 'packaging'} / / main menu
]
]
I created an xml file and am able to recover data and impossible to find the same.
Here's the xml file
< Products >
< produces txt = setting "Perfume" = "" > "".
< = frame 'Top Note' = "topNote" txt file name > < / name of the file >
< = txt file name ' heart notes"frame ="heartNote"> < / name of the file >
< file name txt = "Core score" frame = 'gaps' > < / name of the file >
< / product >
< produces txt = framework of 'Packaging' = 'packaging' > < / product >
< produces txt = framework "3D Animation" = "tvAd" video = "true" flvName = "video.flv" w = "547" h = "309" > < / product >
< product txt framework "advertising Lla' = 'the package' = >
< name of the txt-file = "Print Ad Creative Pack" frame = "printCp" > < / name of the file >
< / product >
< / product >
AS A CODE
---------------------------------------
(GlobalVarContainer.myXML is the place where is stored the xml file)
var node:XMLNode = GlobalVarContainer.myXML.firstChild;
var navItm:int = int (node.childNodes.length);
for (i = 0; i < wheel; i ++) {}
var temp_array:Array = new Array();
var subnavCount:int = int (node.childNodes [i].childNodes.length); subnav
var obj:Object = new Object();
obj.txt = node.childNodes [i] .attributes ['txt ""]
obj. Frame = node.childNodes [i] .attributes ["frame" "]
trace (node.childNodes [i]. Attributes ['txt'])
for (var j: int = 0; j < subnavCount; j ++)
{
trace (node.childNodes [i] Sublst.ChildNodes(1).ChildNodes(0) [j]. Attributes ['txt'])
obj.subtxt = node.childNodes [i] Sublst.ChildNodes(1).ChildNodes(0) [j]. Attributes ['txt'];
obj. Subframe = node.childNodes [i] Sublst.ChildNodes(1).ChildNodes(0) [j]. Attributes ['frame'];
temp_array.push (obj);
}
GlobalVarContainer.my_array.push (temp_array);
}
If I add - trace (GlobalVarContainer.my_array); -to code the outout is
[object Object], [object Object], [object Object]
[object Object], [object Object], [object Object],.
[object Object], [object Object], [object Object],.
[object Object], [object Object], [object Object], [object Object]
but trace (.txt [i] GlobalVarContainer.my_array + "array"); or trace (GlobalVarContainer.my_array [i] [0] .txt + "array"); no results.
need advice to move forward from here.
Thank you
AYUSH
What I meant is that if you load the XML e4x, you have to analyze in a table to use it. You can retrieve the syntax of e4x XMLList and use it directly in your code. You can treat the XMLList almost as you treat any array using a for each loop for example.
Take the code below as an example and adapt it to your needs:
var mainMenu:XMLList = this.testXML.menu;
for each {var menu: XML (in mainMenu)}
trace ("Menu:" + menu.@txt);
You can use your logic to create menu main point here
var mynavItem:Navitem = new Navitem (0, spatie * i, GlobalVarContainer.my_array [i] [0], [i, 0], false, true);
this.holder.addChild (mynavItem); ABLE TO VIEW THE MAIN MENU
var items: XMLList = menu.children ();
If (items.length () > 0) {}
for each {var point: XML (in the points)}
trace ("point:" + item.@txt);
Logic of creation of subitem here
var mySubnavItem:Navitem = new Navitem (dash, spatie * (i + 1 + j), GlobalVarContainer.my_array [i] [2], [i, j], true);
this.holder.addChild (mySubnavItem); DISPLAYS ONLY THE LAST ENTRY IN THE SUBMENU
}
}
}
Tags: Adobe Animate
Similar Questions
-
Get the table to an XML file with several bays
Hello
So I was faced with this program I have for the past few months but I'm almost there. I have a program that creates several berries and place one after the other in an xml file, and each table has its unique name. Now, I would create a VI that takes this XML file and when the user enters the name of the table specific they are seeking it goes into the xml file concludes the table in its entirety under this name and displays in an indicator of output to be read on the VI. A sample of my xml file and the VI that creates this xml file is attached.
Thank you
dlovell
Something like this should work for you.
-
How to display records from the xml file
Hi all
I created a region his area of research in reality
with 5 elements and array of result area
I want to search records based on the 5 elements and want to view output table
I have the table name as hr_api_transactions, which contains many columns
and also, this table contains a column
name TRANSACTION_DOCUMENT of type CLOB()
that files xml columns for each record
I want to extract data from this xml file and want to display.Instance of the view - put the name of VO with which you are extracting data
Discover the attribute and the attribute of file View - could see attribute by which you found the content of the file
File name substitution - is not mandatory, let him
The MIME type of the file: do not place anything, need to better manage programmatically through. Put the code in the below processRequest() method
OADataBoundValueViewObject contentBoundValue = new OADataBoundValueViewObject(downloadBean, "FileContentType"); // here "downloadBean" is bean of message Download item downloadBean.setAttributeValue(FILE_CONTENT_TYPE, contentBoundValue);
-Anand
-
Center aligning images in table using the XML file
Hello
I use a flash file that uses an xml file to download a series of images one by one in a photo-gate.
There are two different widths of images. The height is always the same. Is it possible to set up so that each image that calls file xml is center aligned as part of image.
At the present time when using the xml file to load the image she always left aligns the image when he brings it in image even if you change the alignment to center align in the Panel align.
Does anyone have a suggestion why this happens or how to fix it?
Thanks for the helpI did this quickly and did not test - but if it does not directly at the exit it might give you a starting point - or someone else can correct if there are errors. I'll check tomorrow - where I am its time to go to sleep...
CHANGE the DETAILS: Just changed a few pieces of code I posted last night - I forgot to change the statement holder_mc.loadMovie in xml.onLoad Manager. I have not tested, but its along the lines of the approach I would use to solve your problem with resizing the image. Let me know how you go with it. -
Data from the XML file in a large application...
I don't know what question is asked. The subject contains XML files and large scale applications, yet the last lines refer to write a Cluster in XML and seems to wonder if the Cluster must be a Global Variable or a TypeDef.
A 'good idea' general is to create a TypeDef that specifies (or "sets") (almost) each Cluster that you create in LabVIEW. This serves as a single-point cluster definition. If you need to make changes, you change the TypeDef and variables based on it change to match.
I do not understand why the Global Variables and TypeDefs are mentioned in the same sentence.
Bob Schor
-
Hello
The attached xml file contains data that I would like to extract. The value of the data has the label (ubchild? name /) of ' means ".". " This can happen a number of times in the file for the names of different children. for example
SENS0710:10951:IntSolIrr has the value that742.320755 and
SMBAU008:154000347:m_S0 kWh has the value that227.458679 and so on...
The attached vi is very very simple and uses the vi JKI EasyXML to parse the file to a data type of labview.
This is the point at which I need advice as to the way forward. I have reflected on the variant data, clusters, etc., but can't seem to get anything close to work.
Someone would be kind enough to give me some tips or tricks to extract these values in a table.
Thankl you
Concerning
Ray
Hi rayclout,
I don't have parser Xml JKI vi... But I used the default XML functions and can read the average tag. Please find the screenshot of it.
Thank you and best regards,
srikrishnaNF
-
Remove an object from the XML file generated by PDF
Hello
In a step of the workflow user of my PDF, the user presses a submit button that sends XML data to an address. There is an image field that has hundreds of lines of XML code that does not need to send. Indeed, at the time when this button is pressed "submit", the image field is already "hidden", but of course, it remains in the form.
Is there an any access or visibility of goods which will remove an object enough that it is not transfer with XML? How would you dynamically remove a field on the user-end?
Hello
One solution, use an ImageField object instead of an Image object. Then go to object > Binding palette and for binding, select without binding data (or none, depending on your version of the designer of the LC).
Because you are currently using an ImageField you need one line of code to its event docReady (JavaScript):
this.access = "readOnly";
The lines in the XML data file contains the image to Base64 format.
Hope that helps,
Niall
-
Ghost of the data from the XML file
Hi scripters,.
I got data ghosts of my XML file by importing.
In the file XML are 3 times the content of parent 'HALSRIEMEN-GEFL' but I understand not 5 times, I have no idea more and hope someone see the problem.
My Plan:
<>products-profdog
< product >
< item-id > < / item id >
< type > < / type >
< title > < / title >
< additive > < / addendum >
< description > < / description >
< category > < / category >
> < unit volume < / unit volume >
< weight > < / weight >
< match code > < / matchcode >
< ean number > < / ean-number >
<>< price-unit / unit price >
< stock > < / stock >
< parent > < / parent >
< active shop > < / active-shop >
< active catalog > < / active-catalogue >
< sort > < / sort >
< / product >
< product >
< item-id > < / item id >
< type > < / type >
< title > < / title >
< additive > < / addendum >
< description > < / description >
< category > < / category >
> < unit volume < / unit volume >
< weight > < / weight >
< match code > < / matchcode >
< ean number > < / ean-number >
<>< price-unit / unit price >
< stock > < / stock >
< parent > < / parent >
< active shop > < / active-shop >
< active catalog > < / active-catalogue >
< sort > < / sort >
< / product >
< / products-profdog >
My loop:
for (i = 0; i < myRootXMLElement.xmlElements.length; i ++) {}
for (ii = 0; ii < myRootXMLElement.xmlElements.item (i).xmlElements.length; ii ++) {}
If (myRootXMLElement.xmlElements.item (i).xmlElements.item (ii).markupTag.name == 'parent') {}
If (myRootXMLElement.xmlElements.item (i).xmlElements.item (ii) .silence == 'HALSRIEMEN-GEFL') {}
Alert (myRootXMLElement.xmlElements.item (i).xmlElements.item (ii).markupTag.name "->" + myRootXMLElement.xmlElements.item (i).xmlElements.item (ii) .silence);
}
}
}
}
I have it.
There was a bad XML import settings.
It must be removeUnmatchedExisting = true;
-
Reading the data from the XML file to the SQL Tables.
I have XML of this type
< empdept >
< employees_marks >
< emp_id > 1 < / emp_id >
BUS from < DIVISION_ID > < / DIVISION_ID >
PRE < JOB_ID > < / JOB_ID >
SMITH of < first-name > < / name >
JAMES < LAST_NAME > < / LAST_NAME >
< > 10000 salary < / salary >
< / employees_marks >
< dept >
< dept_details >
< deptid > 10 < / deptid >
< deptname > mechanical < / deptname >
< / dept_details >
< dept_details >
< deptid > 20 < / deptid >
< deptname > civilian < / deptname >
< / dept_details >
< dept_details >
< deptid > 30 < / deptid >
< deptname > ICE < / deptname >
< / dept_details >
< / dept >
((< / empdept > '));
With the above format am able to recover data successfully to relational tables.
< employees_marks emp_id = 1 DIVISION_ID = BUS JOB_ID = salary PRE = 10000 / >
< dept_details deptid = 10 deptname = "Mechanical" / >
< dept_details deptid = 20 deptname = "ECE" / >
< dept_details deptid = 30 deptname = "EEE" / >
that is, I have data as attributes rather than elements, if can I know the way how can I reach the requirement.
How to recover data when it is present as attributes rather than elements.
Thank you
Sunil. Nwith temp as ( select xmltype('
') tempxml from dual ) SELECT extractvalue(tempxml,'/employees_marks/@emp_id') empid, extractvalue(tempxml,'/employees_marks/@DIVISION_ID') divid , extractvalue(tempxml,'/employees_marks/@JOB_ID') jobid , extractvalue(tempxml,'/employees_marks/@salary') sal FROM temp Do you need this?
Ravi Kumar
-
Load the XML file into Oracle external Table
I load the data from the XML file into an intermediate table Oracle using external Tables.Let's say below, it is my XML file
< header >
< A_CNT > 10 < / A_CNT >
< E_CNT > 10 < / E_CNT >
< AF_CNT > 10 < / AF_CNT >
< / header >
< student >
<>students-details
< Student_info >
< Single_Info >
< ID > 18 / < ID >
New York < City > < / City >
< country > United States < / country >
< Name_lst >
< Student_name >
Samuel < name > < / name >
Paul < Last_name > < / Last_name >
< DOB > 19871208 < / DOB >
Aware of < RecordStatus > < / RecordStatus >
< / Student_name >
< Student_name >
Samuel < name > < / name >
Paul < Last_name > < / Last_name >
< DOB > 19871208 < / DOB >< TerminationDt > 20050812 < / TerminationDt >
History of < RecordStatus > < / RecordStatus >
< / Student_name >
< / Name_lst >
< Personal_Info >
<>men < / Type >
< 27 > < / Age >
< / Personal_Info >
< / Single_Info >
< / Student_info >< student - register >
class < A >
< info >
< detail >
< ID student > 18 < / student >
EE < major > < / Major >
< course-Grades >
< course > VLSI < / course >
< degree > 3.0 < / Grade >
< / course-Grades >
< course-Grades >
< course > nanotechnology < / course >
< degree > 4.0 < / Grade >
< / course-Grades >
< / details >
< detail >
< ID student > 18 < / student >
THIS < major > < / Major >
< / details >
< / info >
class < A >
< Student_Enrol >
<>students-details
< student >I load this XML data file into a single table using an external Table. Could someone help me please with coding.
Thank you
Reva
Could you please help me how to insert my XML content into that.
Same as before, try a plain old INSERT:
insert into xml_pecos
values)
XmlType (bfilename ('XML_DIR', "test.xml"), nls_charset_id ('AL32UTF8'))
);
But you'll probably hit the same limitation as with the binary XMLType table.
In this case, you can use FTP to load the file as a resource in the XML DB repository.
If the XML schema has been registered with the hierarchy enabled then the file will be automatically inserted into the table.
Could you post the exact statement that you used to save the scheme?
In the meantime, you can also read this article, I did a few years ago, it covers the XML DB features that may be useful here, including details on how to load the file via FTP:
https://odieweblog.WordPress.com/2011/11/23/Oracle-XML-DB-a-practical-example/
And documentation of the course: http://docs.oracle.com/cd/E11882_01/appdev.112/e23094/xdb06stt.htm#ADXDB4672
-
Create an image slider using the XML file photo gallery
Hello!
I have created a photo gallery and generated an xml file. I want to implement a cursor image on the home page that performs a simple fade from one image to the other.
I'm not an expert on jQuery. The BC help section says to add code that retrieves in the XML file and THEN add another code query j who would style images and transitions.
I don't know how to do this. Here is my code and it does not work.
If you have a simple solution, it would be great.
There is a script called JSSOR
"< script type =" text/javascript"src ="... / js/jquery-1.9.1.min.js "> < / script >"
<!-use jssor.slider.mini.js (40 KB) instead for immediate release->
<!-jssor.slider.mini.js = (jssor.js + jssor.slider.js)->
< script type = "text/javascript" src = "javascripts/jssor.js" > < / script >
"< script type =" text/javascript"src="javascripts/jssor.slider.js "> < / script >
This is the beginning of the code BC gives to pull from the xml file into a div called "Gallery".
< div id = 'Gallery' > < / div >
< script type = "text/javascript" >
{$(function()}
$.ajax({)
type: 'GET ',.
url: " http://www.performanceaire.com/Fahrenheit-images/BannerGallery/Photogallery.XML ", / / replace with an absolute URL of the XML of your gallery of .
data type: "xml."
success: {function (xml)}
{$(xml).find('img').each (function ()}
location var = ' http://www.performanceaire.com/Fahrenheit-Images/BannerGallery/'; / / Replace with the absolute path to the directory that contains your images
var url = $(this) .attr ('src');
var alt = $(this) .attr ('alt');
$('<li></li>').html (' < a href = "' + place +" + url + ' "> < img src ="' + place + "+ url + '" alt = "' + alt + '" / > < / a > ').appendTo('#gallery');
});
}
});
});
This is the code taken from JSSOR to transitions occur, and it does not work... any ideas?
jQuery (document) .ready (function ($) {}
var options = {}
$AutoPlay: true, / / [optional] If auto play, to activate the slide show, this option must be set to true, the default value is false
$DragOrientation: 1 / / orientation [optional] to drag the slide, 0. drag, 1 horizental, 2 3 vertical or, default value is 1 (note that the $DragOrientation must be the same as $PlayOrientation when $DisplayPieces is more than 1, or in the parking position is not 0)
};
var jssor_slider1 = new $JssorSlider$ ("Gallery", options);
});
< /script >
www.performanceaire.com/index-FS.html
It is perhaps a bit much if you do not top:
-
I have a requirement to process a stream of xml files and load its content in the oracle as a name-value pair tables. Basically, my table has three columns ID, Detail_NM, Detail_val. I have to extract the ID and the corresponding details and store it in this table. The XML file looks like in below. I can use an extract sql but you are looking for the most effective way to do it. I would like to highlight the elements dynamically as an element may or may not be present in every game. for example. Second series below has address2 that isn't there in the first document set. Even if nothing new is introduced, I should be able to treat them without explicitly mentioning the name of the element. Is there a better way to deal with? Please, share your ideas. Thanks in advance
< document >
< id > 546534 < /ID >
< details >
the New York < City > < / City >
Ave de Rome 45 < address > < / address >
< zip > 10281 < / Zip >
< / details >
< / document >
< document >
< id > 6785565 < /ID >
< details >
Dallas < City > < / City >
< address > 56 locust ave < / address >
< Address2 > 2nd floor < / address >
< zip > 07454 < / Zip >
< / details >
< / document >
user626688 wrote:
Thanks again. Yes, we can have a node root
here. -What is the average size of a single XML entity? (Number of nodes, size in bytes)? -A file can be up to 2MB size. Each ID can have different elements from 0 to 200 under him. (Each document tag).
Sorry, missed your last answer once again.
If there is a root node, it is even simpler.
And you can certainly use an intermediate binary table of XMLType:
SQL> begin 2 3 -- insert as Binary XMLType 4 -- optional step for small files 5 insert into tmp_xml 6 values ( 7 xmltype(bfilename('TEST_DIR','sample2.xml'), nls_charset_id('AL32UTF8')) 8 ); 9 10 -- parse and insert into the target table 11 insert into my_table (id, detail_nm, detail_val) 12 select x1.id 13 , x2.detail_nm 14 , x2.detail_val 15 from tmp_xml t 16 , xmltable('/Documents/Document' 17 passing t.object_value 18 columns id number path 'Id' 19 , details xmltype path 'Details' 20 ) x1 21 , xmltable('/Details/*' 22 passing x1.details 23 columns detail_nm varchar2(256) path 'local-name(.)' 24 , detail_val varchar2(4000) path 'text()' 25 ) x2 ; 26 27 end; 28 / PL/SQL procedure successfully completed. SQL> select * from my_table; ID DETAIL_NM DETAIL_VAL ---------- -------------------- ------------------------ 546534 City New York 546534 Address 45 Rome Ave 546534 Zip 10281 6785565 City Dallas 6785565 Address 56 locust ave 6785565 Address2 2nd Floor 6785565 Zip 07454 7 rows selected.
-
How to import the xml file into bcc?
My input to atg file is xml containing assets of category or products.
I want the Scheduler to run to auto create a project and send an e-mail to the customer for approval.
When the client approves the xml file, and then run the Scheduler to get the data from the xml file into bcc.
I use: SingletonSchedulableService for this
Give me a direction for the same thing.
Thanks in advance.
I want to implement this in bcc.
What listener will listen to the authorization of the client for email (that contains the XML to import) we sent to him?
You will need to do a custom development to hang your workflow customized with incoming e-mail. To send notifications by mail electronic action is already there, and while creating his element within the ACC, you can specify a JSP page for the email template. You can view the rest of the relevant documents:
Oracle, Web ATG Commerce - Workflows
Oracle, ATG trade Web - action workflow items
I recommend you to consult the existing source of DeploymentEmailer in
\Publishing\samples\Java and see different types of DeploymentEvent and States can be used, based on your requirement in your custom component. See also these API javadocs for the process and the events of deployment available: DeploymentEvent (ATG Java API)
DeploymentServer (ATG Java API)
ATG has a component/atg/dynamo/service/POP3Service to retrieve messages from a POP3 e-mail server, but it is mainly used to detect the bounced email. Not too sure if it helps or adjustment in your case, but still you can go through all the details to know what is already there:
Bounced from Oracle ATG Web Commerce - E-mail
You can also check the event InboundEmail and API javadocs for InboundEmailMessage which are used in this function of rebound detection E-mail:
Oracle, ATG trade Web - InboundEmail event
InboundEmailMessage (ATG Java API)
Now based on all this, if you extend and customize a lot of things, that it would be little complex and tedious detect mail incoming approval based on its content and then advance your workflow. Another approach may be to put a URL in the e-mail template of your notification by e-mail that the approver will click and on the landing page, you can authenticate and advance your workflow to the needs.
-
Generate the XML file with elements and attributes in table Oracle
Hello
I have the following table structure.
CREATE TABLE SPOOL
(
COIL_ID NUMBER (10),
COIL_NUMBER VARCHAR2 (40),
COIL_PO_OPERATING_UNIT VARCHAR2 (20).
COIL_PO_NUMBER VARCHAR2 (40),
MILL_NUMBER VARCHAR2 (2),
MILL_COIL_STATUS VARCHAR2 (15).
ITEM_NUMBER VARCHAR2 (40),
COIL_WEIGHT NUMBER (38),
WEIGHT_UOM VARCHAR2 (10),
DOCUMENT_NUMBER VARCHAR2 (40),
DATE OF DOCUMENT_DATE,
DOCUMENT_STATUS VARCHAR2 (15).
DOCUMENT_TYPE VARCHAR2 (20).
DOCUMENT_SOURCE VARCHAR2 (20).
TEST_ID NUMBER (38),
NUMBER VALUE,
TEST_UOM VARCHAR2 (20).
TEST_STATUS VARCHAR2 (70).
TESTER_LOGIN VARCHAR2 (20).
EQUIPMENT_CODE VARCHAR2 (50).
DOC_STS_MSG VARCHAR2 (600)
)
/
For each record COILID, there could be several folders baased on TEST_ID/VALUE/TEST_UOM etc.
And I would like to prepare the xml file in the following format by selecting data in the COIL?
<? XML version = "1.0"? >
-coil xsi: noNamespaceSchemaLocation = "www.tempel.com/COIL.xsd" xmlns: xsi = "http://www.w3.org/2001/XMLSchema-instance" xmlns:xdb = "http://xmlns.oracle.com/xdb" >
< CoilId > 1419532 < / CoilId >
< CoilNo > D2221050010A0 < / CoilNo >
Changzhou < CoilPOOperatingUnit > < / CoilPOOperatingUnit >
< CoilPONo > 4619 < / CoilPONo >
< MillNo > 86 < / MillNo >
Test of < MillCoilStatus > < / MillCoilStatus >
C5 050FP800 < ItemNo > < / ItemNo >
< weight > 7076 < / weight >
KILOGRAM of < GLU > < / UDM >
< DocumentNo > 0 < / DocumentNo >
< DocumentDate > 2013 - 01 - 11 < / DocumentDate >
< DocumentStatus > not < / DocumentStatus >
< DocumentType > test < / DocumentType >
CHIGMA1 < DocumentSource > < / DocumentSource >
< DocStsMsg test = '0' EquipmentCode = "CHIGMA1" TesterLogin = "dpkrueger" Value = "0.4992" TestUnit = "mm" Status = 'NonProcessed' TestId = "135" / >
< test DocStsMsg = '0' EquipmentCode = "CHIGMA1" TesterLogin = "dpkrueger" Value = "0.0128" TestUnit = "mm" Status = 'NonProcessed' TestId = "124" / >
< DocStsMsg test = '0' EquipmentCode = "CHIGMA1" TesterLogin = "dpkrueger" Value = "12" TestUnit = "mm" Status = 'NonProcessed' TestId = "125" / >
< DocStsMsg test = '0' EquipmentCode = "CHIGMA1" TesterLogin = "dpkrueger" Value = "0.5095" TestUnit = "mm" Status = 'NonProcessed' TestId = "127" / >
< DocStsMsg test = '0' EquipmentCode = "CHIGMA1" TesterLogin = "dpkrueger" Value = "0.5042" TestUnit = "mm" Status = 'NonProcessed' TestId = "128" / >
< DocStsMsg test = '0' EquipmentCode = "CHIGMA1" TesterLogin = "dpkrueger" Value = "0.5058" TestUnit = "mm" Status = 'NonProcessed' TestId = "129" / >
< DocStsMsg test = '0' EquipmentCode = "CHIGMA1" TesterLogin = "dpkrueger" Value = "0.4967" TestUnit = "mm" Status = 'NonProcessed' TestId = "130" / >
< DocStsMsg test = '0' EquipmentCode = "CHIGMA1" TesterLogin = "dpkrueger" Value = "0.5049" TestUnit = "mm" Status = 'NonProcessed' TestId = "131" / >
< DocStsMsg test = '0' EquipmentCode = "CHIGMA1" TesterLogin = "dpkrueger" Value = "0.4972" TestUnit = "mm" Status = 'NonProcessed' TestId = "132" / >
< DocStsMsg test = '0' EquipmentCode = "CHIGMA1" TesterLogin = "dpkrueger" Value = "0.4960" TestUnit = "mm" Status = 'NonProcessed' TestId = "133" / >
< DocStsMsg test = '0' EquipmentCode = "CHIGMA1" TesterLogin = "dpkrueger" Value = "0.4996" TestUnit = "mm" Status = 'NonProcessed' TestId = "134" / >
< / reel >
Can you please guide me how to do it in a single query?
Thanks in advance.Function EXTRACT will force a print in your version:
SELECT XMLElement("Coil", XMLAttributes( 'http://www.w3.org/2001/XMLSchema-instance' as "xmlns:xsi" , 'www.tempel.com/COIL.xsd' as "xsi:noNamespaceSchemaLocation" ) , XMLForest( COIL_ID as "CoilId" , COIL_NUMBER as "CoilNo" , COIL_PO_OPERATING_UNIT as "CoilPOOperatingUnit" , COIL_PO_NUMBER as "CoilPONo" , MILL_NUMBER as "MillNo" , MILL_COIL_STATUS as "MillCoilStatus" , ITEM_NUMBER as "ItemNo" , COIL_WEIGHT as "Weight" , WEIGHT_UOM as "UOM" , DOCUMENT_NUMBER as "DocumentNo" , DOCUMENT_DATE as "DocumentDate" , DOCUMENT_STATUS as "DocumentStatus" , DOCUMENT_TYPE as "DocumentType" , DOCUMENT_SOURCE as "DocumentSource" ) , XMLAgg( XMLElement("Tests", XMLAttributes( DOC_STS_MSG as "DocStsMsg" , EQUIPMENT_CODE as "EquipmentCode" , TESTER_LOGIN as "TesterLogin" , VALUE as "Value" , TEST_UOM as "TestUnit" , TEST_STATUS as "Status" , TEST_ID as "TestId" ) ) ) ).extract('/*') FROM coil GROUP BY COIL_ID , COIL_NUMBER , COIL_PO_OPERATING_UNIT , COIL_PO_NUMBER , MILL_NUMBER , MILL_COIL_STATUS , ITEM_NUMBER , COIL_WEIGHT , WEIGHT_UOM , DOCUMENT_NUMBER , DOCUMENT_DATE , DOCUMENT_STATUS , DOCUMENT_TYPE , DOCUMENT_SOURCE ;
-
Navigate trough different 'levels' in the XML file from the known item?
I am quite new to this, so I have to ask even if it's a stupid question...
I am trying to build a generic oracle procedure that can insert data into a table from a file XML so that message that it contains, but of course the messages has the same structure.
I need to find the first item after data, in this case "CUS_ORD_HEAD", but it could be any message as PO_HEAD.
So I need to somehow find the element without knowledge is the name of the element. It goes same for CUS_ORD_LINE that might be PO_LINE. Is it possible to navigate through the different 'levels' in the XML file from a known element.
< CustomerOrder >
< metadata >
< TransActionIdentity > 1 < / TransActionIdentity >
< / metadata >
< data >
< Client CUS_ORD_HEAD = 'ABC' CustomerOrderNumber '1234' = >
< CUS_ORD_LINE CustomerOrderNumber = "1234" OrderedQuantity = "10" ProductNumber = "1001403" CustomerOrderLinePosition = "1" / >
< HAPI_CUS_ORD_LINE CustomerOrderNumber = "1234" OrderedQuantity = "1" ProductNumber = "2530" CustomerOrderLinePosition = "2" / >
< CUS_ORD_LINE_TEXT CustomerOrderLinePosition = '2' Text = "Test" CUSTOMERORDERNUMBER = "1234" / >
< / HAPI_CUS_ORD_HEAD >
< / data >
< / CustomerOrder >the tablename parameter is identical to the XML element and attributes are the same as the columns
OK, understood.
You can retrieve the name of the element and attribute names in the same time by using something like the following.
Attribute names are stored in a collection that is accessible iteratively in order to build the dynamic parts of the query:SQL> CREATE OR REPLACE TYPE TColumnList IS TABLE OF VARCHAR2(30); 2 / Type created SQL> set serveroutput on SQL> SQL> DECLARE 2 3 xmldoc xmltype := xmltype(' 4
5 '); 18 19 --t_column_list TColumnList := TColumnList(); 20 --v_table_name VARCHAR2(30); 21 22 tmp_cols VARCHAR2(1000); 23 tmp_paths VARCHAR2(1000); 24 tmp_qry VARCHAR2(4000); 25 26 BEGIN 27 28 FOR r IN ( 29 SELECT table_name 30 , set(cast(collect(column_name) as TColumnList)) as column_list 31 FROM XMLTable( 32 'for $i in /CustomerOrder/Data/descendant::* 33 , $j in $i/attribute::* 34 return element e 35 { 36 element TABLE_NAME {name($i)} 37 , element COLUMN_NAME {name($j)} 38 }' 39 passing xmldoc 40 columns 41 table_name varchar2(30) 42 , column_name varchar2(30) 43 ) 44 GROUP BY table_name 45 ) 46 LOOP 47 48 tmp_cols := NULL; 49 tmp_paths := NULL; 50 51 --dbms_output.put_line(r.table_name); 52 53 FOR i in 1 .. r.column_list.count LOOP 54 55 tmp_cols := tmp_cols || ', ' || r.column_list(i); 56 tmp_paths := tmp_paths || ', ' || r.column_list(i) || ' varchar2(35) path ''@' || r.column_list(i) || ''''; 57 58 END LOOP; 59 60 tmp_cols := ltrim(tmp_cols, ', '); 61 tmp_paths := ltrim(tmp_paths, ', '); 62 63 tmp_qry := 'INSERT INTO ' || r.table_name || ' (' || tmp_cols || ') ' || 64 'SELECT ' || tmp_cols || 65 ' FROM XMLTable(''/CustomerOrder/Data/descendant::' || r.table_name || '''' || 66 ' PASSING :1 ' || 67 'COLUMNS ' || tmp_paths || 68 ')'; 69 70 dbms_output.put_line(tmp_qry); 71 72 END LOOP; 73 74 END; 75 / INSERT INTO CUS_ORD_HEAD (CustomerOrderNumber, Customer) SELECT CustomerOrderNumber, Customer FROM XMLTable('/CustomerOrder/Data/descendant::CUS_ORD_HEAD' PASSING :1 COLUMNS CustomerOrderNumber varchar2(35) path '@CustomerOrderNumber', Customer varchar2(35) path '@Customer') INSERT INTO CUS_ORD_LINE (CustomerOrderNumber, OrderedQuantity, ProductNumber, CustomerOrderLinePosition) SELECT CustomerOrderNumber, OrderedQuantity, ProductNumber, CustomerOrderLinePosition FROM XMLTable('/CustomerOrder/Data/descendant::CUS_ORD_LINE' PASSING :1 COLUMNS CustomerOrderNumber varchar2(35) path '@CustomerOrderNumber', OrderedQuantity varchar2(35) path '@OrderedQuantity', ProductNumber varchar2(35) path '@ProductNumber', CustomerOrderLinePosition varchar2(35) path '@CustomerOrderLinePosition') INSERT INTO CUS_ORD_LINE_TEXT (CUSTOMERORDERNUMBER, Text, CustomerOrderLinePosition) SELECT CUSTOMERORDERNUMBER, Text, CustomerOrderLinePosition FROM XMLTable('/CustomerOrder/Data/descendant::CUS_ORD_LINE_TEXT' PASSING :1 COLUMNS CUSTOMERORDERNUMBER varchar2(35) path '@CUSTOMERORDERNUMBER', Text varchar2(35) path '@Text', CustomerOrderLinePosition varchar2(35) path '@CustomerOrderLinePosition') PL/SQL procedure successfully completed6 8 91 710 16 1711 1213 1514
Maybe you are looking for
-
Flash does not give me the dialogue 'ask to activate '.
I don't get "click here to activate" option on Flash videos sometimes. I noticed a problem on the site it is Yahoo News. And it seems that if I put back to "ask to activate" Flash "always enable" then it will work for a while (maybe up to that I clos
-
How to do a different search on the search bar of the home page
In the new versions of Firefox (23 and more) the search bar at the top is locked in search default homepage. It is useless to me because I would like to search from the search bar IMDB, but when I do all the research my homepage Search IMDB as well.
-
I can't adjust the volume on my computer. Help!
The shortcut [command + option + up/down arrow] no longer works. My mac has currently no Skype shortcuts to the folder, I can't find them anywhere, not in the keyboard shortcuts, shortcuts to application... nothing. This has happened a few weeks afte
-
Hello I was curious to know how much space I had on my new iPhone 5 c. I got it 2 weeks ago and I don't have a lot of apps from your. According to what he says about the settings I used 10.7 GB and I have 1.6 GB left which is hard to believe. So, I d
-
migrate from Raid 1 to Raid 5 with IX4 - 300 d
I am considering buying an IX4 - 300 d. But what I want to know: I might consider commissioning with 2 drives in RAID-1 and later on the road buy a 3rd drive to upgrade my RAID-5. Is this possible on the fly, which means that I can just put in the dr