Correction for Nested XML Data Sample
I found an error in the sample code on the
Nested
XML Data Sample under "Using Nested Data Sets." Line 8 has
var dsToppings = new Spry.Data.NestedXMLDataSet(dsItems1,
"toppings");, but it should be
var dsToppings = new Spry.Data.NestedXMLDataSet(dsItems1,
"topping"); in order to match the XML file.
Another suggestion for us newbies would be to have the
samples start with a comment about any additional scripts we need
to insert into our files. It took me a long time to realize I
needed to include
<script type="text/javascript"
src="scripts/SpryNestedXMLDataSet.js"></script> with
the others in the head.
Thanks for your work!
Jonathan
Hi Jonathan,
Thanks for catching that. I corrected the doc and the change
will appear when we release 1.5.
Also, regarding <script> includes sample, yes, we
should definitely be doing that.
Thanks!!!
--== Kin ==--
Similar Messages
-
Hello,
I'm doing my best to create a page in Dreamweaver CS4 utilizing Spry datasets and, I hope, a valid nested XML file. What I want to do is use one XML file that provides the content for my nav div and my content div. It would, in essence, display as an outline. When a user clicks on an item in the nav div the content would be displayed. What I'm guessing would work for the XML file would be this format:
<content>
<topic name="Elements"> //--this would serve as the nav element and trigger
<header>Non-editable</header> //--this would serve as a header in the content area
<info>
<detail id="1">CSS, javascript</detail> //--this would serve as detail under the headers in the content area.
<detail id="2">Headers</detail>
<detail id="3">Footers</detail>
<detail id="4">Areas within navigation panel</detail>
</info>
</topic>
</content>
I got the idea from this page in Live Docs: Create a Spry nested data set. Also from a Labs page called Nested XML Data Sample. I've been able to make various parts of the page work but I don't know what is broken. My issues are this:
I once saw but can no longer find a method for preventing redundant display of data. In this case, the nav elements which are attributes in my XML file.
The details are showing up in my content area. I must be doing the code for the nesting incorrectly.
I want to then use the details in the content area to trigger spry tooltips, the content for whih would be genereated from an XML file or HTML frags.
Here is my latest, ill-fated attempt:
<!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" xmlns:spry="http://ns.adobe.com/spry">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Menu - Content Example</title>
<link href="style.css" rel="stylesheet" type="text/css" />
<script src="SpryAssets/SpryNestedXMLDataSet.js" type="text/javascript"></script>
<script src="SpryAssets/xpath.js" type="text/javascript"></script>
<script src="SpryAssets/SpryData.js" type="text/javascript"></script>
<link href="SpryAssets/SpryStackedContainers.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
<!--
var dsContent5 = new Spry.Data.XMLDataSet("navigation/content5.xml", "content/topic", {useCache: false});
var dsInfo = new Spry.Data.NestedXMLDataSet(dsContent5, "info/detail");
//-->
</script>
</head>
<body>
<div id="wrapper">
<div id="header">
<h1>CSU Website Clinic</h1>
<h3>Bill Milhoan, IS&T Technical Trainer</h3>
</div>
<div id="content" spry:region="dsInfo">
<ul spry:repeatchildren="dsInfo">
<li>{dsContent5::info}</li>
</ul>
</div>
<div class="nav" spry:region="dsContent5">
<ul spry:repeatchildren="dsContent5" spry:choose="">
<li spry:when="{dsContent5::ds_CurrentRowID} == {dsContent5::ds_RowID}" spry:setrow="dsContent5" spry:select="select" spry:hover="hover" spry:selected="">{dsContent5::@name}</li>
<li spry:default="" spry:setrow="dsContent5" spry:select="select" spry:hover="hover">{dsContent5::@name}</li>
</ul>
</div>
</div>
</body>
</html>
Thoughts? My hope is to distill this process so I can teach others how to do it in the hopes that they will find it easier to keep their department/program websites up-to-date.
Thanks for the help.
Bill Milhoan
Cleveland State UniversityI apologize, im using Spry XML Data Set. i guess the best way to describe what im trying to do is, i want to use the Non-desctructive filter sample with the Spry Nested XML Data sample. So with my sample xml on my first post and with the same code non-destructive filter is using, im having trouble trying to search repeating nodes, for some reason it only searches the last node of the repeating nodes. Does that make sense? let me know.
thank you Arnout! -
Using Non-destructive filter with Nested XML data
Hi,
How do you use Non-destructive filter with Nested XML data?
I am using the non-destructive filter sample with my own xml which is setup to search for the <smc></smcs> in my xml below. But when i test it it only searches the last row of the "smc". How can i make it work so it can search for repeating nodes? or does it have something to with how my xml is setup?
<ja>
<url>www.sample.com</url>
<jrole>Jobrole goes here</jrole>
<prole>Process role goes here...</prole>
<role>description...</role>
<prole>Process role goes here...</prole>
<role>description....</role>
<prole>Process role goes here...</prole>
<role>description...</role>
<sjc>6K8C</sjc>
<sjc>6B1B</sjc>
<sjc>6B1F</sjc>
<sjc>6B1D</sjc>
<smc>6C9</smc>
<smc>675</smc>
<smc>62R</smc>
<smc>62P</smc>
<smc>602</smc>
<smc>622</smc>
<smc>642</smc>
<smc>65F</smc>
<smc>65J</smc>
<smc>65L</smc>
<smc>623</smc>
<smc>625</smc>
<smc>624</smc>
<smc>622</smc>
<audience>Target audience goes here....</audience>
</ja>
here is the javascript that runs it.
function FilterData()
var tf = document.getElementById("filterTF");
if (!tf.value)
// If the text field is empty, remove any filter
// that is set on the data set.
ds1.filter(null);
return;
// Set a filter on the data set that matches any row
// that begins with the string in the text field.
var regExpStr = tf.value;
if (!document.getElementById("containsCB").checked)
regExpStr = "^" + regExpStr;
var regExp = new RegExp(regExpStr, "i");
var filterFunc = function(ds, row, rowNumber)
var str = row["smc"];
if (str && str.search(regExp) != -1)
return row;
return null;
ds1.filter(filterFunc);
function StartFilterTimer()
if (StartFilterTimer.timerID)
clearTimeout(StartFilterTimer.timerID);
StartFilterTimer.timerID = setTimeout(function() { StartFilterTimer.timerID = null; FilterData(); }, 100);
I really need help on this, or are there any other suggestions or samples that might work?
thank you!I apologize, im using Spry XML Data Set. i guess the best way to describe what im trying to do is, i want to use the Non-desctructive filter sample with the Spry Nested XML Data sample. So with my sample xml on my first post and with the same code non-destructive filter is using, im having trouble trying to search repeating nodes, for some reason it only searches the last node of the repeating nodes. Does that make sense? let me know.
thank you Arnout! -
Hi there,
I have a problem with displaying some nested XML data. I've
tried quite a lot of different approachey to this, but just can't
get it working properly. So here's the deal:
I have an XML file (which is dynamically created from a
servlet) of the form:
<variations>
<variation>
<name>...</name>
<...>...</...>
<links>
<link>
<type>...</type>
<name>...</name>
</link>
</links>
</variation>
</variations>
On my webpage, I use a Spry tabbed panel with one tab for
each of the 'variation's in the XML file. Within the tabs I have
(many) form fields dynamically filled with the values from the XML
and that all works fine, but I also want to display a table with
one row corresponding to each 'link'... and that just won't work...
My latest approach looks something like this:
<head>
<script type="text/javascript">
<!--
var dsVariations = new
Spry.Data.XMLDataSet("Servlet?id=1&cmd=getVariations",
"variations/variation");
var dsLinks = new
Spry.Data.XMLDataSet("Servlet?id=0&cmd=getLinks",
"links/link");
//-->
</script>
</head>
<body>
<div id="TabbedPanels1" spry:region="dsVariations">
<div id="TP1" class="TabbedPanels">
<ul class="TabbedPanelsTabGroup">
<li spry:repeat="dsVariations" class="TabbedPanelsTab"
tabindex="0">{dsVariations::name}</li>
</ul>
<div class="TabbedPanelsContentGroup">
<div spry:repeat="dsVariations"
class="TabbedPanelsContent">
// a lot of form stuff
<table border="1">
<script type="text/javascript">
dsLinks.setURL("Servlet?id={dsVariations::id}&cmd=getLinks");
dsLinks.loadData();
</script>
<tr spry:repeat="dsLinks">
<td>{dsLinks::type}</td>
<td>{dsLinks::name}</td>
</tr>
</tr>
</table>
</div>
</div>
</body>
In this, the Servlet call with cmd=getVariations returns the
whole XML stated above, while the cmd=getLinks will only get the
corresponding part (everything between <links> and
</links>).
The error message I get for this is: processTokens() failed
to get a data set context!.
I previously tried to use a NestedXMLDataSet, but couldn't
get that working either... I'm really kind of stuck by now and
would appreciate any help.
Thanks,
Florian
PS Thanks a lot for creating Spry: It's great!Thanks for your reply, Cristian.
I'm afraid I couldn't do that since it would cause the whole
region to be reloaded constantly (because it's being updated each
time I do the setURL / loadData)... in fact, I tried this before
and it didn't work.
But, in fact, I figured that the fact that I could not get it
running using a NestedXMLDataSet (as I would generally prefer), did
not actually come down to a problem in the page source code, but
actually to a problem with the very XML itself:
I tried to recreate the simple nested data set example (
http://labs.adobe.com/technologies/spry/samples/data_region/NestedDataSample.html)
and basically used the same code and an almost identical XML
structure... yet it doesn't work. The contents of dsFeatures just
won't be displayed and when I'm inspecting the contents of
dsFeatures (using Firebug) it shows me that the dataset is empty. I
just don't get why it works for your example, but not for my
modified version... I can't see any crucial difference :-s.
To simplify the problem I deleted most tags from the XML and
saved it in a static document "variations.xml":
<variations>
<variation>
<name>Var 1</name>
<features>
<feature>none</feature>
<feature>feat1</feature>
<feature>feat2</feature>
</features>
</variation>
<variation>
<name>Var 2</name>
<features>
<feature>none</feature>
</features>
</variation>
</variations>
The source of the test page would be:
<!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"
xmlns:spry="
http://ns.adobe.com/spry">
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1" />
<title>Nested Data Sample</title>
<script language="JavaScript" type="text/javascript"
src="SpryAssets/xpath.js"></script>
<script language="JavaScript" type="text/javascript"
src="SpryAssets/SpryData.js"></script>
<script language="JavaScript" type="text/javascript"
src="SpryAssets/SpryNestedXMLDataSet.js"></script>
<script type="text/javascript">
var dsVariations = new Spry.Data.XMLDataSet("variations.xml",
"/variations/variation");
var dsFeatures = new Spry.Data.NestedXMLDataSet(dsVariations,
"features/feature");
</script>
</head>
<body>
<table border="1">
<tr>
<th width="30%"
onclick="dsVariations.sort('name');">dsVariations</th>
<th width="30%"
onclick="dsFeatures.sort('link')">dsFeatures</th>
<th width="30%">dsVariations + dsFeatures</th>
</tr>
<tr>
<td valign="top"><div
spry:region="dsVariations">
<ul>
<li spry:repeat="dsVariations" spry:select="select"
spry:hover="hover" spry:setrow="dsVariations"> {name}
</li>
</ul>
</div></td>
<td valign="top"><div spry:region="dsFeatures">
<ul>
<li spry:repeat="dsFeatures"> {dsFeatures::feature}
</li>
</ul>
</div></td>
<td valign="top"><div spry:region="dsVariations
dsFeatures">
<ul>
<li spry:repeat="dsVariations"> {dsVariations::name}
<ul>
<li
spry:repeat="dsFeatures">{dsFeatures::feature}</li>
</ul>
</li>
</ul>
</div></td>
</tr>
</table>
</body>
Evidently, I'm missing some essential simple point here...
Thanks, -
Using Multiple Subpaths - question about nested XML data
Hello.
I am in the process of getting my head around the nested XML data that is one layer deeper than I know how to handle - ultimately I would like to populate a Spry MenuBar from the static XML file.
Updates & revisions to the menu would be done by simply uploading a new XML file to the server whenever something needs changed.
The problem I am having is in regard to more than one subpath.
I can successfully get the "Menuheading" and the "items" to show but the "subitems" that should attach to the "items" are nowhere to be found. Once this is figured out, I will begin building my menu.
I'm not getting an XML error when testing in Safari (Mac OS 10.5.8)
I thing my problem lies here in the head section of the page - obviously somewhere in the subPaths area:
<script type="text/javascript">var dsItems1 = new Spry.Data.XMLDataSet("MenuXML.xml", "/menu/menuitem", { subPaths: [ "items/item", "subitem" ] });
and here in the body section at subitem:
<tr spry:repeat="dsItems1">
<td>{@id}</td>
<td>{menuheading}</td>
<td>{items/item}</td>
<td>{subitem}</td>
</tr>
==================================================
The end result I would like rendered in the menu is:
==================================================
Menuheading
---- Item (hyperlink)
---- Item (hyperlink)
---- Item (hyperlink)
---- Item
------- sub submenu item (hyperlink)
Menuheading
---- Item
------- sub submenu item (hyperlink)
------- sub submenu item (hyperlink)
------- sub submenu item (hyperlink)
---- Item (hyperlink)
---- Item (hyperlink)
---- Item (hyperlink)
...and so on.
I have attached both files in their entirety at the bottom of the post in hopes someone can help.
==================================================
Here is the relevant HTML
==================================================
<head>
<script language="JavaScript" type="text/javascript" src="includes/xpath.js"></script>
<script language="JavaScript" type="text/javascript" src="includes/SpryData.js"></script>
<script language="JavaScript" type="text/javascript" src="includes/SpryNestedXMLDataSet.js"></script>
<script type="text/javascript">var dsItems1 = new Spry.Data.XMLDataSet("MenuXML.xml", "/menu/menuitem", { subPaths: [ "items/item", "subitem" ] });</script>
</head>
<body>
<div spry:region="dsItems1">
<table class="dataTable">
<tr>
<th width="62">Menu ID</th>
<th width="171">Menu Heading</th>
<th width="257">Menu Items</th>
<th width="257">Submenu Items</th>
</tr>
<tr spry:repeat="dsItems1">
<td>{@id}</td>
<td>{menuheading}</td>
<td>{items/item}</td>
<td>{subitem}</td>
</tr>
</table>
</div>
</body>
==================================================
A representative snippet of the XML is shown here:
==================================================
<?xml version="1.0" encoding="UTF-8"?>
<menu>
<menuitem id="0001" type="Aboutus">
<menuheading>About Us</menuheading>
<items>
<item id="0011">Welcome to MHBS</item>
<item id="0021">History</item>
<item id="0031">Mission</item>
<item id="0041">Accreditation</item>
<item id="0051">Directions</item>
<item id="0061">Calendar</item>
<item id="0071">Board of Directors</item>
<subitem id="0111">Meet the Board</subitem>
<item id="0081">FAQs</item>
</items>
</menuitem>
<menuitem id="0002" type="Academics">
<menuheading>Academics</menuheading>
<items>
<item id="0012">Meet the Faculty</item>
<item id="0022">Elementary</item>
<item id="0032">Middle School</item>
<item id="0042">High School</item>
<item id="0052">Academic Achievements</item>
<subitem id="0251">Test Scores</subitem>
<subitem id="0252">College Acceptance</subitem>
<item id="0062">Accelerated Reading</item>
<item id="0072">Summer Reading</item>
<item id="0082">Guidance and Counseling</item>
</items>
</menuitem>
... and on and on ...
</menu>
Should I be doing something with the Spry.Data.NestedXMLDataSet instead?
If so, how do I implement that?
many thanks in advanceYes, you should be using the nested dataset instead.
Did you read: http://labs.adobe.com/technologies/spry/samples/data_region/NestedXMLDataSample.html ? -
Designing a 'sample time feed' for Spry XML Data Set
Hi!
Often when I call a Spry XML Data Set I find I can't get the
schema. If offers you the option to design a sample time feed but
doesn't give you enough info to be able to even guess how to do
this.
Is the answer in modifying that php line somehow?
Any guidance would be much appreciated!
MikeThe idea for Design Time XML is that you can use a static XML
file instead of a dynamic source, in case you don't have access to
the real data. You can use the Design Time XML to make the query
and design the page.
This gives you access to the data references for designing
the page.
If you are getting schema errors, the numbers that the dialog
shows is the line number and character number (1,1)
You should be able to see the XML directly in the browser. If
you can, then DW should be able to consume it. -
I've read the various entries and have ensured the column is
defined to have HTML content, but in IE7 & Spry 1.6 the content
provided through the NestedXMLDataSet is not being interpreted as
HTML, whereas the content from the XMLDataSet is interpreted
correctly. I reduced the xml data and the page to its most
simplistic:
e.g.
var dsNursery = new
Spry.Data.XMLDataSet("data/nursery_template.xml", "/events/event");
var dsItems = new Spry.Data.NestedXMLDataSet(dsNursery,
"items");
dsNursery.setColumnType("heading", "html");
dsItems.setColumnType("content", "html");
<body>
<div id="container">
<div id="sidebar1">
<ul id="MenuBar1" class="MenuBarVertical"
spry:region="dsNursery dsItems">
<li spry:repeat="dsNursery" spry:setrow="dsNursery">
<a class="MenuBarItemSubmenu" href="#"
spry:if="{dsItems::ds_RowCount} > 1">{heading}</a>
<a href="#" spry:if="{dsItems::ds_RowCount} ==
1">{heading}</a>
<ul spry:if="{dsItems::ds_RowCount} > 1">
<li spry:repeat="dsItems" spry:setrow="dsItems"><a
href="#">{dsItems::item}</a></li>
</ul>
</li>
</ul>
<!-- end #sidebar1 --></div>
<div id="mainContent">
<div id="MenuBar1Detail" spry:detailregion="dsNursery
dsItems">
<div id="content">{dsItems::content}
{heading}</div> <----------------------- "content" is not
interpreted, but "heading" is.
</div>
<!-- end #mainContent --></div>
<script type="text/javascript">
Spry.Data.Region.addObserver('MenuBar1',{onPostUpdate:function(){var
MenuBar1 = new Spry.Widget.MenuBar("MenuBar1");}});
</script>
</body>
</html>
XML file is:
<?xml version="1.0" encoding="utf-8"?>
<events>
<event>
<heading><![CDATA[<strong>heading
1</strong>]]></heading>
<items>
<item >item 1</item>
<content ><![CDATA[<strong>content
1</strong>]]></content>
</items>
</event>
</events>
Any assistance is gratefully appreciated.Hi fcc770,
I fixed the setColumnType problem for nested data sets after
we shipped Spry 1.6. You can find a version with the bug fix here:
http://labs.adobe.com/technologies/spry/includes/SpryNestedXMLDataSet.js
The header at the top of the JS file should read version 0.4
or greater.
Let me know if that fixes your problem.
--== Kin ==-- -
Transfer of nested XML data to BW
Hi there Experts
I am trying to transfer XML data to BW. I have done the worked example in the How to send XML Data to BW document and its all working fine.
The problem with the example is that the data is in a flat format without any nested loops. So for one Vendor 4711 and two materials gizmo and widgets the data structure essentially looks like this:
<DATA>
<item>
<VENDOR>4711</VENDOR>
<MATERIAL>gizmo</MATERIAL>
</item>
<item>
<VENDOR>4711</VENDOR>
<MATERIAL>widget</MATERIAL>
</item>
<DATA>
Now, since we have a fair bit of data, rather than creating one new line (item) for each combination of VENDOR and MATERIAL we want to set up a nested structure in XML that can be read in BW, something along the lines of
<DATA>
<item>
<VENDOR>4711</VENDOR>
<MATERIAL>gizmo</MATERIAL>
<MATERIAL>widget</MATERIAL>
</item>
<DATA>
Unfortunately, all attempts have failed so far to create such a structure and admittedly I know very little about XML to begin with. Any ideas?
Thanks and greetings from Hamburg!
ChristianHi ,
You mentioned that you have sucessfully configured to load the XML data into BW.
Even I also tried to configure by refering to the "How to" document, but am not sucessfull. Could you please help me in this regard.
I configured the .dll files, but still am getting the
error "Automation server can't create the object".
Could you send me the step by step procedure..
The operating system we are using is the Windows XP.
Even i searched the SDN, couple of them replied, its not sucessfull.
Thanks in Advance,
Prathima Suram -
Script for parsing xml data and inserting in DB
Thank you for reading.
I have the following example XML in an XML file. I need to write a script that can insert this data into an Oracle table. The table does not have primary keys. The data just needs to be inserted.
I do not have xsd file in this scenario. Please suggest how to modify Method 1 https://community.oracle.com/thread/1115266?tstart=0 mentioned so that I can call the XML mentioned below and insert into a table
Method 1
Create or replace procedure parse_xml is
l_bfile BFILE;
l_clob CLOB;
l_parser dbms_xmlparser.Parser;
l_doc dbms_xmldom.DOMDocument;
l_nl dbms_xmldom.DOMNodeList;
l_n dbms_xmldom.DOMNode;
l_file dbms_xmldom.DOMNodeList;
l_filen dbms_xmldom.DOMNode;
lv_value VARCHAR2(1000);
l_ch dbms_xmldom.DOMNode;
l_partname varchar2(100);
l_filename varchar2(1000);
l_temp VARCHAR2(1000);
TYPE tab_type IS TABLE OF tab_software_parts%ROWTYPE;
t_tab tab_type := tab_type();
BEGIN
l_bfile := BFileName('DIR1', 'SoftwareParts.xml');
dbms_lob.createtemporary(l_clob, cache=>FALSE);
dbms_lob.open(l_bfile, dbms_lob.lob_readonly);
dbms_lob.loadFromFile(dest_lob => l_clob, src_lob => l_bfile, amount => dbms_lob.getLength(l_bfile));
dbms_lob.close(l_bfile);
dbms_session.set_nls('NLS_DATE_FORMAT','''DD-MON-YYYY''');
l_parser := dbms_xmlparser.newParser;
dbms_xmlparser.parseClob(l_parser, l_clob);
l_doc := dbms_xmlparser.getDocument(l_parser);
dbms_lob.freetemporary(l_clob);
dbms_xmlparser.freeParser(l_parser);
l_nl := dbms_xslprocessor.selectNodes(dbms_xmldom.makeNode(l_doc),'/PartDetails/Part');
FOR cur_emp IN 0 .. dbms_xmldom.getLength(l_nl) - 1 LOOP
l_n := dbms_xmldom.item(l_nl, cur_emp);
t_tab.extend;
dbms_xslprocessor.valueOf(l_n,'Name/text()',l_partname);
t_tab(t_tab.last).partname := l_partname;
l_file := dbms_xslprocessor.selectNodes(l_n,'Files/FileName');
FOR cur_ch IN 0 .. dbms_xmldom.getLength(l_file) - 1 LOOP
l_ch := dbms_xmldom.item(l_file, cur_ch);
lv_value := dbms_xmldom.getnodevalue(dbms_xmldom.getfirstchild(l_ch));
if t_tab(t_tab.last).partname is null then t_tab(t_tab.last).partname := l_partname; end if;
t_tab(t_tab.last).filename := lv_value;
t_tab.extend;
END LOOP;
END LOOP;
t_tab.delete(t_tab.last);
FOR cur_emp IN t_tab.first .. t_tab.last LOOP
if t_tab(cur_emp).partname is not null and t_tab(cur_emp).filename is not null then
INSERT INTO tab_software_parts
VALUES
(t_tab(cur_emp).partname, t_tab(cur_emp).filename);
end if;
END LOOP;
COMMIT;
dbms_xmldom.freeDocument(l_doc);
EXCEPTION
WHEN OTHERS THEN
dbms_lob.freetemporary(l_clob);
dbms_xmlparser.freeParser(l_parser);
dbms_xmldom.freeDocument(l_doc);
END;
<TWObject className="TWObject">
<array size="240">
<item>
<variable type="QuestionDetail">
<questionId type="String"><![CDATA[30]]></questionId>
<questionType type="questionType"><![CDATA[COUNTRY]]></questionType>
<country type="String"><![CDATA[GB]]></country>
<questionText type="String"><![CDATA[Please indicate]]></questionText>
<optionType type="String"><![CDATA[RadioButton]]></optionType>
<answerOptions type="String[]">
<item><![CDATA[Yes]]></item>
<item><![CDATA[No]]></item>
</answerOptions>
<ruleId type="String"><![CDATA[CRP_GB001]]></ruleId>
<parentQuestionId type="String"></parentQuestionId>
<parentQuestionResp type="String"></parentQuestionResp>
</variable>
</item>
<item>
<variable type="QuestionDetail">
<questionId type="String"><![CDATA[40]]></questionId>
<questionType type="questionType"><![CDATA[COUNTRY]]></questionType>
<country type="String"><![CDATA[DE]]></country>
<questionText type="String"><![CDATA[Please indicate]]></questionText>
<optionType type="String"><![CDATA[RadioButton]]></optionType>
<answerOptions type="String[]">
<item><![CDATA[Yes]]></item>
<item><![CDATA[No]]></item>
</answerOptions>
<ruleId type="String"><![CDATA[CRP_Q0001]]></ruleId>
<parentQuestionId type="String"></parentQuestionId>
<parentQuestionResp type="String"></parentQuestionResp>
</variable>
</item>
</array>
</TWObject>Reposted as
Script to parse XML data into Oracle DB -
Help required in building up the Java Bean for an XML data
Hi ,
I want to build a Java bean which will actually represent an xml data . The class will be named as User and it will typically represent the data in the follwing xml:
<user>
<cwsId>barbete</cwsId>
<firstName>William</firstName>
<lastName>Barber</lastName>
<status>true</status>
<role>
<roleCode>1000000177</roleCode>
<roleName>Customer Administrator</roleName>
</role>
<language>en</language>
<country>US</country>
<preferences>
<equipmentGroup>2717</equipmentGroup>
<dateFormat>MON-dd-yyyy</dateFormat>
<timeFormat>HH:MI AM</timeFormat>
<timeZone>-12:00</timeZone>
<daylightSavings>Y</daylightSavings>
<location>NC</location>
<recordsPerPage>10</recordsPerPage>
<historyPeriod>3</historyPeriod>
<distanceUnit>MILE</distanceUnit>
<fuelUnit>G</fuelUnit>
<unitIdDisplay>E</unitIdDisplay>
<smuUpdate>W</smuUpdate>
<countries>
<country>
<countryCode>GB</countryCode>
<countryName>UNITED KINGDOM</countryName>
</country>
<country>
<countryCode>US</countryCode>
<countryName>UNITED STATES</countryName>
</country></countries>
</preferences>
</user>
Now for single child nodes like cwsId of the main user node i have kept properties like
private String cwsId;
But i am not sure as to how to represent the nodes which contain subnodes like "preferences"node. Any ideas?What is the standard practice?One thing you could do is create an object model first, which will contain all the data for your user.
then all you need in the bean is a Hashtable with the name of the user as a key, and the user-object (which is actually the complete object model) as a value.
with the XML stated by you, you would get an object model something like this:
Class User
String cwsid;
String firstName;
ArrayList<Role> roles = new ArrayList<Role>(); //I'm assuming a user can have more then one role.
ArrayList<Country> countries = new ArrayList<Country>();
class Role {
String code;
String name;
class Country {
String code;
String name;
}And so on for all the varioous elemets of your XML. -
Report design for hierarchical xml data
I need to create a report that shows hierarchical xml data. I already have an xml saved to a database. How would I go bout creating a design for such a report? Should I be doing groups on every parent with children? Any example?
ThanksHi markgoldin,
I tested the issue in my local machine by following steps:
1. Created a table and store the xml into the table with the following query:
CREATE TABLE xmlTbl (id INT, xmlVal xml);
INSERT INTO xmlTbl values(1,
'<Customers>
<Customer ID="11">
<FirstName>Bobby</FirstName>
<LastName>Moore</LastName>
</Customer>
<Customer ID="20">
<FirstName>Crystal</FirstName>
<LastName>Hu</LastName>
</Customer>
</Customers>'
2. Created a stored procedure to retrieve data from the table with the following query:
create procedure xml_report
as
DECLARE @xmlDoc XML;
SELECT @xmlDoc = xmlVal FROM xmlTbl WHERE id=1;
SELECT T.c.value('(@ID)','int') AS ID,
T.c.value('(FirstName[1])','varchar(99)') AS firstName,
T.c.value('(LastName[1])','varchar(99)') AS lastName
FROM @xmlDoc.nodes('/Customers/Customer') T(c)
GO
3. In the Report Data pane, right-click Data Sources and click Add Data Source.
4. For an embedded data source, verify that Embedded connection is selected. From the Type drop-down list, select a data source type; for example, Microsoft SQL Server or OLE DB. Type the connection string directly or click Edit to open the Connection
Properties dialog box and select Server name and database name from the drop down list.
5. For a shared data source, verify that Use shared data source reference is selected, then select a data source from the drop down list.
6. Right-click DataSets and click Add Dataset, type a name for the dataset or accept the default name, In Data source, select the name of an existing shared data source, select StoredProcedure in Query type, then select xml_report from stored procedure
name drop down list.
7. In the Toolbox, click Table, and then click on the design surface.
8. Drag the Date field from the dataset to the cells in the table.
The following screenshot is for your reference:
For more information about how to use the xml data type methods, please refer to the following document:
http://msdn.microsoft.com/en-us/library/ms190798.aspx
If you have any more questions, please feel free to ask.
Thanks,
Wendy Fu -
Problem creating nested xml data using XSQLServlet
Hi,
This is sort of a sql question.
I'm trying to create a nexted xml data file.
The data in a rows format can be had using the
following query...
SELECT username, portlet_name, count(instance_name) as
INSTANCE_COUNT
FROM portlet_user_subscriptions
GROUP BY username, portlet_name
to get is back in a hierrachical format, I tried the
following...
SELECT distinct(username) as USERNAME,
CURSOR (
SELECT portlet_name, count(instance_name) as
NUM_INSTANCES
FROM portlet_user_subscriptions T2
WHERE T2.username=USERNAME
GROUP BY portlet_name ) AS PORTLETS
FROM portlet_user_subscriptions T1
But, that is running the CURSOE for every username in the
other loop when it should be doing it only for distinct
usernames.
What am I doing wrong here...
cheers,
VijayHow you store the data in the database?
Basically, you can query the database with XSQL(<xsql:query/>)
to get the output in XML. Then you can use XSLT to transform it
to the format you want.
<?xml-stylesheet type="text/xsl" href="doyouxml.xsl" ?>
... -
Using XSU for Storing XML data
Please how can I use the XSU API for storing XML documents in Oracle8i? I know part of the code to store a document but how do I import the XSU API?
Do I have to download it or use it via Oracle?
example:
String xmlDoc = "my_xml_document";
Connection conn = >>DriverManager.getConnection(...);
OracleXMLSave sav = new OracleXMLSave
(conn,"purchaseOrderTab");
sav.insertXML(xmlDoc);But how do I use OracleXMLSave? How do I import the XSU API?
thanks for your help
nullWhat is XSU? I think you question should be posted at the XML or XDK forum.
-
Format URL for Spry XML Data Set
I've searched and searched the forums to no avail, but please
link me to the solution if already posted.
I want to create a Spry data set where one of the fields is
simply an URL such as:
<name><a href="
http://www.aim-us.org/">African
Inland Mission</a></name>
I want the name to appear in the list as a hyperlink. I'd
sincerely appreciate anyone straightening me out on the correct XML
format to accomplish this. Thanks!The idea for Design Time XML is that you can use a static XML
file instead of a dynamic source, in case you don't have access to
the real data. You can use the Design Time XML to make the query
and design the page.
This gives you access to the data references for designing
the page.
If you are getting schema errors, the numbers that the dialog
shows is the line number and character number (1,1)
You should be able to see the XML directly in the browser. If
you can, then DW should be able to consume it. -
How to use cursor function for nested xml
Hi,
i have a query for XMLQuery like
select * from bills where bill_id=????
it results in something like
<bills>
<bill>
<city>london</city>
<amount>44</amount>
</bill>
<bill>
<city>london</city>
<amount>988</amount>
</bill>
<bill>
<city>new york</city> <amount>59</amount> </bill>
</bills>
but i want xml output to be sorted for city names adding one more level location like
<bills>
<location city="london">
<bill>
<amount>44</amount>
</bill>
<bill>
<amount>988</amount> </bill>
</location>
<location city="new york">
<bill>
<amount>59</amount> </bill>
</location>
</bills>
it should be possible to iterate through the same table to gather informaton with the help of cursor function, but never used CURSOR before.
any idea?sreese wrote:
p_desig works as a comma delimited string without the NVL function, that's not the issue.
It IS the issue .. you need to provide a SAMPLE so we can see what you're doing ..
How are you "passing it in" ?
option A:
procedure ( in_var in VARCHAR2 )
AS
and nvl(sn.c_attribute1,'x@#$%') in nvl(in_var,'x@#$%')
option B:
and nvl(sn.c_attribute1,'x@#$%') in nvl(&1,'x@#$%')
.. or some other method?
Maybe you are looking for
-
What is the need of Infotypes in HR ABAP?
Hi Friends, I am kumar, I am under traing in HR ABAP. So plz tell me why we have to use infotypes without info types is it not possible to code? I want to know these things. Plz tell me. bye kumar
-
Web service Task - Value pair as variable issue
firstly .. I not an .net Developer. We have scenario in which I have a execute SQL task which sends a set of rows with two columns as an variable (object) to a for each loop container.The for each loop container has the web service task and each ti
-
Search/Smart/Spotlight Mailboxes Won't Find URLs in HTML?!
For example, I want to find all the emails in a very large mailbox +(or all of them)+ containing a certain URL somewhere within them. Dozens of emails contain links with the URL of interest, but when I search for something like: http://www.domain.com
-
Query on step by step pulling of data
Hi friends, We have a query where we need to know the steps by which data has to be pulled in the CRM system from R/3 system for replication. Process I: 1. Firstly pull data of the sales area and sales offices and secondly the HR org structure for CR
-
KDE 4.5.1 lacking kxkb
Hello, I think that KDE 4.5.1 is missing this program. At least there is no such binary- I updated everything yesterday. Is it on purpose or by mistake? Could I use different keyboard switching tool from KDE? I am not interested in setxkbmap etc. Tha