I am trying to get an output/file like this (below) in an XML file
(MyXmlFile.xml) (which I will use for a slide show)
--
<gallery timer="3" order="sequenti al" fadetime="2" looping="yes" xpos="0"
ypos="0">
<image path="images2/Test1.jpg" />
<image path="images2/Test2.jpg" />
<image path="images2/Test3.jpg" />
<image path="images2/Test4.jpg" />
<image path="images2/Test5.jpg" />
<image path="images2/Test6.jpg" />
</gallery>
--
When I use this XML file (written by hand), I can get the Flash slide show
to work, provided that the jpgs are in the correct folder....
So, now I want to generate the slide choices automatically from SQL, so I
added a table called StoreSlideShow, and added a key column, a StoreID
column, and a column called ImagePath.
I filled in the data, and wrote the SPROC
CREATE PROCEDURE [dbo].[GetSlideShowsBy Store3]
@StoreID int
AS
SELECT dbo.Stores.Stor eID, dbo.StoreSlideS how.ImagePath
FROM dbo.Stores INNER JOIN
dbo.StoreSlideS how ON dbo.Stores.Stor eID = dbo.StoreSlideS how.StoreID GO
----------------------
When I use the WriteXML command, etc..., it creates the following xml
document: (MyXmlFile3.xml )
<NewDataSet>
<Table>
<StoreID>1</StoreID>
<ImagePath>imag es2/Test1.jpg</ImagePath>
</Table>
<Table>
<StoreID>1</StoreID>
<ImagePath>imag es2/Test2.jpg</ImagePath>
</Table>
<Table>
<StoreID>1</StoreID>
<ImagePath>imag es2/Test3.jpg</ImagePath>
</Table>
....etc...
<Table>
<StoreID>2</StoreID>
<ImagePath>imag es2/Test1.jpg</ImagePath>
</Table>
</NewDataSet>
The data is correct, BUT - my dilemma- how do I get this output to match the
output/format above?
**TIA,** 2 2510
Paolo,
Is there anything that you are selecting from the database that is part
of the <gallery> element? If so, you could very easily write a SQL
statement with the FOR XML AUTO clause and let SQL Server return XML in
the format you need to.
Unfortunately, in order for FOR XML AUTO to work you need at least one
attribute from the Stores table to work. Would your flash code break if
there was an extra attribute? If not you could write a statement like:
SELECT gallery.StoreID as id, '3' as timer, 'sequential' as order, '2'
as fadetime, 'yes' as looping, '0' as xpos, '0' as ypos, image.ImagePath
as 'path' FROM Stores gallery INNER JOIN StoreSlideShow image ON ... FOR
XML AUTO
And then execute the results via the ExecuteXmlReade r() method on the
SqlCommand.
Again, for this to work you have to select at least on item in the
result set from the Stores table, otherwise you can't get the <gallery>
element in the response. I hope that an extra element will not throw off
your flash code.
If you can't go with that, then you could process the results with an
XSLT. It would go something like that (off the top of my head without
being able to validate it right now):
<xs:template match='/'>
<gallery timer="3" order="sequenti al" fadetime="2" looping="yes"
xpos="0" ypos="0">
<xs:apply-templates />
</gallery>
</xs:template>
<xs:template match='table'>
<image>
<xs:attribute name='path'><xs :value-of
select='ImagePa th'/></xs:attribute>
</image>
</xs:template>
HTH,
Christoph Schittko
MVP XML http://weblogs.asp.net/cschittko -----Original Message----- From: Paolo Pignatelli [mailto:Pa***@Do tNetStore.com] Posted At: Friday, December 17, 2004 7:15 AM Posted To: microsoft.publi c.dotnet.xml Conversation: Changing format of XML Doc (using WriteXML?) Subject: Changing format of XML Doc (using WriteXML?)
I am trying to get an output/file like this (below) in an XML file (MyXmlFile.xml) (which I will use for a slide show)
--
<gallery timer="3" order="sequenti al" fadetime="2" looping="yes"
xpos="0" ypos="0">
<image path="images2/Test1.jpg" />
<image path="images2/Test2.jpg" />
<image path="images2/Test3.jpg" />
<image path="images2/Test4.jpg" />
<image path="images2/Test5.jpg" />
<image path="images2/Test6.jpg" />
</gallery>
--
When I use this XML file (written by hand), I can get the Flash slide
show to work, provided that the jpgs are in the correct folder....
So, now I want to generate the slide choices automatically from SQL,
so I added a table called StoreSlideShow, and added a key column, a StoreID column, and a column called ImagePath.
I filled in the data, and wrote the SPROC
CREATE PROCEDURE [dbo].[GetSlideShowsBy Store3]
@StoreID int
AS
SELECT dbo.Stores.Stor eID, dbo.StoreSlideS how.ImagePath
FROM dbo.Stores INNER JOIN
dbo.StoreSlideS how ON dbo.Stores.Stor eID = dbo.StoreSlideS how.StoreID
GO ----------------------
When I use the WriteXML command, etc..., it creates the following xml
document: (MyXmlFile3.xml )
<NewDataSet>
<Table>
<StoreID>1</StoreID>
<ImagePath>imag es2/Test1.jpg</ImagePath>
</Table>
<Table>
<StoreID>1</StoreID>
<ImagePath>imag es2/Test2.jpg</ImagePath>
</Table>
<Table>
<StoreID>1</StoreID>
<ImagePath>imag es2/Test3.jpg</ImagePath>
</Table>
...etc...
<Table>
<StoreID>2</StoreID>
<ImagePath>imag es2/Test1.jpg</ImagePath>
</Table>
</NewDataSet>
The data is correct, BUT - my dilemma- how do I get this output to
match the output/format above?
**TIA,**
THANK YOU.
Let me go and work on this, and I may (probably will,) ask more questions.
Paolo
"Christoph Schittko [MVP]" <IN**********@a ustin.rr.com> wrote in message
news:#o******** ******@TK2MSFTN GP09.phx.gbl... Paolo,
Is there anything that you are selecting from the database that is part of the <gallery> element? If so, you could very easily write a SQL statement with the FOR XML AUTO clause and let SQL Server return XML in the format you need to.
Unfortunately, in order for FOR XML AUTO to work you need at least one attribute from the Stores table to work. Would your flash code break if there was an extra attribute? If not you could write a statement like:
SELECT gallery.StoreID as id, '3' as timer, 'sequential' as order, '2' as fadetime, 'yes' as looping, '0' as xpos, '0' as ypos, image.ImagePath as 'path' FROM Stores gallery INNER JOIN StoreSlideShow image ON ... FOR XML AUTO
And then execute the results via the ExecuteXmlReade r() method on the SqlCommand.
Again, for this to work you have to select at least on item in the result set from the Stores table, otherwise you can't get the <gallery> element in the response. I hope that an extra element will not throw off your flash code.
If you can't go with that, then you could process the results with an XSLT. It would go something like that (off the top of my head without being able to validate it right now):
<xs:template match='/'> <gallery timer="3" order="sequenti al" fadetime="2" looping="yes" xpos="0" ypos="0"> <xs:apply-templates /> </gallery> </xs:template>
<xs:template match='table'> <image> <xs:attribute name='path'><xs :value-of select='ImagePa th'/></xs:attribute> </image> </xs:template>
HTH, Christoph Schittko MVP XML http://weblogs.asp.net/cschittko -----Original Message----- From: Paolo Pignatelli [mailto:Pa***@Do tNetStore.com] Posted At: Friday, December 17, 2004 7:15 AM Posted To: microsoft.publi c.dotnet.xml Conversation: Changing format of XML Doc (using WriteXML?) Subject: Changing format of XML Doc (using WriteXML?)
I am trying to get an output/file like this (below) in an XML file (MyXmlFile.xml) (which I will use for a slide show)
--
<gallery timer="3" order="sequenti al" fadetime="2" looping="yes" xpos="0" ypos="0">
<image path="images2/Test1.jpg" />
<image path="images2/Test2.jpg" />
<image path="images2/Test3.jpg" />
<image path="images2/Test4.jpg" />
<image path="images2/Test5.jpg" />
<image path="images2/Test6.jpg" />
</gallery>
--
When I use this XML file (written by hand), I can get the Flash slide
show to work, provided that the jpgs are in the correct folder....
So, now I want to generate the slide choices automatically from SQL, so I added a table called StoreSlideShow, and added a key column, a StoreID column, and a column called ImagePath.
I filled in the data, and wrote the SPROC
CREATE PROCEDURE [dbo].[GetSlideShowsBy Store3]
@StoreID int
AS
SELECT dbo.Stores.Stor eID, dbo.StoreSlideS how.ImagePath
FROM dbo.Stores INNER JOIN
dbo.StoreSlideS how ON dbo.Stores.Stor eID = dbo.StoreSlideS how.StoreID GO ----------------------
When I use the WriteXML command, etc..., it creates the following xml
document: (MyXmlFile3.xml )
<NewDataSet>
<Table>
<StoreID>1</StoreID>
<ImagePath>imag es2/Test1.jpg</ImagePath>
</Table>
<Table>
<StoreID>1</StoreID>
<ImagePath>imag es2/Test2.jpg</ImagePath>
</Table>
<Table>
<StoreID>1</StoreID>
<ImagePath>imag es2/Test3.jpg</ImagePath>
</Table>
...etc...
<Table>
<StoreID>2</StoreID>
<ImagePath>imag es2/Test1.jpg</ImagePath>
</Table>
</NewDataSet>
The data is correct, BUT - my dilemma- how do I get this output to
match the output/format above?
**TIA,**
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Nick |
last post by:
Well, the project I am working on has now come to a screeching halt! I
have been developing a program that heavily utilizes ADO.NET record
sets. To generate reports, I convert the recordset to XML, and then
apply an XSLT to transform the XML into HTML. This works great (or
did) until today. I just found out that the "number-format" command in
XSLT can't handle scientific notation! So when I try to format these
numbers I just get "NaN" on...
|
by: Kermit |
last post by:
I am re-writing a vb script that queries an SQL server and then uses the
recordset to generate an xml file. The xml file has a row-set schema with
row as the element and the columns as attributes: <z:row ID="1"
CapConDerivedName="AV_TOUCH_SCREEN_SOUND_LEVEL_ENABLED"
DataStructureType="bool" EnumType="None" Unit="none" SetValue="0" DSTID="2"
/>
I am using C# and dataSet.WriteXml(fileName, XmlWriteMode.WriteSchema);
The problem I am...
|
by: Jacky |
last post by:
hello i have to know if the writeXML process is a blocking process.
Other mean if i write
doc.WriteXML();
int i = 0;
Is i = 0 can be executed before doc.WriteXML() method ended????
All this when the data we have to save can need up to 2 3 seconds.
I think it's not blocking according to what I see in my application.
|
by: Guoqi Zheng |
last post by:
Dear sir,
I am trying to create to writeXml to create a xml file every day.
The WriteXml method of dataset is very nice and easy to use, however, how
can I add the following to my xml file?
<?xml version="1.0" encoding="UTF-8"?>
<productFeed version="0" timestamp="20040105:22:00:05">
|
by: John |
last post by:
Hi
I need to be able to call a web service method, receive the dataset that web
method returns and store it in an access table. My problem is that I don't
know how to "receive" a complex type like a dataset and how to link it to
the access table that it is supposed to go in. Could someone please give me
a code example?
Thanks
| |
by: Sakharam Phapale |
last post by:
Hi All,
How to preserve the old font properties while changing new one?
I posted same question 2 months back, but I had very small time then.
eg. "Shopping for" is a text in RichTextBox and already formatted as
"Shopping" ---Bold
"for" -----Regular
Now I want to underline whole text by preserving old style i.e. Bold and
|
by: INeedADip |
last post by:
I have seen this problem posted all over, but have never ran across a
solution....
I am serializing my dataset and they look like this:
<NewDataSet>
<xs:schema id="NewDataSet" xmlns=""
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xs:element name="NewDataSet" msdata:IsDataSet="true"
msdata:UseCurrentLocale="true">
|
by: Marc Gravell |
last post by:
I want to write a method that will accept a stream as a parameter, and which
will write xml to the stream (based in reality on database results) using
the XmlTextWriter class. However, this insists on closing my stream, and I
can't convince it not to.
A much-simplified example is below; basically, as soon as the writer is
disposed (marked **** below) the base stream gets closed - which is a pain
if I was still using it ;-p
The base...
|
by: Trapulo |
last post by:
I've a webservice with a string parameter.
I call this webservice passing a string that is 1129 chars length. On the
webservice, the received string is 1146 length (I tested sizes with
string.length property). String's contents seem be teh same, so I think
there is some encoding difference (is this possibile?). The problem is that
I sign this string, so signature validation fails :(
What can be the problem?
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
| |
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |