Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - XML issues
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

XML issues

 Post Reply Post Reply Page  <12
Author
Mart View Drop Down
Senior Member
Senior Member
Avatar

Joined: 30 November 2002
Status: Offline
Points: 2304
Post Options Post Options   Thanks (0) Thanks(0)   Quote Mart Quote  Post ReplyReply Direct Link To This Post Posted: 09 April 2005 at 1:37pm
TBH It's a lot easier in .net as the DataSet object can read xml and also supports paging, sorting etc. it is possible in ASP but you will need quite a bit of code to achieve it
Back to Top
theSCIENTIST View Drop Down
Senior Member
Senior Member


Joined: 31 July 2003
Location: United Kingdom
Status: Offline
Points: 440
Post Options Post Options   Thanks (0) Thanks(0)   Quote theSCIENTIST Quote  Post ReplyReply Direct Link To This Post Posted: 09 April 2005 at 11:12pm
On my XPath research, I found XQuery, just what I need I thought, great, I will be able to query my xmlBank and get my results filtered with ease, digging a bit deeper, the examples shown everywhere look promising, so sleeves up, lets try it... (seconds later) ...humm, right, hummm, where do I put the XQuery code? What sort of file? Right... It seams everyone out there shows you XQuery code like:

for $x in doc("books.xml")/bookstore/book

where $x/price>30
order by $x/title
return $x/title


But no one tells you where to put it, or, on which file type; asp, xhtml or what?

Help please.
Back to Top
Mart View Drop Down
Senior Member
Senior Member
Avatar

Joined: 30 November 2002
Status: Offline
Points: 2304
Post Options Post Options   Thanks (0) Thanks(0)   Quote Mart Quote  Post ReplyReply Direct Link To This Post Posted: 10 April 2005 at 3:27am
Looks like it's client side xhtml:

<ul>
{
for $x in doc("books.xml")/bookstore/book/title
order by $x
return <li>{data($x)}</li>
}
</ul>

Back to Top
theSCIENTIST View Drop Down
Senior Member
Senior Member


Joined: 31 July 2003
Location: United Kingdom
Status: Offline
Points: 440
Post Options Post Options   Thanks (0) Thanks(0)   Quote theSCIENTIST Quote  Post ReplyReply Direct Link To This Post Posted: 11 April 2005 at 2:37am
Client side xhtml?

I'm new to that, how do I run the code then?

Thanks.
Back to Top
Mart View Drop Down
Senior Member
Senior Member
Avatar

Joined: 30 November 2002
Status: Offline
Points: 2304
Post Options Post Options   Thanks (0) Thanks(0)   Quote Mart Quote  Post ReplyReply Direct Link To This Post Posted: 11 April 2005 at 2:55am
Like that I think

<ul>
{
for $x in doc("books.xml")/bookstore/book/title
order by $x
return <li>{data($x)}</li>
}
</ul>

I've never used it before either

Back to Top
Phat View Drop Down
Senior Member
Senior Member


Joined: 23 February 2003
Status: Offline
Points: 386
Post Options Post Options   Thanks (0) Thanks(0)   Quote Phat Quote  Post ReplyReply Direct Link To This Post Posted: 11 April 2005 at 5:27am
try Response.Write(chr(13)) for a new line
Back to Top
Mart View Drop Down
Senior Member
Senior Member
Avatar

Joined: 30 November 2002
Status: Offline
Points: 2304
Post Options Post Options   Thanks (0) Thanks(0)   Quote Mart Quote  Post ReplyReply Direct Link To This Post Posted: 11 April 2005 at 11:33am
He has already explained that he is using MS's XML DOM to create the document so he can't use Response.Write(chr(13))
Back to Top
theSCIENTIST View Drop Down
Senior Member
Senior Member


Joined: 31 July 2003
Location: United Kingdom
Status: Offline
Points: 440
Post Options Post Options   Thanks (0) Thanks(0)   Quote theSCIENTIST Quote  Post ReplyReply Direct Link To This Post Posted: 11 April 2005 at 7:41pm
Mart, yes, I tried using that code on a .xhtml, .shtml and all the rest of it, no avail, must be missing something, will look futher.

----------------------------------


Phat, thanks, but it won't work, to create a new node I use:

Set PostElement = xmlData.createElement("Post")
PostElement.setAttribute "Title", "Some title"
PostElement.setAttribute "Author", "Ruan"
PostElement.setAttribute "Message", "Oh yeah baby."

Call xmlData.documentElement.insertBefore(PostElement, xmlData.documentElement.childNodes.item(0))


This creates an XML node like:

<Post Title="Some title" Author="Ruan" Message="Oh yeah baby."/>

The problem is that, as I add more nodes, they will get all like this:

<Post Title="Some title" Author="Ruan" Message="Oh yeah baby."/><Post Title="Some title" Author="Ruan" Message="Oh yeah baby."/><Post Title="Some title" Author="Ruan" Message="Oh yeah baby."/>

As opposed to:

<Post Title="Some title" Author="Ruan" Message="Oh yeah baby."/>
<Post Title="Some title" Author="Ruan" Message="Oh yeah baby."/>
<Post Title="Some title" Author="Ruan" Message="Oh yeah baby."/>


What could it be?
Back to Top
 Post Reply Post Reply Page  <12

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.