Getting attributes from a XML File, stored in Oracle
Hello,
my problem is the following
I have a xml file that looks like that:
<?xml version="1.0" encoding="ISO-8859-1" standalone="yes"?>
<root path="H:\musik">
<directory name="Bj�rk - Homogenic" path="H:\musik\Bj�rk - Homogenic">
<file album="Homogenic" artist="Bjoerk" comment=""
completename="Bjoerk - Hunter" genre="Techno"
name="01 - Hunter.mp3"
path="H:\musik\Bj�rk - Homogenic\01 - Hunter.mp3"
title="Hunter" year="1997"/>
<file album="Homogenic" artist="Bjoerk" comment=""
completename="Bjoerk - Joga" genre="" name="02 - Joga.mp3"
path="H:\musik\Bj�rk - Homogenic\02 - Joga.mp3" title="Joga" year="1994"/>
</directory>
<directory name="Blank & Jones - In Da Mix" path="H:\musik\Blank & Jones - In Da Mix">
<file album="In da Mix" artist="Blank & Jones" comment=""
completename="Blank & Jones - On a journey (Intro)"
genre="Dance" name="01 - On a journey (Intro).mp3"
path="H:\musik\Blank & Jones - In Da Mix\01 - On a journey (Intro).mp3"
title="On a journey (Intro)" year="1999"/>
<file album="In da Mix" artist="Blank & Jones" comment=""
completename="Blank & Jones - Cream" genre="Dance"
name="02 - Cream.mp3"
path="H:\musik\Blank & Jones - In Da Mix\02 - Cream.mp3"
title="Cream" year="1999"/>
</directory>
</root>
This file I have stored in Oracle as table of XML Type.
Now I have build a little Java Programm, that displays the XML File like the File structure in the Windows Explorer.
I want, when I choose a file in the File structure, that the ID3 Informations like album artist a.s.o. can be displayed. My problem is, I couldn't get these informations e.g. in an array from the database. Any suggestions how I could realize this in Java?
Thx for any comments
Max
Try this:
select extract(xmltypefieldname, '//xpath/field@attribute').getStringVal() from yourtable where yourwhereclause
You can also select elements that match certain attributes by using a predicate such as field[@attr = myval][@attr2 = myval2]...
Hope this helps.
Similar Messages
-
Reading an XML file stored in Oracle
Is it possible to read an xml file stored in Oracle via Oracle methods?
If by "read" you mean "read as text", then you can just select the document as a CLOB and return it.
If by "read" you mean "read and parse", then you can use the Oracle XML Parser for PL/SQL to parse the CLOB into a DOM structure.
My Building Oracle XML Applications book has lots of examples of doing this, but especially in chapter 5, "Processing XML with PL/SQL".
Steve Muench
Development Lead, Oracle XSQL Pages Framework
Lead Product Manager for BC4J and Lead XML Evangelist, Oracle Corp
Author, Building Oracle XML Applications
null -
Getting data from multiple XML Files
Could any one please shed some light about the best way to
read multiple external xml files through Flex? We haveabout 100
different xml files (of which only few are randomly accessed by the
users).
I tried implementing the following generic function which
takes a filename but when debugging it, it seems that the handler
never gets call after executing the service.send() line! I will
greatly appreciate your help!!!
public function fetchFileContent(fileName:String):void{
//this method is called upon clicking on a button
var service:HTTPService = new HTTPService();
service.url = "filePath/" + fileName ;
service.useProxy = false;
service.resultFormat = "e4x";
service.addEventListener ("result",fileRetrievalHandler)
service.send();
public function fileRetrievalHandler(evnt:ResultEvent):void{
fileContent = evnt.result.feed; //this line never gets
executed"miglara" <[email protected]> wrote in
message
news:glhase$5sr$[email protected]..
> Could any one please shed some light about the best way
to read multiple
> external xml files through Flex? We haveabout 100
different xml files (of
> which
> only few are randomly accessed by the users).
> I tried implementing the following generic function
which takes a
> filename
> but when debugging it, it seems that the handler never
gets call after
> executing the service.send() line! I will greatly
appreciate your help!!!
>
> public function fetchFileContent(fileName:String):void{
//this method is
> called upon clicking on a button
> var service:HTTPService = new HTTPService();
> service.url = "filePath/" + fileName ;
> service.useProxy = false;
> service.resultFormat = "e4x";
> service.addEventListener ("result",fileRetrievalHandler)
> service.send();
> }
>
> public function
fileRetrievalHandler(evnt:ResultEvent):void{
> fileContent = evnt.result.feed; //this line never gets
executed
> }
Try adding a fault handler and seeing if that fires. Also,
since you're
using HTTPService instead of URLLoader, be aware that this
probably won't
ever work from your development environment unless you've
either changed the
output directory to go to the server or you've changed some
compiler flags
to allow you to get local and network access at the same
time. This is why
I always use URLLoader to load in XML files at a relative
path...it just
works, without my needing to change anything. -
Getting data from an XML file and pushing it to a database
I need to create a coldfusion page that grabs an incoming xml file, extract the data and then push it into a database. I have never done anything like this, and have been reading as much as I can find. Can anyone recomend a good resource or give me a hand on how I go about doing this?
The xml file is coming from another page. Basically the source page is a simple text box that an xml file is pasted into and submited. The action page must grab the xml file, pull out the data and funnel it into a table. Then it must query the table and based on the results of the query, push a new xml file back to the user.
<my brain is already hurting>I'd start by looking at the CF documentation related to XML and Ben Forta's books.
"About XML and ColdFusion" from CF docs:
http://help.adobe.com/en_US/ColdFusion/9.0/Developing/WSc3ff6d0ea77859461172e0811cbec133ba -8000.html
Ben Forta's books
http://www.forta.com/books/0321679199/
It would be good to know:
1. What the workflow is for your task. Can you describe your task in detail and provide samples of the XML and database?
2. The database you are using and the structure of your tables.
3. The version of CF you are using. -
Unable to get data from a xml file...
hi everybody....
i'm new with spry....can you tell me what's wrong with this
code? I'm just unable to display the xml content from a
database...thanks in advance for any help :)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "
http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="
http://www.w3.org/1999/xhtml"
xmlns:spry="
http://ns.adobe.com/spry">
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=UTF-8" />
<title>Documento senza titolo</title>
<link href="css/thrColEls.css" rel="stylesheet"
type="text/css" />
<script src="SpryAssets/xpath.js"
type="text/javascript"></script>
<script src="SpryAssets/SpryData.js"
type="text/javascript"></script>
<script src="SpryAssets/SpryCollapsiblePanel.js"
type="text/javascript"></script>
<script type="text/javascript">
<!--
var articoli = new Spry.Data.XMLDataSet("
http://www.openweb.in/xml.php",
"wp_posts/post");
//-->
</script>
<link href="SpryAssets/SpryCollapsiblePanel.css"
rel="stylesheet" type="text/css" />
</head>
<body class="thrColEls">
<div id="container">
<div id="sidebar1">
<div id="articoli" spry:region="articoli">
<ul>
<li spry:repeat="articoli"><a href="note1.html"
onclick="articoli.setCurrentRowNumber(0); return
false;">{titolo}</a></li>
</ul>
</div>
<!-- end #sidebar1 --></div>
<div id="mainContent">
<div id="CollapsiblePanel1" class="CollapsiblePanel"
spry:detailregion="articoli">
<div class="CollapsiblePanelTab"
tabindex="0"><h3>{titolo}</h3></div>
<div class="CollapsiblePanelContent">
<p>{testo}</p></div>
</div>
<p> </p>
<!-- end #mainContent --></div>
<!-- Questo elemento di clearing deve seguire
immediatamente il div #mainContent al fine di forzare il div
#container a contenere tutti i float di livello inferiore
--><br class="clearfloat" />
<!-- end #container --></div>
<script type="text/javascript">
<!--
var CollapsiblePanel1 = new
Spry.Widget.CollapsiblePanel("CollapsiblePanel1");
//-->
</script>
</body>
</html>ok, thanks!
i'd like to ask one more thing, if you don't mind...
i want to make a sliding panel where each link leads to a
different article in the wml file....like in this page:
http://labs.adobe.com/technologies/spry/samples/slidingpanels/SlidingPanelsSample.html#Hor izontalSliding
how to call the ID article from the xml?.....
can you give a look to this code?....thanks a lot:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
Transitional//EN" "
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="
http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=utf-8" />
<title>Sliding Panels Sample</title>
<link href="
http://labs.adobe.com/technologies/spry/widgets/slidingpanels/SprySlidingPanels.css"
rel="stylesheet" type="text/css" />
<link href="
http://labs.adobe.com/technologies/spry/css/samples.css"
rel="stylesheet" type="text/css" />
<style type="text/css">
hr, .clearAll {
clear: both;
.SlidingPanels {
width: 300px;
height: 300px;
.SlidingPanelsContent {
width: 300px;
height: 300px;
#example2.SlidingPanels {
float: left;
#example2 .SlidingPanelsContentGroup {
float: left;
width: 10000px;
#example2 .SlidingPanelsContent {
float: left;
#example3.SlidingPanels {
float: left;
#example3 .SlidingPanelsContentGroup {
float: left;
width: 900px;
#example3 .SlidingPanelsContent {
float: left;
#example3_nav.SlidingPanels {
float: left;
#example3_nav .SlidingPanelsContentGroup {
float: left;
width: 900px;
#example3_nav .SlidingPanelsContent {
float: left;
</style>
<script src="SpryAssets/xpath.js"
type="text/javascript"></script>
<script src="SpryAssets/SpryData.js"
type="text/javascript"></script>
<script src="SpryAssets/SprySlidingPanels.js"
type="text/javascript"></script>
<script type="text/javascript">
<!--
var articoli = new Spry.Data.XMLDataSet("
http://www.openweb.in/xml.php",
"wp_posts/post");
articoli.setColumnType("testo","html");
//-->
</script>
</head>
<body>
<p>
Navigate by id:
<div id="articoli" spry:region="articoli">
<ul>
<li spry:repeat="articoli"><a href="#"
onclick="sp2.showPanel('{ID}'); return
false;">{titolo}</a></li>
</ul>
</div>
<a href="#" onclick="sp2.showFirstPanel(); return
false;">First</a> |
<a href="#" onclick="sp2.showPreviousPanel(); return
false;">Previous</a> |
<a href="#" onclick="sp2.showNextPanel(); return
false;">Next</a> |
<a href="#" onclick="sp2.showLastPanel(); return
false;">Last</a>
</p>
<p> </p>
<div id="example2" class="SlidingPanels" tabindex="0"
spry:detailregion="articoli">
<div class="SlidingPanelsContentGroup">
<div id="{ID}" class="SlidingPanelsContent p1">
<h3>{titolo}</h3>
<p>{testo}</p></div>
</div>
</div>
<script type="text/javascript">
var sp2 = new Spry.Widget.SlidingPanels('example2');
</script>
<p class="clearAll"> </p>
<hr />
</body>
</html> -
Get data from external XML files
I have several difrent XML files that I whant to populate textfields and combos.
Is it possible to connect to one of several XML files to populate a Combo and there after connect to second XML file and then populate a different field or combo.
Regards
UlfHi jimmypham,
Regarding the first post in this thread on connecting to XML files- has the situation changed since your last post in May 05- is it possible to connec to XML files now in Designer?
Thanks,
Dimitri
WindJack Solutions
www.windjack.com -
How to Insert data from an XML file into an Oracle 10g table
Hello,
Please can you help me as I have hit a brick wall with this problem.
We are running version 10g Oracle and we will start receiving XML files with employee data that needs loading into a table, this is the XML file:
<?xml version="1.0"?>
<RECRUITS>
<RECRUIT>
<FIRST_NAME>Gordon</FIRST_NAME>
<LAST_NAME>Brown</LAST_NAME>
<SHORT_NAME>GORDONBROWN</SHORT_NAME>
<APP_NO>00002</APP_NO>
<STATUS>M</STATUS>
<DATE_FROM>21-JUL-2006</DATE_FROM>
<RESOURCE_TYPE>P</RESOURCE_TYPE>
<TITLE>Mr</TITLE>
<DATE_OF_BIRTH>28-DEC-1983</DATE_OF_BIRTH>
<SOCIAL_SEC>AB128456A</SOCIAL_SEC>
<PARTTIME_PCT>1</PARTTIME_PCT>
<SEX>M</SEX>
<ADDRESS_TYPE>1</ADDRESS_TYPE>
<ADDRESS>A HOUSE SOMEWHERE HERE</ADDRESS>
<ZIP_CODE>PE3 LLL</ZIP_CODE>
<PLACE>BOROUGH</PLACE>
<COUNTRY_CODE>UK</COUNTRY_CODE>
<PROVINCE>UK</PROVINCE>
<EMAIL>[email protected]</EMAIL>
</RECRUIT>
(FYI - there may be more than 1 employee in each file so all of the above will be repeated X amount of times)
</RECRUITS>
To make things simple we have created a table which mirrors the XML file completely to load the data into, the SQL i have used is thus:
CREATE TABLE RECRUITMENT
FIRST_NAME VARCHAR2(30),
LAST_NAME VARCHAR2(30),
SHORT_NAME VARCHAR2(30),
APP_NO NUMBER,
STATUS VARCHAR2(1),
DATE_FROM DATE,
RESOURCE_TYPE VARCHAR2(1),
TITLE VARCHAR2(4),
DATE_OF_BIRTH DATE,
SOCIAL_SEC VARCHAR2(9),
PARTTIME_PCT NUMBER,
SEX VARCHAR2(1),
ADDRESS_TYPE VARCHAR2(1),
ADDRESS VARCHAR2(30),
ZIP_CODE VARCHAR2(8),
PLACE VARCHAR2(10),
PROVINCE VARCHAR2(3),
EMAIL VARCHAR2(20)
Every method we try from the numerous documents and so called "user guides" have failed, please can somebody show me the PL/SQL i need to get this files data into the above table?
We need to be able to do this purely through SQL*PLUS as we hope - if we ever get it working manually to create a procuedure that will encapsulate everything so it can be run over and over again.
The XML file is sitting in the XMLDIR and is called REC.XML.
Please help : (Hi, I have got some material for inserting data into oracle table from xml file, this might help you.
Create XML Document Table
create table XML_DOCUMENT_TABLE
FILENAME varchar2(64),
XML_DOCUMENT XMLTYPE
(This will be as per your record details).
Inserting record to Oracle Table
declare
XML_TEXT CLOB := '<smsnotification>
<messageid> 256427844 </messageid>
<protocolid> CO0NPS2KHQ </protocolid>
<notifiedon> 1156123007416 </notifiedon>
<status> 3PBI: Invalid </status>
<additionalinfo> Customer account not active </additionalinfo>
<carrierid> 1175 </carrierid>
</smsnotification>';
begin
insert into XML_DOCUMENT_TABLE values ('Receipt.xml',XMLTYPE(XML_TEXT));
end;
Select Statement
select extractValue(XML_DOCUMENT,'/smsnotification/messageid') Messageid,
extractValue(XML_DOCUMENT,'/smsnotification/status') Status,
extractValue(XML_DOCUMENT,'/smsnotification/carrierid') CarrierID
from XML_DOCUMENT_TABLE; -
Link multiple XML files stored in oracle database
Link multiple XML files
Can any one give some code example regarding my issue:
If I have for example file1.xml stored in one relational table and another file2.xml stored in another table ….etc
And I want to put link and reference which will make me able to link these files and make query or insert…etc
May be I need to use Xlink, Xpoiner or Xinclude . But if this is the solution to this problem please can you give a simple example that will help to understand the solution especially that I want to develop my project in oracle and I will register xml schema to insert the xml files in the database
Thanks lots and I am waiting for your solutionno answer for my question
is this thread is a write place or I have to move my query to another part of the forum
thanks -
How to get nodes and its attributes of an XML file usiong DOM parsing?
how to get nodes and its attributes of an XML file usiong DOM parsing?
i am new to XML parsing.......
Thanking you........import org.w3c.dom.Document;
import org.w3c.dom.*;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.DocumentBuilder;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException; ...
//Setup the document
DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder();
Document doc = docBuilder.parse (new File("MY_XML_FILE.xml"));
//get elemets by name
String elementValue = doc.getElementsByTagName("MY_ELEMENT").item(0).getTextContent();
//This method can return multiple nodes, in this instance I get item(0) , first nodeRead the api for other methods of getting data. -
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. -
Using HTTPService to import data from a XML file
Hello there!
I'm having some problem's with this import... If anyone can
help, I would appreciate it!
I'm using this type of information as data source:
public var dataCollection:ArrayCollection =
new ArrayCollection([
{ id: "P1", name: "Porto", type: "team", children: [
{ id: "R1", name: "Dr Silva", location: "Bloco 1", type:
"member" },
{ id: "R2", name: "Dra Neto", location: "Gabinete", type:
"member"
{ id: "P2", name: "Braga", type: "team", children: [
{ id: "R3", name: "Dr Santos", location: "Bloco 2", type:
"member" },
{ id: "R4", name: "Dra Sonia", location: "Piso 1", type:
"member"
But I want to import it from a XML file like this:
<?xml version="1.0" encoding="utf-8"?>
<items>
<item id="P1" name="Porto" type="team">
<children id="R1" name="Dr Silva" location="Bloco 1"
type="member" />
<children id="R2" name="Dra Neto" location="Gabinete"
type="member" />
</item>
<item id="P2" name="Braga" type="team">
<children id="R3" name="Dr Santos" location="Bloco 2"
type="member" />
<children id="R4" name="Dra Sonia" location="Piso 1"
type="member" />
</item>
</items>
I already import the file, but can not translate the data
into a array collection.
private function initApp():void {
var httpService:HTTPService = new HTTPService();
httpService.url = "dataprovider.xml";
httpService.resultFormat = "e4x";
httpService.addEventListener(FaultEvent.FAULT,
onFaultHttpService);
httpService.addEventListener(ResultEvent.RESULT,
onResultHttpService);
httpService.send();
private function onFaultHttpService(e:FaultEvent):void
Alert.show("Error reading data file.");
private function onResultHttpService(e:ResultEvent):void
//Convert the xml data to a array collection
Thank youHello Peter, and thank you for your reply's.
My problem is that I'm receiving the data from the external
file and I don't know how to get the children in place... I mean, I
also have some data being received form a file that I can convert
into an array collection, but the thing is, that file doesn't have
children structure...
It's something like this:
<?xml version="1.0" encoding="utf-8"?>
<items>
<item id="T1" resourceId="R1" name="Cardiologia"
startTime="25-3-09 8:0:0" endTime="25-3-09 8:30:0" />
<item id="T2" resourceId="R2" name="Raio-X"
startTime="25-3-09 9:0:0" endTime="25-3-09 9:15:0" />
<item id="T3" resourceId="R3" name="Analises"
startTime="25-3-09 12:0:0" endTime="25-3-09 12:45:0" />
<item id="T4" resourceId="R4" name="Consulta"
startTime="26-3-09 8:0:0" endTime="26-3-09 9:0:0" />
</items>
And I solve it with this (don't know if is the best):
private function onResultHttpServiceTask(e:ResultEvent):void
var a:Array = xmlListToObjectArray(e.result.item);
tasks = new ArrayCollection(a);
protected function
xmlListToObjectArray(xmlList:XMLList):Array
var a:Array = new Array();
for each(var xml:XML in xmlList)
var attributes:XMLList = xml.attributes();
var o:Object = new Object();
for each (var attribute:XML in attributes)
var nodeName:String = attribute.name().toString();
var value:*;
value = attribute.toString();
o[nodeName] = value;
a.push(new ObjectProxy(o));
return a;
But when the children "enter in action" I don't know how to
bring them to the array...
This code you send it's preaty much the thing I need, but the
thing is that I don't know how to call the children with data as
e:ResultEvent...
If you can help a bit more, I would really appreciate...
Thank You -
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! -
Create a list from an XML file no display
I have a multiline Dynamic text box called projList.
I am trying to populate it from an xml file and create a
clickable list.
The trace works but cannot get to display the list in the
text box.
As far as the clickable goes, haven't gotten that far yet.
Help very much appreciated.
The xml is structured like this:
<?xml version="1.0" ?>
- <images>
- <pic>
<Image>/Butler/Images/sfah2_small.jpg</Image>
<Category>Institutional</Category>
<Proj_title>FRESH AIR HOME</Proj_title>
Please see code below:
import mx.xpath.XPathAPI;
var allproj_xml:XML = new XML();
allproj_xml.ignoreWhite = true;
allproj_xml.onLoad = function(success:Boolean) {
trace("onload...");
if (success) {
trace("success...");
var thePath_str:String = "/images/pic/Proj_title";
var title_array:Array =
XPathAPI.selectNodeList(this.firstChild,
thePath_str);
for (var i:Number = 0; i < title_array.length; i++) {
trace(title_array
.firstChild.nodeValue);
projList.addItem(title_array.attributes.Proj_title);
} else {
trace("error loading XML");
allproj_xml.load("allimages.xml");
stop();This did it:
projList.addItem(title_array
.firstChild.nodeValue);
> Thanks for your response.
> How can I add what I am tracing, to the component
properly?
>
> "DMennenoh **AdobeCommunityExpert**"
<[email protected]> wrote in
> message news:eqaejh$bi8$[email protected]..
>>>>trace(title_array.firstChild.nodeValue);
>> projList.addItem(title_array
.attributes.Proj_title);
>>
>>
>> Your code seems OK. What you are tracing here
however isn't what you're
>> adding to the component. Are you sure what you're
adding traces?
>>
>> --
>> Dave -
>> Head Developer
>> www.blurredistinction.com
>> Adobe Community Expert
>>
http://www.adobe.com/communities/experts/
>>
> -
Reading rule sets from an XML file
Hi all,
How can I read rule sets from an XML file? I have been given some rules in XML
format and using those I have to query some content. I am using WLP4.0
Also how can I code rules in java?
Thanks in advance.You can have the following classes:
Players class deriving from Vector (or containing a vector), and then
Player class with attribute 'name'.
class Players
Vector myVector = new Vector();
void addPlayer(Player p)
myVector.add(p);
Player getPlayer(int index)
myVector.get(index);
class Player
private String myName = null;
Player(String name)
this.myName = name;
String getName()
return myName;
}Then while handling the SAX events you can do the following:
class MySAXHandler implements ContentHandler (or whatever the itnerface is)
public void startElement(String name,....)
Players p = null;
if(name.equals("Players"))
p = new Players();
else if (name.equals("Name"))
p.add(new Player(value));
}HTH,
Kalyan. -
Use XML files stored in directory of Application server as a input for XI ?
I have a scenario that there is a xml file stored in sap application server for example /inf/ERQ/XML/XXX.xml which i want to use it as an input for XI. I know that there is an adapter in XI for getting xml file stored in normal path but in my situation it's in application server of SAP so i don't know how to do this.
Any solution or example for this? Thank you in advance.
Best regardsHi,
We can read this file through FILE adapter with FTP protocol, before that i think need permission from basis for access. Configure source(according to xml format) and target structure according to your requirement. But one thing should remember in XI/PI sour/target XML formats should contain Message type name & namespace name else it can't work.
Find below link for more information.
Introduction to simple (File-XI-File)scenario and complete walk through for starters(Part2)
Maybe you are looking for
-
Hi experts, I am writing a Function module to get data from a table. Import : desc TYPE ZTABLE-DESCRIPTION. Now when desc = te* REPLACE ALL OCCURRENCES OF '*' IN desc WITH '%' . SELECT * FROM ZTABLE INTO CORRESPONDING FIELDS OF TABLE t
-
How to pass the value to "Assignment" when submit the program RFITEMGL?
Hello friends, I want to submit program RFITEMGL (t-code FBL3N) with some screen fields, some fields are OK to fill such as u201COpen at key dateu201D, u201CG/L accountu201D and u201CCompany codeu201D. But for the field "Assignment" (It will appear
-
I use to be able to edit with Quicktime but not it's gone!!
My friend bought me Final Cut Pro 5 studio, so we installed it then next thing you know my Quicktime no longer had the editing options. It just said I need to update quicktime in order to install Final Cut, so I updated it, then boom no more Quicktim
-
HP Pavilion P2-1013w disks & videos freeze turn orange and wont run
This problem happens mostly with you tube and disks I try to watch on the computer. Never have been able to watch much of anything on here especially disks. HP Support Assistant Unable to Complete Downloading Updates it has this problem also. Cannot
-
Hi. I have a question that I hope won't be too complicated. I have two Flash objects (A Top horizontal bar and a Flash menu) inside a number of html web pages: < http://www.mikelrouse.com/> What I'd like is that the Flash objects not reload every tim