How to xml file load in actionscript 3.0
Hi surfers,
How to xml file load in actionscript 3.0, How to get xml data.
Thanks in Advance.
Pls give me ASAP, i'm struggle here.
Search Google using "AS3 XML tutorial".
Similar Messages
-
HI,
i am working in a big game ,for each section of this i need to load three or four XML files.
can i store this XML files once it loaded ? this method will effect server memory and speed..?
how manage xml files ( good oops methods)..?load each xml file once. use different xml instances for each xml file. you can reference you xml instances any time after loading is complete.
-
How Export XML file to Adobe After effects
how export XML file from FCP X and how i open in adobe aftereffects and also export from AF and how it will oper in Final cut pro X
Premiere and AE use Dynamic Link to interact.
After Effects Help | Dynamic Link and After Effects -
How create XML file using HTML / JavaScript. Please small example.
Mykle.Various tools are available generate an XML document from a DTD.
http://www.eclipse.org/webtools/community/tutorials/XMLWizards/XMLWizards.html
http://www.altova.com/products/xmlspy/dtd_editor.html
http://www.stylusstudio.com/xml_generator.html -
Hi All,
We are facing issue in loading an XML file in database. It is an XML file from S-MART (PGS).
If we try to load the xml file directly using an OWB mapping (as way we are doing for MARS), the mapping takes forever.
We have tried several strategies but got only partial success till now.
Structure of XML is like this
emml
list
hierarchyNode (list type Service priority , coverage tier list etc)
list
hierarchyNode (corporate Asia pacific etc)
list
hierarchyNode (Gold ,Silver Platinum etc)
list
hierarchyNode (list of CIS_CODE)
As parsing directly to cis level was not working, we stored the intermediate results in a temp table. We extracted the XML object at metal level (gold , silver) and stored it in a temp table 's XMLTYPE field . Using a second mapping we extracted the data from temp table and loaded it to final table.
Using this approach we were able to load data for all the metals except for one. Performance was also good. It took total 3-4 min to load. But the mapping failed for “ Home Products” category with the error:
ORA-31186 - Document contains too many nodes.
Cause: Unable to load the document because it has exceeded the maximum allocated number of DOM nodes.
Action: Reduces the size of the document.
This is because of a lot of CIS codes listed under the Home Products category. I do not see any straight forward way of to reduce or split the xmlobject further before the final processing.
Any one having ideas how to load such an XMLYou can check
the thread error while loading XML files into scott user
I hope it will help. -
I've been banging my head against a wall for this for almost a couple days now and hoping that someone can point me in the right direction.
Working in a very large Flash application, previously in AS2/CS3 I would have a setup like the following:
root.swf
-- modules
---- code_a.swf
---- code_b.swf
-- views
---- view_a.swf
---- view_b.swf
Using _exclude.xml files, I could exclude the classes defined in code_a and code_b from the ouptut .swf of view_a and view_b. root.swf would be responsible for loading the code modules before view_a or view_b, ensuring that class definitions that view_a and view_b depended on existed.
The Problem
We've recently migrated to using Actionscript 3/CS5. *_exclude.xml files no longer exist. To get the same functionality as above, I've tried the following:
My setup now looks something like:
root.swf
-- modules
---- class_a.as
---- class_b.as
-- views
---- view_a.swf
---- view_b.swf
Use mxmlc to compile root.swf, view_a.swf and view_b.swf, passing it -externs option to specify classes that will be loaded externally (the two classes in modules). This ensures that the class is excluded from the compiled swf.
Use compc to compile class_a.as and class_b.as into classes.swf, using -directory=true to access library.swf for external loading.
However, when I try running one of the two view files which depend on classes.swf, I get runtime errors telling me that a class definition is not present.
Current Workaround
I've devised a workaround which I'm currently not happy with as it's backwards to the modular approach that I was previously using:
Rather than loading the code modules, I statically link all class definitions required by child movies intoroot.swf. When building root.swf, I use the -link-report option of mxmlc to provide a list of included classes. When building child swfs, I can the use -load-externs to ensure that class definitions that already exist will not be included in the compile output.
Is there a way that anyone is aware of to replicate the AS2/_exclude.xml solution that I had using AS3/CS5?I'd double check if you are loading the child SWF with correct LoaderContext and/or calling ApplicationDomain.getDefinition() correctly - otherwise you cannot access classes defined in loaded SWF files.
-
I have a large XML file that I am converting to an
ArrayCollection to use as a dataprovider for a datagrid. It takes
sometime to fully load. Is there any way to load partial list while
the rest of the list is loading?? or does anyone know a way speed
up this process??
ThanksI'd try to modify the autoComplete component.
You could break this processing up into smaller chunks. For
it to work, you need some outside counter or indexer that keeps
track of where you are. Have the conversion function process say
nodes 0-500, then end. Then using callLater, call that function
again, to process ne next batch of nodes.
This process will allow the UI to update between iteration
batches. If you need more responsiveness, you could try monitoring
mouse move, and stopping the conversion, until the mouse is
inactive again. That is just brainstorming. I have not tried it
(the mouse move part. I know the iterator method works to allow the
UI to update.)
Tracy -
Debugging mode stopped automatically when using xml file load
Dear Sir,
I am trying to develop a new add-on using xml files for creating new forms. In fact I was using the sample code delivered with the SDK ( WorkingWithXml - under VB.NET). The Problem is that when I am in the debuging mode and after the form load. the application goes out of the debugging mode and stop action.
In fact what i was trying to do first is to create a new menu and then when i click on this menu a new form appear but once the menu is loaded the application stop the debugging mode automatically.
Can somebody clarify to me what I am doing wrong and why the debugging mode is stopped automatically, noting that i am still in the add-on developpement phase.
As i mentioned above i used the WorkingWithXml sample code (VB.NET) and i have adjusted in a way to load menu and then on the menu click i load my form.
Please advice
Best RegardsHi Mary,
Put your code between in a Try Catch block. In the Catch part use the following:
oApplication.MessageBox("CompError: " & oCompany.GetLastErrorCode.ToString & ", " & oCompany.GetLastErrorDescription & vbCrLf & "Message: " & ex.Message)
This should give you a clearer idea of what the error is all about.
The most likely reason is that there is something wrong with your XML file.
Regards,
Vítor Vieira -
Illustrator - Maximum allowed size of variable library xml file loaded from variables palette?
Hi-
One question I can’t seem to find the answer to anywhere – any idea on what the maximum size xml file one can use when making data driven graphics in Illustrator?
I can successfully batch when I load a single variable library with about 100 datasets at one time but anything much larger than that in the same xml format gives me a “the incoming variable library is invalid” error. Elsewhere on this discussion forum I have seen answers say there is no limit to the size of the XML file. (http://forums.adobe.com/thread/647934). But my experience with Illustrator CS5 says otherwise.
I have thousands I need to create. Any help would be most appreciated.
1. If there is a maximum size either in file size, number of datasets, or number of variables/values, please share what the limit is.
2. I still need to create thousands of the final document I am creating - if the limit is close to 100 and I need to create many thousands - any suggestions on either scripting or other methods to get this done?
Thanks,
Michaelyey!! now we know 1,000 is not the limit. Tested wiht 2 variables, 1122 data sets.
<v:sampleDataSet dataSetName="1121">
<ZIPPER>
<p>6” ZIPPER</p>
</ZIPPER>
<FLY>
<p>1121</p>
</FLY>
</v:sampleDataSet>
<v:sampleDataSet dataSetName="1122">
<ZIPPER>
<p>6” ZIPPER</p>
</ZIPPER>
<FLY>
<p>1122</p>
</FLY>
</v:sampleDataSet>
</v:sampleDataSets>
</variableSet>
</variableSets>
</svg> -
I have a small .fla file that uses xml files to bring in the
data. It works great. However, if i use a tag such as a <b>
bold </> tag, the file shows up as "null" when i preview the
swf.
Does anyone have any ideas? Is it something to do with the
tags in XML, or how flash reads them?
Any suggestions would be welcomed
ThanksFor instance, i want the "upcoming shows" to be in bold.
Thank you again
<?xml version="1.0" encoding= "UTF-8"
?><products><product>
Upcoming Shows
Dec 1 2007 8:00P
House Show Utah
Dec 12 2007 8:00P
House Show Utah
Dec 28 2007 7:00P
House Show Utah
Jan 6 2008 9:00A
SMCChurch - Draper Draper
Jan 11 2008 8:00P
Park City Bread and Bagel Park City, Utah
Jan 13 2008 10:15A
SMCChurch - Daybreak Daybreak
Jan 20 2008 10:00A
Hidden Valley Presbyterian Draper, Utah
Jan 24 2008 8:00P
University of Utah Salt Lake City, Utah
Feb 1 2008 8:00P
The Refuge San Ramone, California
Feb 16 2008 8:00P
Skifest Brighten
Feb 17 2008 8:00P
Skifest Brighten
Feb 18 2008 8:00P
Skifest Brighten
Nov 26 2008 8:00P
Mt. Olympus Presbyterian Salt Lake City, Utah
</product></products> -
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! -
Loading data from xml file - please help
Hi, I am new to attempting to get data from an xml file load
in flash. I followed a tutorial in a new fla and it seemed to work
fine, I then tried to adapt it to my own needs which worked fine.
But then when trying to implement this into my news section it
doesn't seem to work.
I am trying to make a news section, that displays the date
and news article. This is in within a movie clip, I even tried
putting it in the timeline of the scene but still nothing.
- I have 2 dynamic text boxes, date_txt and news_txt
- The xml file is named news.xml,
- both the fla and the xml are in the same folder
This is the actionscript I am using:
function loadXML(loaded) {
if (loaded) {
_root.thedate =
this.firstChild.childNodes[0].childNodes[0].firstChild.nodeValue;
_root.thenews =
this.firstChild.childNodes[0].childNodes[1].firstChild.nodeValue;
date_txt.text = _root.thedate;
news_txt.text = _root.thenews;
} else {
trace("file not loaded!");
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("news.xml");
This is what I have in the xml document:
<?xml version="1.0"?>
<news>
<article>
<date>date</date>
<news>newentry.</news>
</article>
<article>
<date>Doug Engelbart</date>
<news>Invented the mouse at the Stanford Research
Institute</news>
</article>
</news>
Does anyone perhaps have any ideas of what the problem could
be?
Help much appreciated.Hi
_root refers to the Main Timeline, if your date_txt and
news_txt are in a movieclip ie: news_mc
then your path should read _root.news_mc.date_txt.text and
_root.news_mc.news_txt.text
You will also need to embed the characters you wish to use
inside your dymanic text for it to show.
Hope it helps -
How to write the nodevalue back to xml file?
Hi, Everybody:
These are two packages I used. javax.xml.parsers.*,org.w3c.dom.*
Now I use "setNodeValue("abc") to set the node value to "abc". But it is not really saved back into XML file. It only change the node value in memory.
How to write the changes back to XML file? Thank you very much for your help.
Michelle* Version : 1.00
* File Purpose : Given the xml file loads into dom and recreate the file with the updated values.
* Developer : Kashif Qasim : 25/july/04
* Modify detail :
import java.lang.*;
import java.io.*;
import java.util.*;
import java.text.*;
import org.w3c.dom.*;
import org.apache.xerces.parsers.DOMParser;
import org.apache.xerces.*;
public class XMLWriter
private String displayStrings[] = new String[5000];
private int numberDisplayLines = 0;
private Document document;
//private final Node c;
public synchronized void displayDocument(String uri,Vector UpdatedValues,String getTaskID)
try {
DOMParser parser = new DOMParser();
parser.parse(uri);
document = parser.getDocument();
display(document, "",UpdatedValues);
} catch (Exception e) {
e.printStackTrace(System.err);
ReadXmlConfig objReadXmlConfig = null;
FileWriter filewriter = null;
try {
filewriter = new FileWriter(uri);
for(int loopIndex = 0; loopIndex < numberDisplayLines; loopIndex++){
filewriter.write(displayStrings[loopIndex].toCharArray());
//System.out.println("displayStrings[loopIndex].toCharArray() "+displayStrings[loopIndex].toString());
//filewriter.write("\n");
filewriter.close();
System.gc();
objReadXmlConfig = new ReadXmlConfig();
objReadXmlConfig.ITSLog("File updated for "+getTaskID+" succesfully, file is closed now ");
} catch (IOException e) {
System.err.println("Caught IOException: " + e.getMessage());
objReadXmlConfig = new ReadXmlConfig();
objReadXmlConfig.ITSErrorLog("File updated FAILED for "+getTaskID+". Reason for file error "+e.toString());
}finally {
if (filewriter != null) {
System.out.println("Closing File");
objReadXmlConfig =null;
try{
filewriter.close();
}catch(IOException e){
System.err.println("Caught IOException: " + e.getMessage());
} else {
System.out.println("File not open");
private void display(Node node, String indent, Vector UpdtRecs)
if (node == null) {
return;
int type = node.getNodeType();
NodeList nodeList = document.getElementsByTagName("QueryParm");
int TotalRecs = UpdtRecs.size();
switch (type) {
case Node.DOCUMENT_NODE: {
displayStrings[numberDisplayLines] = indent;
displayStrings[numberDisplayLines] +=
"<?xml version=\"1.0\" encoding=\""+
"UTF-8" + "\"?>";
numberDisplayLines++;
displayStrings[numberDisplayLines] += "\n";
display(((Document)node).getDocumentElement(), "",UpdtRecs);
break;
case Node.ELEMENT_NODE: {
if(node.getNodeName().equals("QueryParm")) {
for(int i =0 ; i< nodeList.getLength() ; i++)
Node nodeQry = nodeList.item(i);
NamedNodeMap nnp = nodeQry.getAttributes();
for(int j= 0 ; j < nnp.getLength() ; j++)
Attr atr = (Attr) nnp.item(j);
if(atr.getName().equalsIgnoreCase("value_"+(i+1)))
//System.out.println(atr.getName() +" : " + atr.getNodeValue() );
atr.setNodeValue(UpdtRecs.get(i).toString());
displayStrings[numberDisplayLines] = indent;
displayStrings[numberDisplayLines] += "<";
displayStrings[numberDisplayLines] += node.getNodeName();
int length = (node.getAttributes() != null) ?
node.getAttributes().getLength() : 0;
Attr attributes[] = new Attr[length];
for (int loopIndex = 0; loopIndex < length; loopIndex++) {
attributes[loopIndex] = (Attr)node.getAttributes().item(loopIndex);
for (int loopIndex = 0; loopIndex < attributes.length; loopIndex++) {
Attr attribute = attributes[loopIndex];
displayStrings[numberDisplayLines] += " ";
displayStrings[numberDisplayLines] += attribute.getNodeName();
displayStrings[numberDisplayLines] += "=\"";
displayStrings[numberDisplayLines] += attribute.getNodeValue();
displayStrings[numberDisplayLines] += "\"";
displayStrings[numberDisplayLines]+=">";
numberDisplayLines++;
NodeList childNodes = node.getChildNodes();
if (childNodes != null) {
length = childNodes.getLength();
indent += " ";
for (int loopIndex = 0; loopIndex < length; loopIndex++ ) {
display(childNodes.item(loopIndex), indent,UpdtRecs);
break;
case Node.CDATA_SECTION_NODE: {
displayStrings[numberDisplayLines] = "";
displayStrings[numberDisplayLines] += "<![CDATA[";
displayStrings[numberDisplayLines] += node.getNodeValue();
displayStrings[numberDisplayLines] += "]]>";
numberDisplayLines++;
break;
case Node.TEXT_NODE: {
displayStrings[numberDisplayLines] = "";
String newText = node.getNodeValue().trim();
if(newText.indexOf("\n") < 0 && newText.length() > 0) {
displayStrings[numberDisplayLines] += newText;
displayStrings[numberDisplayLines] += "\n";
numberDisplayLines++;
break;
case Node.PROCESSING_INSTRUCTION_NODE: {
displayStrings[numberDisplayLines] = "";
displayStrings[numberDisplayLines] += "<?";
displayStrings[numberDisplayLines] += node.getNodeName();
String text = node.getNodeValue();
if (text != null && text.length() > 0) {
displayStrings[numberDisplayLines] += text;
displayStrings[numberDisplayLines] += "?>";
displayStrings[numberDisplayLines] += "\n";
numberDisplayLines++;
break;
if (type == Node.ELEMENT_NODE) {
displayStrings[numberDisplayLines] = indent.substring(0,
indent.length() - 4);
displayStrings[numberDisplayLines] += "</";
displayStrings[numberDisplayLines] += node.getNodeName();
displayStrings[numberDisplayLines] += ">";
displayStrings[numberDisplayLines] += "\n";
numberDisplayLines++;
indent += " ";
public static void main(String args[])
Vector xmlValue = new Vector();
xmlValue.add(0,"Kashif");
xmlValue.add(1,"Qasim");
//displayDocument("NewMediation.xml",xmlValue);
<?xml version="1.0" encoding="UTF-8"?>
<Mediation>
<Task1>
<Source>
<SourceDriver>com.microsoft.jdbc.sqlserver.SQLServerDriver</SourceDriver>
<SourceConnection>jdbc:microsoft:sqlserver://10.2.1.58:1433;DatabaseName=MTCVB_HDS;</SourceConnection>
<SourceUser>sa</SourceUser>
<SourcePassword>sa</SourcePassword>
<Table>
<SourceTable>t_Agent</SourceTable>
<SourceQuery><![CDATA[SELECT SkillTargetID,PersonID,PeripheralID,EnterpriseName,PeripheralNumber,Deleted,TemporaryAgent,AgentStateTrace,ChangeStamp FROM t_Agent where SkillTargetID > {value_1} order by SkillTargetID]]>
</SourceQuery>
<SourceParm BusinessRule="" ColumnName="SKILLTARGETID" ColumnNumber="1" DataType="Numeric" DefaultValue="0" Format="mm/dd/yyyy xx:xx:xx XX">
</SourceParm>
<SourceParm BusinessRule="" ColumnName="PERSONID" ColumnNumber="2" DataType="String" DefaultValue="" Format="">
</SourceParm>
<SourceParm BusinessRule="" ColumnName="PERIPHERALID" ColumnNumber="3" DataType="String" DefaultValue="" Format="">
</SourceParm>
<SourceParm BusinessRule="" ColumnName="ENTERPRISENAME" ColumnNumber="4" DataType="String" DefaultValue="" Format="">
</SourceParm>
<SourceParm BusinessRule="" ColumnName="PERIPHERALNUMBER" ColumnNumber="5" DataType="String" DefaultValue="" Format="">
</SourceParm>
<SourceParm BusinessRule="" ColumnName="DELETED" ColumnNumber="6" DataType="String" DefaultValue="" Format="">
</SourceParm>
<SourceParm BusinessRule="" ColumnName="TEMPORARYAGENT" ColumnNumber="7" DataType="String" DefaultValue="" Format="">
</SourceParm>
<SourceParm BusinessRule="" ColumnName="AGENTSTATETRACE" ColumnNumber="8" DataType="String" DefaultValue="" Format="">
</SourceParm>
<SourceParm BusinessRule="" ColumnName="CHANGESTAMP" ColumnNumber="9" DataType="String" DefaultValue="" Format="">
</SourceParm>
<QueryParm FldName_1="SkillTargetID" FldType_1="Number" value_1="0">
</QueryParm>
</Table>
</Source>
</Task1>
</Mediation>
The QueryParm values are updated thru this code :)
Hope it helps u ... -
Loading xml file into oracle table
Please guide as to how can xml file be loaded into corresponding oracle table.
check out this :
http://blogs.oracle.com/warehousebuilder/2007/09/leveraging_xdb.html
Cheers
Nawneet -
Loading XML files into multiple tables
I've got XML like so...
<?xml version="1.0" encoding="UTF-8"?>
<MainTitle Version="1.0" Date="2009-01-11">
<MainName>
<ID1>A</ID1>
<ID2>ABC</ID2>
<ID3>ABC123</ID3>
<Desc>Some text</Desc>
<feature>f1</feature>
<feature>f2</feature>
<Category>
<name>n1</name>
<attribute>more stuff</attribute>
</Category>
<Category>
<name>n2</name>
<attribute>even more stuff</attribute>
</Category>
<Category>
<name>n3</name>
<attribute>different stuff</attribute>
</Category>
<Category>
<name>n4</name>
<attribute>More of the same<attribute>
<attribute>But different still</attribute>
<attribute>Even more different junk<attribute>
</Category>
</MainName>
</MainTitle>
Where each MainName instance in the file can have 0 or more ( unbounded ) Category and Feature tags and each Category instance can have multiple attribute tags. The file contains many thousands of MainName instances and has embedded a good mix of possible tags.
I believe I can load this into 9i xmltype table or a 9i table with an xmltype column, then query the data to get it out...
SQL> create table mytab (
2 xmlraw XMLType
3 );
Table created.
SQL>
SQL> insert into mytab values ( sys.xmltype.createxml(
2 '<?xml version="1.0" encoding="UTF-8"?>
3 <MainTitle Version="1.0" Date="2009-01-11">
4 <MainName>
5 <ID1>A</ID1>
6 <ID2>ABC</ID2>
7 <ID3>ABC123</ID3>
8 <Desc>Some text</Desc>
9 <feature>f1</feature>
10 <feature>f2</feature>
11 <Category>
12 <name>n1</name>
13 <attribute>more stuff</attribute>
14 </Category>
15 <Category>
16 <name>n2</name>
17 <attribute>even more stuff</attribute>
18 </Category>
19 <Category>
20 <name>n3</name>
21 <attribute>different stuff</attribute>
22 </Category>
23 <Category>
24 <name>n4</name>
25 <attribute>More of the same</attribute>
26 <attribute>But different still</attribute>
27 <attribute>Even more different junk</attribute>
28 </Category>
29 </MainName>
30 </MainTitle>')
31 );
1 row created.
1 select
2 extract(a.xmlraw,'/MainTitle/MainName/ID1/text()'),
3 extract(a.xmlraw,'/MainTitle/MainName/ID2/text()'),
4 extract(a.xmlraw,'/MainTitle/MainName/ID3/text()'),
5 extract(a.xmlraw,'/MainTitle/MainName/Desc/text()'),
6 extract(a.xmlraw,'/MainTitle/MainName/feature/text()'),
7 extract(a.xmlraw,'/MainTitle/MainName/Category/text()'),
8 extract(a.xmlraw,'/MainTitle/MainName/Category/name/text()'),
9 extract(a.xmlraw,'/MainTitle/MainName/Category/attribute/text()')
10* from mytab a
SQL> /
A
ABC
ABC123
Some text
f1f2
n1n2n3n4
more stuffeven more stuffdifferent stuffMore of the sameBut different stillEven
more different junk
This all works just fine, however, it's not quite what I need. For starters, the multiple tag data is concatenated and when I try to specifically query it out using a where clause I get ORA 22950. So, not sure how to deal with that.
Is it possible to use sqlldr to get the 200MB XML file loaded into a table like that above?
Now, given multiple "feature" and "category" data per "MainName", I need to use the SQL to dump the XML data into a set of tables built to model the structure of the XML...
roughly..
Main_Table (
ID1 Varchar2(10)
ID2 varchar2(10)
ID3 varchar2(10)
desc varchar2(100)
Features_Table (
ID1 varchar2(10)
feature varchar2(100)
Category_Table (
ID1 varchar2(10)
name varchar2(100)
attribute varchar2(100)
What are the groups recommendations here? Should I continue down this route or is there a better way?When I suggested the option to parse the XML in PL/SQL I was referring to pulling the data into PL/SQL and then performing all parsing activity against the PL/SQL copy and you don't need to make SQL calls.
Here is a quick sample for parsing out all the Category/name elements from the XML once it is loaded into PL/SQL
DECLARE
l_index PLS_INTEGER;
l_category XMLTYPE;
l_db_row XMLTYPE := XMLTYPE('<?xml version="1.0" encoding="UTF-8"?>
<MainTitle Version="1.0" Date="2009-01-11">
<MainName>
<ID1>A</ID1>
<ID2>ABC</ID2>
<ID3>ABC123</ID3>
<Desc>Some text</Desc>
<feature>f1</feature>
<feature>f2</feature>
<Category>
<name>n1</name>
<attribute>more stuff</attribute>
</Category>
<Category>
<name>n2</name>
<attribute>even more stuff</attribute>
</Category>
<Category>
<name>n3</name>
<attribute>different stuff</attribute>
</Category>
<Category>
<name>n4</name>
<attribute>More of the same</attribute>
<attribute>But different still</attribute>
<attribute>Even more different junk</attribute>
</Category>
</MainName>
</MainTitle>');
BEGIN
l_index := 1;
WHILE l_db_row.Existsnode('/MainTitle/MainName/Category[' ||
To_Char(l_index) || ']') > 0
LOOP
l_category := l_db_row.Extract('/MainTitle/MainName/Category[' ||
To_Char(l_index) || ']');
dbms_output.put_line(l_category.extract('Category/name/text()').getStringVal());
l_index := l_index + 1;
END LOOP;
END;You could repeat the WHILE loop to parse out the attribute column as well since it repeats. This is what Dave's post was showing and what I was referring to.
Hint: If you are trying to use .extract to go after an optional node, you need to verify the node exists via existsNode first. If you don't you can get an "ORA-30625: method dispatch on NULL SELF argument is disallowed" error when trying to extract a non-existent node.
Maybe you are looking for
-
Hi, this is a bit crazy. I am editing a ProRez project and I would consider my MacPro reasonably powerful but when I play for 30 seconds or so the playback goes choppy. I have to stop and start and then get another 30 second chunk playing smoothly
-
How to set an image pattern as backround for a Shape + Copy shapes
1.) Is there any way to set an image as background for a geometry shape (eg. Shapes.AddTriangle) similar like setting a 'Brush#' as background with LDShapes.BrushGradientShape ?? In the image below, eg. the yellow triangle is a rectangular image shap
-
hi, i am working in annual inventory LX15 , in that if i am giving bin range as 01aa00 to 01aa02, in the above range only three bins are there ,but system selected all the bins started with 01.(nearly 4000 bins).....i am checking with other range
-
BADI or EXIT for MIRO - propose quantities
I need a BADI or USER EXIT for TX MIRO so that I could propose the quantities for order posotions before saving (on screen after filling the order). Thanks.
-
Can we use same subscreen area with two tabs in same tabstrip
I have a tabstrip and i want to use same pushbutton for both the tabs. Is it possible