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="sequential" 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].[GetSlideShowsByStore3]
@StoreID int
AS
SELECT dbo.Stores.StoreID, dbo.StoreSlideShow.ImagePath
FROM dbo.Stores INNER JOIN
dbo.StoreSlideShow ON dbo.Stores.StoreID = dbo.StoreSlideShow.StoreID GO
----------------------
When I use the WriteXML command, etc..., it creates the following xml
document: (MyXmlFile3.xml)
<NewDataSet>
<Table>
<StoreID>1</StoreID>
<ImagePath>images2/Test1.jpg</ImagePath>
</Table>
<Table>
<StoreID>1</StoreID>
<ImagePath>images2/Test2.jpg</ImagePath>
</Table>
<Table>
<StoreID>1</StoreID>
<ImagePath>images2/Test3.jpg</ImagePath>
</Table>
....etc...
<Table>
<StoreID>2</StoreID>
<ImagePath>images2/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 2487
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 ExecuteXmlReader() 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="sequential" 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='ImagePath'/></xs:attribute>
</image>
</xs:template>
HTH,
Christoph Schittko
MVP XML http://weblogs.asp.net/cschittko -----Original Message----- From: Paolo Pignatelli [mailto:Pa***@DotNetStore.com] Posted At: Friday, December 17, 2004 7:15 AM Posted To: microsoft.public.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="sequential" 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].[GetSlideShowsByStore3]
@StoreID int
AS
SELECT dbo.Stores.StoreID, dbo.StoreSlideShow.ImagePath
FROM dbo.Stores INNER JOIN
dbo.StoreSlideShow ON dbo.Stores.StoreID = dbo.StoreSlideShow.StoreID
GO ----------------------
When I use the WriteXML command, etc..., it creates the following xml
document: (MyXmlFile3.xml)
<NewDataSet>
<Table>
<StoreID>1</StoreID>
<ImagePath>images2/Test1.jpg</ImagePath>
</Table>
<Table>
<StoreID>1</StoreID>
<ImagePath>images2/Test2.jpg</ImagePath>
</Table>
<Table>
<StoreID>1</StoreID>
<ImagePath>images2/Test3.jpg</ImagePath>
</Table>
...etc...
<Table>
<StoreID>2</StoreID>
<ImagePath>images2/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**********@austin.rr.com> wrote in message
news:#o**************@TK2MSFTNGP09.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 ExecuteXmlReader() 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="sequential" 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='ImagePath'/></xs:attribute> </image> </xs:template>
HTH, Christoph Schittko MVP XML http://weblogs.asp.net/cschittko -----Original Message----- From: Paolo Pignatelli [mailto:Pa***@DotNetStore.com] Posted At: Friday, December 17, 2004 7:15 AM Posted To: microsoft.public.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="sequential" 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].[GetSlideShowsByStore3]
@StoreID int
AS
SELECT dbo.Stores.StoreID, dbo.StoreSlideShow.ImagePath
FROM dbo.Stores INNER JOIN
dbo.StoreSlideShow ON dbo.Stores.StoreID = dbo.StoreSlideShow.StoreID GO ----------------------
When I use the WriteXML command, etc..., it creates the following xml
document: (MyXmlFile3.xml)
<NewDataSet>
<Table>
<StoreID>1</StoreID>
<ImagePath>images2/Test1.jpg</ImagePath>
</Table>
<Table>
<StoreID>1</StoreID>
<ImagePath>images2/Test2.jpg</ImagePath>
</Table>
<Table>
<StoreID>1</StoreID>
<ImagePath>images2/Test3.jpg</ImagePath>
</Table>
...etc...
<Table>
<StoreID>2</StoreID>
<ImagePath>images2/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,...
|
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:...
|
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...
|
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?
...
|
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...
|
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...
|
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=""...
|
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...
|
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...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
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,...
| |