Manipulating the XML dataset
Hello,
I have loaded an xml dataset from an XML file and I have used
the code below to manipulate the dataset.
if (ds.getDataWasLoaded())
var rows = ds.getData();
for (var i = 0; i < rows.length; i++)
rows
= "Changed";
How do i reflect this on the page?
I have tried to use ds.loadData(); but it loads the original
data of the page and not the manipulated data.
Thank you
Hi there Kinblas,
Here is my code:
<?xml version="1.0" encoding="iso-8859-1"?>
<items>
<item>
<name>room</name>
<id>999</id>
<pid>256</pid>
</item>
<item>
<name>Wallet</name>
<id>123</id>
<pid>999</pid>
</item>
<item>
<name>Coins</name>
<id>234</id>
<pid>123</pid>
</item>
<item>
<name>Notes</name>
<id>345</id>
<pid>123</pid>
</item>
<item>
<name>pencil case</name>
<id>000</id>
<pid>999</pid>
</item>
<item>
<name>pencil</name>
<id>111</id>
<pid>000</pid>
</item>
<item>
<name>pen</name>
<id>222</id>
<pid>000</pid>
</item>
<item>
<name>ruler</name>
<id>333</id>
<pid>000</pid>
</item>
<item>
<name>rubber</name>
<id>444</id>
<pid>000</pid>
</item>
</items>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01
Transitional//EN"
http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
<title>Untitled Document</title>
<script language="JavaScript" type="text/javascript"
src="../../spry_15/includes/xpath.js"></script>
<script language="JavaScript" type="text/javascript"
src="../../spry_15/includes/SpryData.js"></script>
<script language="JavaScript" type="text/javascript"
src="../../spry_15/includes/SpryDebug.js"></script>
<script language="JavaScript" type="text/javascript">
var dsItem = new Spry.Data.XMLDataSet("spry.xml",
"/items/item[id='999']", { useCache: true});
var dsItemsChildren = new Spry.Data.XMLDataSet("spry.xml",
"/items/item[pid='{dsItem::id}']", { useCache: true});
var dsItemsSiblings = new Spry.Data.XMLDataSet("spry.xml",
"/items/item[pid='{dsItem::pid}']", { useCache: true});
function selectItem(id) {
xpath = "/items/item[id=" + id + "]";
dsItem.setXPath(xpath);
function doSort() {
dsItem.sort("name", "toggle");
function doChange() {
if (dsItem.getDataWasLoaded()) {
var rows = dsItem.getData();
var rows1 = dsItemsChildren.getData();
var rows2 = dsItemsSiblings.getData();
for (var i = 0; i<rows.length ; i++) {
if (rows
["name"]=="rubber") {
rows["name"]="eraser";
for (var i = 0; i<rows1.length ; i++) {
if (rows1
["name"]=="rubber") {
rows1["name"]="eraser";
for (var i = 0; i<rows2.length ; i++) {
if (rows2
["name"]=="rubber") {
rows2["name"]="eraser";
Spry.Data.updateAllRegions();
</script>
</head>
<body>
<ul spry:region="dsItem">
<li spry:repeat="dsItem">Selected Item:
{name}</li>
</ul>
items Siblings
<ul spry:region="dsItemsSiblings">
<li spry:repeat="dsItemsSiblings"><a href='#'
onClick="selectItem({id});">{name}</a></li>
</ul>
Items Children
<ul spry:region="dsItemsChildren">
<li spry:repeat="dsItemsChildren"><a href='#'
onClick="selectItem({id});">{name}</a></li>
</ul>
<input value="Sort" type="button" onClick="doSort();">
<input value="Change" type="button"
onClick="doChange();">
</body>
</html>
When I click on sort, it fires off doSort which finds all
occurences of 'rubber' and changes them to eraser, but when
clicking on the links which result in setting the xpath, the cache
is not used but the original xml is used and the word 'rubber'
reappears.
I hope this make it clear.
Thanks
Similar Messages
-
XML dataset doesn't change in detail area
Thanks in advance for any help you might be able to lend...
My accordion layout has five panels all of which are using
different XML datasets. I have been wracking my brain to figure out
how to have multiple master data regions filter into one detail
region - I have one setup correctly, but when I change the focus on
the accordion menu, the other XML data is not displayed in the
detail region.
I understand why they do not populate, but I cannot figure
out what to include to have all data regions filter into the detail
area.
Thanks again in advance!
http://www.cateringlyons.com/menus.php"luke14free" <[email protected]> wrote in
message
news:f3bdm8$gsu$[email protected]..
> I am a new AJAX spry developer and i would like to ask
you a question.
> I have done a code that modifies the content of an xml
file after user
> writes
> something in a box. The code works(is written in php)
and my problem is
> that:
> the xml dataset in the page doesn't refresh. I mean if I
add something to
> the
> xml file the page isn't affected by the changes and
continues to display
> the
> old xml-data. I checked manually the xml file and it's
correctly writed
> and
> closed, and the file has the right permiossions. Can you
tell me why?
http://livedocs.adobe.com/en_US/Spry/1.4/WS95A48911-209C-4075-A90A-4FB06F6DAAA4.html
Massimo Foti, web-programmer for hire
Tools for ColdFusion and Dreamweaver developers:
http://www.massimocorner.com -
Open Dataset for XML not reading the XML file, Returning Code 8.
Dear all,
Im trying to open an XML file using Open Dataset, since i have to execute this report in background and GUI_upload doesnt work in background.
The XML file is available in my C:\, say, C:\xmlfile.xml.
But the open dataset is not reading any value into the g_xml_line . it is returning sy-subrc = 8.
Below is my code for that, can anybody help me out to resolve.
DATA : lv_filename LIKE rlgrap-filename.
CLEAR: lv_filename.
lv_filename = p_input.
OPEN DATASET lv_filename FOR INPUT IN BINARY MODE.
IF sy-subrc ne 0.
WRITE:/ 'invalid file'.
else.
DO.
READ DATASET lv_filename INTO g_xml_line.
IF sy-subrc EQ 0.
APPEND g_xml_line TO g_xml_table.
ELSE.
EXIT.
ENDIF.
ENDDO.
CLOSE DATASET lv_filename.
ENDIF.
TYPES: BEGIN OF t_xml_line,
data(256) TYPE x,
END OF t_xml_line.
DATA: g_xml_table TYPE TABLE OF t_xml_line,
g_xml_line TYPE t_xml_line,
g_xml_table_size TYPE i.
GET REFERENCE OF gt_person INTO gs_result_xml-value.
gs_result_xml-name = 'IPIX'.
APPEND gs_result_xml TO gt_result_xml.
Perform the XSLT stylesheet
TRY.
CALL TRANSFORMATION zaum_manh_sync_rpt
SOURCE XML g_xml_table
RESULT (gt_result_xml).
CATCH cx_root INTO gs_rif_ex.
gs_var_text = gs_rif_ex->get_text( ).
MESSAGE gs_var_text TYPE 'E'.
ENDTRY.
Kindly suggest me a solution. Points assured
regs,
rajaAfter saving the file , below is the code i wrote, but it gives a runtime error with message
No roll storage space of length 3788808 available for internal storage.
***Coding****
PARAMETERS: p_file TYPE pathintern LOWER CASE DEFAULT '/usr/sap/DEV/SYS/global/XMLABAP2.XML'.
DATA : lv_filename LIKE rlgrap-filename.
CLEAR: lv_filename.
lv_filename = p_file.
DATA: l_fname TYPE filename-fileintern. " File name
*GET THE FILENAME FROM THE APPLICATION SERVER
CALL FUNCTION '/SAPDMC/LSM_F4_SERVER_FILE'
EXPORTING
directory = p_file
filemask = '*'
IMPORTING
serverfile = l_fname
EXCEPTIONS
canceled_by_user = 1
OTHERS = 2.
IF sy-subrc NE 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
*/usr/sap/DEV/SYS/global/substanc
lv_filename = l_fname.
OPEN DATASET lv_filename FOR INPUT IN BINARY MODE.
IF sy-subrc NE 0.
WRITE:/ 'invalid file'.
ELSE.
DO.
READ DATASET lv_filename INTO g_xml_line.
IF sy-subrc EQ 0.
APPEND g_xml_line TO g_xml_table.
ELSE.
EXIT.
ENDIF.
ENDDO.
CLOSE DATASET lv_filename.
ENDIF. -
How to reuse xml dataset in the file
Hi,
I want to reuse the xmldataset in the different select box
for filtering, but I don't want to read the xmldataset everytime.
I don't want to load and read the data 2 or more times.
Here is my code
var dsProjects = new Spry.Data.XMLDataSet("abc.xml",
"items/item");
var dsDepartments = new Spry.Data.XMLDataSet("abc.xml",
"items/item/cat" , { distinctOnLoad: true, sortOnLoad: "cat" });
abc.xml:
<Items>
<item>
<name>Cool A</name>
<cat>A Cat</cat>
<location>Here</location>
</item>
<item>
<name>Cool b</name>
<cat>A Cat</cat>
<location>THere</location>
</item>
<item>
<name>Cool c</name>
<cat>B Cat</cat>
<location>Here</location>
</item>
</itemS>
<span spry:region="dsStates" id="StateSelector">
<select name="Region_filter"
onChange="dsProjects.filter(filterFunc)">
<option value="">--Location--</option>
<option spry:repeat="dsStates" value="{cat}"
>{cat}</option>
</select>
</span>Hi,
When processing the data sets, Spry looks to see if the XML
source URL is the same. If so, it only calls for the XML file once,
and then builds the data set objects from that one request.
Was that your concern? or did I miss the real issue?
Thanks,
Don -
Spry Menu Using Nested XML Dataset (Spry 1.6)
I have a vertical menu with a few items. One of which is
labeled Products which has submenus. I want to have that submenu
read from a Nested XML dataset. Using a single dataset for one
level in a menu is easy enough, but the subenu will have submenus.
Example Menu:
Home
Company
Products
|-- Product 1
|-- Item 1
|-- Item 2
|-- Item 3
|-- Product 2
|-- Item 1
|-- Item 2
|-- Product 3
|-- Item 1
|-- Item 2
|-- Item 3
|-- Item 4
|-- Product 4
|-- Item 1
|-- Item 2
|-- Product 5
I have been looking for an easy way to use the Spry Nested
XML Dataset to create the Product/Item menu. The number of Products
may vary as well as the number of Items in each Product submenu
(also, some Products may not have Items).
I already have an ASP page that creates the XML data from a
database.
Schema follows (XSD ):
<?xml version="1.0" encoding="utf-8"?>
<xsd:schema xmlns:xsd="
http://www.w3.org/2001/XMLSchema">
<xsd:element name="products">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="product_type"
maxOccurs="unbounded">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="type_name" maxOccurs="1"
type="xsd:string"/>
<xsd:element name="type_url" maxOccurs="1"
type="xsd:anyURI"/>
<xsd:element name="product_name"
maxOccurs="unbounded">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="item_name" maxOccurs="1"
type="xsd:string"/>
<xsd:element name="item_url" maxOccurs="1"
type="xsd:anyURI"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
I have been programming for 17 years but am new to Spry. If
this cannot be done easily with the Spry framework, I'll probably
wind up splitting the XML data into 2 files (Products and Items)
then writing a nested loop and call each by row, but then I have to
find out how Spry Datasets reference XML data. Figuring out how to
call rows from the XML data shouldn't be so bad, but this method
just seems like such a hassle for something that should be easy.
Pseudocode follows:
j=1
i=1 to TotalNumberProducts
display Product i from Products
ItemsExist=true
While ItemsExist
if j > TotalNumberItems | Item j is not for Product then
ItemsExist=false
else
display Item j from Items
j++
Wend
Next
Thanks in advance for any help or direction!That's exactly what I'm trying to do. However, I implemented
that code and the submenus won't appear. I suspect the submenus
aren't finding the field names from the Nested XML Dataset. The
first level of Product menus work great (this is a submenu of the
overall menu) and correctly identify products that do not have
submenus, so I know it's picking up the number of records in the
Nested Dataset correctly - it just won't display the data in the
next level of menu.
variable and script declarations:
<script src="SpryAssets/SpryMenuBar.js"
type="text/javascript"></script>
<script src="SpryAssets/xpath.js"
type="text/javascript"></script>
<script src="SpryAssets/SpryData.js"
type="text/javascript"></script>
<script src="SpryAssets/SpryNestedXMLDataSet.js"
type="text/javascript"></script>
<link href="SpryAssets/SpryMenuBarVertical.css"
rel="stylesheet" type="text/css">
<script type="text/javascript">
<!--
var productMenuData = new
Spry.Data.XMLDataSet("products.asp", "products/product_type");
var productMenuDataItems = new
Spry.Data.NestedXMLDataSet(productMenuData, "product_name");
//-->
</script>
Code for menus:
<ul id="NavMenu" class="MenuBarVertical">
<li><a
href="index.html">Home</a></li>
<li><a
href="company.html">Company</a></li>
<li><a href="franco_giberti.html">Franco
Giberti</a></li>
<li><a class="MenuBarItemSubmenu"
href="products.asp">Products</a>
<ul spry:region="productMenuData
productMenuDataItems">
<li spry:repeat="productMenuData"><a
class="MenuBarItemSubmenu" href="{type_url}"
spry:if="{productMenuDataItems::ds_RowCount} !=
0">{type_name}</a> <a href="{type_url}"
spry:if="{productMenuDataItems::ds_RowCount} ==
0">{type_name}</a>
<ul spry:if="{productMenuDataItems::ds_RowCount} !=
0">
<li spry:repeat="productMenuDataItems"><a
href="{productMenuDataItems::item_url}">{productMenuDataItems::item_name}</a></li>
</ul>
</li>
</ul>
</li>
<li><a href="contact.html">Contact Us</a>
<!-- end #sidebar1 -->
</li>
</ul>
XML:
<products
xsi:noNameSpaceSchemaLocation="products.xsd">
−
<product_type>
<type_name>Pasta Sauce</type_name>
<type_url>pt_2.asp</type_url>
−
<product_name>
<item_name>Putenesca</item_name>
<item_url>pn_3.asp</item_url>
</product_name>
−
<product_name>
<item_name>Arrabiata</item_name>
<item_url>pn_4.asp</item_url>
</product_name>
−
<product_name>
<item_name>Pesto</item_name>
<item_url>pn_5.asp</item_url>
</product_name>
−
<product_name>
<item_name>Basil and Tomato</item_name>
<item_url>pn_6.asp</item_url>
</product_name>
−
<product_name>
<item_name>Bolognese</item_name>
<item_url>pn_7.asp</item_url>
</product_name>
−
<product_name>
<item_name>Carboniera</item_name>
<item_url>pn_8.asp</item_url>
</product_name>
</product_type>
+
<product_type>
<type_name>Organic Olive Oil</type_name>
<type_url>pt_3.asp</type_url>
−
<product_name>
<item_name>Original</item_name>
<item_url>pn_9.asp</item_url>
</product_name>
−
<product_name>
<item_name>Basil</item_name>
<item_url>pn_10.asp</item_url>
</product_name>
−
<product_name>
<item_name>Herbs</item_name>
<item_url>pn_11.asp</item_url>
</product_name>
−
<product_name>
<item_name>Sun Dried Tomato</item_name>
<item_url>pn_12.asp</item_url>
</product_name>
</product_type>
+
<product_type>
<type_name>Organic Spreads</type_name>
<type_url>pt_4.asp</type_url>
−
<product_name>
<item_name>Putenesca</item_name>
<item_url>pn_13.asp</item_url>
</product_name>
−
<product_name>
<item_name>Arrabiata</item_name>
<item_url>pn_14.asp</item_url>
</product_name>
−
<product_name>
<item_name>Pesto</item_name>
<item_url>pn_15.asp</item_url>
</product_name>
−
<product_name>
<item_name>Basil and Tomato</item_name>
<item_url>pn_16.asp</item_url>
</product_name>
−
<product_name>
<item_name>Bolognese</item_name>
<item_url>pn_17.asp</item_url>
</product_name>
−
<product_name>
<item_name>Carboniera</item_name>
<item_url>pn_18.asp</item_url>
</product_name>
</product_type>
+
<product_type>
<type_name>Organic Grilled Vegetables</type_name>
<type_url>pt_5.asp</type_url>
−
<product_name>
<item_name>Putenesca</item_name>
<item_url>pn_19.asp</item_url>
</product_name>
−
<product_name>
<item_name>Arrabiata</item_name>
<item_url>pn_20.asp</item_url>
</product_name>
−
<product_name>
<item_name>Pesto</item_name>
<item_url>pn_21.asp</item_url>
</product_name>
−
<product_name>
<item_name>Basil and Tomato</item_name>
<item_url>pn_22.asp</item_url>
</product_name>
−
<product_name>
<item_name>Bolognese</item_name>
<item_url>pn_23.asp</item_url>
</product_name>
−
<product_name>
<item_name>Carboniera</item_name>
<item_url>pn_24.asp</item_url>
</product_name>
</product_type>
−
<product_type>
<type_name>Truffle Products</type_name>
<type_url>pt_6.asp</type_url>
</product_type>
</products>
Any further guidance would be very much appreciated! -
Help in loading the xml file using AS 2.0
Hi
I try to load the Xml file in As file but i need do all the
fetching details from the __LoadXmlFile file function
but it's working fine can any one help me for this issue
~~SkYou can't! Well, at least Flex cannot do this. All Flex can
do is send this data -- any data -- to the server and it's up to
you how you want to append this data to a file on the server.
You see, flex can't write to local files. If you looking for
client side file manipulation, take a look at Flex's desktop
brother call AIR!
ATTA -
XML Dataset - Sorting non english characters
I've been playing with spry on a production site for more
than a year now. It's turned out to be a great solution in many
situations in spite of being a beta release.
I've found an issue concerning the sorting of text data (in
this case, coming from an XML file). You can find the example page
here:
http://mi.esan.edu.pe/elecciones/2008/electores/.
It's in Spanish but i guess you won't need a translation to
understand what's going on; besides you can always check the source
code if so you wish.
Works fine, though I still have some polishing to do. The
most important part of which is fixing the sort order that spry
gives me by default.
If you click on the "go to last page link" (»), located
below the table/dataset area, you will see that after letter Z come
the words, in this case last names, starting with letter A, but
with a tilde on them. I've devised a workaround, but that requires
creating an extra column with everything converted to only English
characters. My list is already 4000 records long and takes a few
seconds to load. It's definitely going to get much longer in the
years to come and I wish I will be able to give my users the
ability to sort by any column they wish. So, I can't just be adding
columns and duplicating data all around.
Is there a way to tell spry that Á should be sorted as
if it was A (not after A, not before it, and definitely not at the
end of the list), that Ñ should come right after N, and so on?
I will very much appreciate your answer.
Regards,
JoseThank you very much for your reply, Kin.
Sad thing that there wasn't a solution, though.
But, then I guess you must be aware that spry is being used
and will be used by a huge ammount of non English speaking clients
of Adobe. Namely those of us that have Spanish, French, German,
Japanese, Chinese or any other as their primary language. And all
of us would greatly appreciate a not so English-centered solution,
for such a commonplace feature as sorting is.
Given this situation, what chances do you think there are
that Adobe will be developping the necessary language specific
plugins for spry's sorting capabilities? And, how soon would that
be?
In the meantime, I will start trying to do it myself. It
would be fantastic if you coukd give me any hints on how to start,
javascript is not my strongest point but I think I can crack it out
and have a little fun while I'm at it, too.
Regards,
Jose -
Need to update the xml clob-pls pls help!
my xml is stored as blob, i can view,do string manipulation and churn out data etc...but now i have a request where i need to find some particualr node and modify its value.
here is what i m doing now which works.
select compressor2.blob_decompress2(xml_data) into l_blob
from tablename where id=2008890;
clob_data := utl2.blob2clob(l_blob);
parser := xmlparser.newParser;
xmlparser.parseClob(parser, clob_data);
doc := xmlparser.getDocument(parser);
nl := xmldom.getElementsByTagName(doc, '*');
len := xmldom.getLength(nl);
dbms_output.put_line('Length : ' || len);
tag_name := 'Node Verson : ' || xmldom.getVersion(doc)|| '<br>';
for counter in 0..len-1
loop
tag_name := '';
node := xmldom.item(nl, counter);
parent_node := xmldom.getParentNode(node);
child_node := xmldom.getfirstchild(node);
tag_name := 'Parent Name : ' || xmldom.getNodeName(parent_node) || '<br>';
tag_name := tag_name || 'Node Name : ' || xmldom.getNodeName(node) || '<br>';
IF xmldom.getNodeType(child_node) = xmldom.TEXT_NODE THEN
tag_name := tag_name || 'Node Value : ' || xmldom.getNodeValue(child_node)|| '<br>';
ELSE
tag_name := tag_name || 'Node Value : Node has child.No Node value.' || '<br>';
END IF;
tag_name := tag_name || 'Node Type : '||xmldom.getNodeType(child_node) || '<br>';
ele_name := xmldom.getDocumentElement(doc);
child_nl := xmldom.getElementsByTagName(ele_name,'*');
IF xmldom.isNull(doc) THEN
htp.p('Document is null');
ELSE
htp.p(tag_name);
END IF;
end loop;
b_blob := utl.clob2blob(tag_name);
select compressor2.blob_compress2(b_blob) into b_blob2 from dual;
insert into xupdate values (2008890,b_blob2);
i still need to know how to update the xml clob... i want to know how to find the particular node and then modify the clob with the new value. rest i can update the table.
pls pls help..on this.my oracle version.
10.2.0.1.0
i want to update here..
<?xml version="1.0" encoding="utf-8"?>
<TestData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Status>CompletedNormally</TestCompletionStatus>
<ComputerName>DUILT10</ComputerName>
<StartTime>2008-03-19T15:12:23</StartTime>
---Some more noded----
<Parameters>
<RangeMeasured>
<Name>PDissBol-5[C]</Name>
<Min>1.22</Min>
<Max>1.36</Max>
<Units>W</Units>
</RangeMeasured>
<TextMeasured>
<Name>ComputerName</Name>
<Value>DUILT10</Value>
</TextMeasured>
<RangeMeasured>
<Name>TrackError25[C]To-5[C]</Name>
<Min>0.031</Min>
<Max>0.041</Max>
<Units>dB</Units>
</RangeMeasured>
<RangeMeasured>
<Name>Power-5[C]</Name>
<Min>1.988</Min>
<Max>1.061</Max>
<Units>dBm</Units>
</RangeMeasured>
---some more noded---
</Parameters>
</TestData>
the file is huge.
what i need to chang==>
I 1st need to find this PDissBol-5[C] within the <Parameters> Node and then change its <Min> and <Max>
and then update the table.
pls pls suggest. -
Ghosts in the Spry Dataset Wizard
I've been struggling all day with a very peculiar problem. I have a php file with the "Recordset to XML" server behavior applied. I also created an XML file from this. Then, on another page, I tried to make a dataset, taking the information from the php file and using the xml file for the design time feed. I also put a table in the page. But everytime, when I came out of the wizard, it replaced the path to the source php file with a path to the xml file. I would then change it in the code of the page and open up the dataset wizard and it would have changed the source file to the xml file! I've gone round and round. And yet, although I've done this before but now successfully, I cannot stop the dataset wizard from changing it today.
I've even gone to the code and changed the source file to what is correct and then uploaded the file but it still can't find the the source - and when I get back to DreamWeaver, I see that the dataset wizard has changed the source file back to the xml file again.
I've been struggling with this for 9 hours and am giving up in disgust. If anyone can help, I would be so grateful!Hi Ben,
Yes, I can which makes it even weirder!! It's just so strange that the dataset wizard just recodes the page no matter what I do.
What I get now when I come to the page that should have the dataset (and this is something new) is the headers on the spry table but no data.
Another thing is that when I created the xml from the php page, I just chose two of the fields to export. And yet when I am using this as a design feed, it sees all of the fields from the recordset so it doesn't seem like it really is using the local xml file as a design feed since that has only the two fields. Maybe I should go through and not filter out the fields when I create the xml from the php and just filter in the table. Although that shouldn't be the problem. And I still don't know why no matter what I input into the dataset wizard, it will change the code to something else when I exit it. -
Changing the xml encoding from UTF-8 to ISO-8859-1
Hi,
I have created an xml file in xMII transaction that I feed into a webservice as input. As of now, the data in the xml file is entirely english text (it would be changing to have European text soon). I gave the encoding as UTF-8.
I get an error on the webservice side(not xMII code) that the its not able to parse. The error is 'SaxParseException: Invalid 1 of 1-byte UTF-8 sequence). I know that an easy fix is if tI change the encoding to iso-8859-1.
But the reference document doesnot let me put anythign other than UTF-8. Even if I put <?xml version="1.0" encoding="iso-8859-1"?> as the first line, when I save it and open it back, i see <?xml version="1.0" encoding="UTF-8"?>
Is there any way to change the encoding? Or better still, anyway idea why this invalid sequence is coming from?
Thanks,
Ravi.Hi Ravi,
We have encountered scenarios where we needed to take the <?xml version="1.0" encoding="UTF-8"?> out completely. As xMII was providing the Web Service, it needed a workaround.
In your case, it seems that you wish to pass it from xMII to an external Web Service provider. One option might be to pass the XML document as string.
Once you convert it to a string, it may escape all XMl characters (i.e. '<' into '<'). You could perform a string manipulation and remove the <?xml version="1.0" encoding="UTF-8"?> from the string. You may also need to play around with xmlDecode( string ) function in the Link Editor.
I would suggest that before you try this option, create a string variable will the contents, but without the <?xml version="1.0" encoding="UTF-8"?> and try assigning it to the input.
You may also wish to try a string variable that has <?xml version="1.0" encoding="iso-8859-1"?> as the first line. If this works, you should be able to perform string manipulations to convert your XML document into this modified string.
Cheers,
Jai. -
XML dataset stucks in rendering on html page
Hi
When i choose a test.xml file with 'insert - spry dataset', 'datatype xml', the datapreview in the 'set data options' window display the data correctly.
In the 'choose insert options' i choose 'insert table'. I don't use the setup button there, leaving it to default settings, and click 'done'.
Seems to be correct.
In the design window, the columnheaders are displayed, with the fields name between brackets, like below:
Datum Inhoud Link
{datum} {inhoud} {link}
the values are not visible in designview.
But in liveview, the page is completely blank.
I'm not hosting it yet on a testsite. Just trying out how to insert XML data in a HTML file.
According to the tutotials it should work - but it doesn't...
the pieces of code in the html that were automatically added:
<script src="file:///C|/Users/Frank Buurman/AppData/Roaming/Adobe/Dreamweaver CS4/en_US/Configuration/Temp/Assets/eamA7B0.tmp/xpath.js" type="text/javascript"></script>
<script src="file:///C|/Users/Frank Buurman/AppData/Roaming/Adobe/Dreamweaver CS4/en_US/Configuration/Temp/Assets/eamA7B0.tmp/SpryData.js" type="text/javascript"></script>
</p>
<div spry:region="ds1">
<table>
<tr>
<th spry:sort="datum">Datum</th>
<th spry:sort="inhoud">Inhoud</th>
<th spry:sort="link">Link</th>
</tr>
<tr spry:repeat="ds1">
<td>{datum}</td>
<td>{inhoud}</td>
<td>{link}</td>
</tr>
</table>
</div>
<p> </p>
</div>
Could you please help me out ?
tnx a lot !I have no testing server yet.
The hourglas is in Dreamweaver itself, when rendering the xml sprite - not in a browser.
Attached is a testing html (with associated css and js files) in wich i tried to insert the xml.
When i tried the same on a blank html page (in the same dir), the spry table insertion works fine .
But not within the contentarea of this index.html.
Could it be because of the 'accordion.js' ?
Or the css ?
I really have no idea...
tnx
(ps i've left out the images folder) -
Hi,
I've created a PHP page with a recordset consisting of joined tables. I've then exported it as XML. When I am on my main page and attempting to create an XML dataset, as I have done successfully before, when I click on "Get Schema" I get the exception "Type:UTFDataFormat Exception". I don't know why. I haven't had this before.
I have viewed my original PHP page with the recordset and I see all the information there, so I don't think there should be a problem.
Am I missing something?You know, I've got this problem again. I think the last time, I took out some special text characters - like the french e with an accent and the swedish o with a line through it, and then it worked. I hate to do that since it is an international site. And now I'm having this exception error again and I'm not sure why.
Any ideas of what I should look for? This time it is not an XML file created from a joined recordset - it's a simply recordset.
Very frustrating. -
Regarding the rowset and row tags in the XML output
Hi,
We generated an XML file using dataset of type SQL query.The output is including additional tags
<ROWSET> and <ROW> tags.How to disable them from appearing in the XML output.Hi,
Iam not using the Datamodel of data template type.If we use the data template we can disable the rowtags by setting the property mentioned by you.But we get the data template name and the query name included in the output.My requirement is to disable the extratags.
Can u please provide inputs on how to disable the datatemplate name and the query name tags in the output when we use datatemplate.Thank you. -
C# load xml data with attributes to datagridview; update data and save back to the xml
Hi guys,
i currently have this XML as data
<DEALS>
<DEAL ID="22" ISBN="0-7888-1623-3" Screenplay="Mary Kaplan" Title ="Mr Gentleman" Director = "Jonathan Jones">
<ALLOCATION DEMANDE="5000" CODE="72" PRICE="25.00">2500</ALLOCATION>
<ALLOCATION DEMANDE="7000" CODE="75" PRICE="35.00">4000</ALLOCATION>
</DEAL>
<DEAL ID="23" ISBN="1-7988-1623-3" Screenplay="Joe Doe" Title ="Nothing Much" Director = "Listentome">
<ALLOCATION DEMANDE="3300" CODE="72" PRICE="15.00">2500</ALLOCATION>
</DEAL>
</DEALS>
I load the data with the code below:
i use xDocument to load the DealData.xml and then put it in ToString.
//outside of the form
public static class XElementExtensions
public static DataTable ToDataTable(this XElement element)
DataSet ds = new DataSet();
string rawXml = element.ToString();
ds.ReadXml(new StringReader(rawXml));
return ds.Tables[0];
public static DataTable ToDataTable(this IEnumerable<XElement> elements)
return ToDataTable(new XElement("Root", elements));
//in the form
private void button2_Click(object sender, EventArgs e)
var xDocument = XDocument.Load("DealData.xml");
string txtxml = xDocument.ToString();
StringReader reader = new StringReader(txtxml);
XDocument doc1 = XDocument.Load(reader);
var res = doc1.Descendants("DEAL").ToList().Where(x => x.Attribute("ID").Value == "22").Descendants("ALLOCATION");
dataGridView1.DataSource = res.ToDataTable();
Now my question is:
I would like to update the data from the DataGridview with the Attribute("ID").Value == "22" and save the data back to the XML.
For example, after I load my data on the datagridview, we only pickup anything that is in the node
<DEAL ID="22" ISBN="0-7888-1623-3" Screenplay="Mary Kaplan" Title ="Mr Gentleman" Director = "Jonathan Jones">
<ALLOCATION DEMANDE="5000" CODE="72" PRICE="25.00">2500</ALLOCATION>
<ALLOCATION DEMANDE="7000" CODE="75" PRICE="35.00">4000</ALLOCATION>
</DEAL>
I updated the datagridview below with DEMANDE = 9000 CODE = 66 PRICE = 24.77 AND ALLOCATION = 1200
I want be able to extract the data back in the xml as a child of the DEAL ID = "22"
So that the XML file looks like this
<DEALS>
<DEAL ID="22" ISBN="0-7888-1623-3" Screenplay="Mary Kaplan" Title ="Mr Gentleman" Director = "Jonathan Jones">
<ALLOCATION DEMANDE="5000" CODE="72" PRICE="25.00">2500</ALLOCATION>
<ALLOCATION DEMANDE="7000" CODE="75" PRICE="35.00">4000</ALLOCATION>
<ALLOCATION DEMANDE="9000" CODE="66" PRICE="24.77">1200</ALLOCATION> <-! this is the new line !->
</DEAL>
<DEAL ID="23" ISBN="1-7988-1623-3" Screenplay="Joe Doe" Title ="Nothing Much" Director = "Listentome">
<ALLOCATION DEMANDE="3300" CODE="72" PRICE="15.00">2500</ALLOCATION>
</DEAL>
</DEALS>
Is there a way to achieve that?
I have been searching and reading in the books but i cannot find a solution for this.
Thank you
Please do not forget to click “Vote as Helpful” if the reply helps/directs you toward your solution and or "Mark as Answer" if it solves your question. This will help to contribute to the forum.I would think of something like the below, the id is passed as static you need to change this
protected virtual void button1_Click(object sender, EventArgs e)
//Get DataTable from DGV datasource
DataTable dt = new DataTable();
dt = (DataTable)dataGridView1.DataSource;
string file1 = "<?xml version=\"1.0\" encoding=\"utf-8\" ?><DEALS><DEAL ID=\"22\" ISBN=\"0-7888-1623-3\" Screenplay=\"Mary Kaplan\" Title =\"Mr Gentleman\" Director = \"Jonathan Jones\"><ALLOCATION DEMANDE=\"5000\" CODE=\"72\" PRICE=\"25.00\">2500</ALLOCATION><ALLOCATION DEMANDE=\"7000\" CODE=\"75\" PRICE=\"35.00\">4000</ALLOCATION></DEAL><DEAL ID=\"23\" ISBN=\"1-7988-1623-3\" Screenplay=\"Joe Doe\" Title =\"Nothing Much\" Director = \"Listentome\"><ALLOCATION DEMANDE=\"3300\" CODE=\"72\" PRICE=\"15.00\">2500</ALLOCATION></DEAL></DEALS>";
StringReader reader = new StringReader(file1);
XDocument doc1 = XDocument.Load(reader);
//Remove all elements related to the id being populated into the Grid
doc1.Descendants("DEAL").ToList().Where(x => x.Attribute("ID").Value == "22").Descendants("ALLOCATION").Remove();
//loop through datatable and create new xelement to be added to the xdocument
foreach (DataRow dr in dt.Rows)
XElement xe = new XElement("ALLOCATION",
new XAttribute("DEMANDE", dr[0].ToString()),
new XAttribute("CODE", dr[1].ToString()),
new XAttribute("PRICE", dr[2].ToString()));
xe.Value = dr[3].ToString();
doc1.Descendants("DEAL").ToList().Where(x => x.Attribute("ID").Value == "22").FirstOrDefault().Add(xe);
Fouad Roumieh -
How to display the xml content into my datagrid
Hi Experts,
i have created a webservice for sales quotation through DI-Server.iam able to add a new sales quotation through my coding & iam able to get the sales quotation based on the DOcEntry in an *XML file*.
The xml file that i got using DOCENTRY is in this way:--
<?xml version="1.0" encoding="utf-8" ?>
- <BOM>
- <BO>
- <AdmInfo>
<Object>oRecordset</Object>
</AdmInfo>
- <OQUT>
- <row>
<DocEntry>8</DocEntry>
<DocNum>8</DocNum>
<DocDate>20080715</DocDate>
<DocDueDate>20080815</DocDueDate>
<CardCode>C0003</CardCode>
<CardName>HP India</CardName>
<DocTotal>14500.000000</DocTotal>
<ItemCode>A00006</ItemCode>
<Dscription>HP Officejet 7310 All-in-One</Dscription>
<Quantity>1.000000</Quantity>
<Price>14500.000000</Price>
<Currency>INR</Currency>
<DiscPrcnt>10.000000</DiscPrcnt>
<LineTotal>14500.000000</LineTotal>
</row>
</OQUT>
</BO>
</BOM>
Now the problem is from this xml content i should display the values in my datagrid like:
DocEntryCardCodeDocDueDateItemCodeDscriptionQtyTotal
8--C000320081116--A00006-HP-off jet-2 --- 1000
can anybody suggest me some ideas that how to get the SPECIFIED values into my datagrid...........
regards,
shangai.hi vincent,
Thanks for your reply.iam unable to understand these lines in your code..iam working in vb.net
public static DataSet GetDataSetFromXML(XmlNode XMLNode)
grid.DataSource = GetDataSetFromXML(Result.SelectSingleNode(xpath_string));
this is my coding....it's throwing an error when i declare like this
Public Sub GetDataSetFromXML(ByVal XmlNode)
Dim ds As New DataSet
Dim reader As XmlNodeReader
reader = New XmlNodeReader(XmlNode)
ds.ReadXml(reader)
reader.Close()
'Return ds --->(error with syntax)
End Sub
DataGrid1.DataSource = GetDataSetFromXML(oXmlReply.SelectSingleNode("//DocDueDate"))
DataGrid1.DataBind()
regards,
shangai
Maybe you are looking for
-
Disable loop purchase ... how
How do I disable the constant 'opportunity' to buy loops? I wanted the convieniently available' loops to be hidden ... not just greyed out ... is that possible?
-
Schedule a webi report to email issue
Hi, A webi report was scheduled to run and send exel file to email one time. The instance is in a status of "Running" for more than 24 hours. When checked the instance details, it said "waiting for scheduling to complete. Job ID: 15,786, name:[Report
-
Difference in report FS10 and S_ALR_87012004
Hi Gurus, I have asset account which is CWIP asset, and I do APC in this asset and also AIAB in this.? I have following questions on this account Difference in report FS10 and S_ALR_87012004 Why this report have difference? What are the possiblity of
-
How can I open a database object for view or edit using a command in Oracle SQL Deveveloper? I find browsing or search for object in a large database to be slow and too cumbersome.
-
We are attempting to use the PHP scripts (version 1.1) designed by Aaron Axelsen of University of Wisconsin - Whitewater (http://omega1.uww.edu/itunesu) to help facilitate authentication to iTunes U. We're bouncing credentials off our AD via PHP and