Vzero Posted December 8, 2006 Share Posted December 8, 2006 Well, I'm trying to make a xml news reader/editor. well I used Xquery and it didn't work.Please tell me what I did wrounge:News.html <html><body><ul>{for $x in doc("News.xml")/news/updateorder by $xreturn <li>{$x}</li>}</ul> </body></html> News.xml <?xml version="1.0" encoding="utf-8" ?> <news><update>New News goes here</update></news> Also could someone tell me how to make a program that lets people edit the xml file(like a program edits the xml file by add or deleting a <update>). Link to comment Share on other sites More sharing options...
boen_robot Posted December 9, 2006 Share Posted December 9, 2006 XQuery doesn't work this way. It doesn't work like anything similar either.You need to use XSLT in conjuction with XPath in order to turn the XML file into (X)HTML.And a program for editing... That's a bit harder. You'll need to create a form and a server side script that will do the actual editing.If it's only for news though, I suggest that you use RSS scince it's a standart vocabulary. Because of that, you may find existing editors for it. Link to comment Share on other sites More sharing options...
Vzero Posted December 9, 2006 Author Share Posted December 9, 2006 ok, I was only using xquery because w3schools said it was like a data base. And I know I could use xforums, but I was trying to only use html and xml or xhtml, not asp(don't have a sever that supports it). Link to comment Share on other sites More sharing options...
boen_robot Posted December 9, 2006 Share Posted December 9, 2006 By server side scripting languages, I mean not only ASP, but also PHP, Cold Fusion, Perl, etc. If your host doesn't support the one you like, it might still be possible to find a free host that does.Only server side scripting languages can do the editing. No way around it. Thank god for that too, scince client side scripts can be executed by anyone anywhere. Imagine if JavaScript could create new files on a server. Anyone would be able to occupy the complete space you have left. And if JS could delete files? God protect your files.You don't need XForms (note: forms != forums ) in order to create a form to edit XML, scince XML is technically speaking- text based.You can create a form (HTML form, XForm, or any other kind of form) with a few fields. For example "Title" and "Description". Then, when you submit the form, the server side script will generate an XML fragment like <item><title><!--Content that was entered in the "Title" field--></title><description><!--Content that was entered in the "Description" field--></description></item> and put that into the proper place of the complete XML file. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now