Jump to content

inserting data into xml

Recommended Posts

I have a question about the XML. I will admit, I havent spent a ton of time trying to find the answer to this now because I've looked into it in the past with no luck, which is why I never really started using XML to begin with. But I feel like it would be the best option for a site I want to create, and I just need a few clarifications on how to use it.I think I understand the basic structure of an XML document, and all the tags you can create. But my question is once you create the structure, or Schema, What do you do with that to easily insert data. Say I have a simple structure like this<article><title> ABC</title><keywords> </keywords> (Question: would I have several of these tags with multiple keywords?)<summary> </summary><text> </text></article>That may or may not be right, but close enough. If I have many articles I want to post, I really don't want to have to go through and retype all the tags everytime I add something, especially if my actual data has a lot more tags. But I have yet to figure out what I use to insert the data into that format. I'm assuming I can build a form, but I'm not sure how that gets transfered. Can it be done with HTML only or do I need another language?Also, when retrieving the information from the xml file, is that straight html or something else as well? If I missed the page that explains this on the site, you can just point me in the right direction. Also, If I wanted to just pull everything except for the text itself to include on one page, and then specific articles when a linked is clicked on other pages, that can be done right? Would I have a separate page for each dataset? or is it dynamic. Meaning If i click article one, it will show article one without needing a separate file for each additional article?I am somewhat familar with sql and PHP, so that is the method I'm thinking of. I just don't think I need a full fledge database for what I'm doing. I just need to know how data gets inserted once the structure is in place. Thanks

Link to post
Share on other sites

You need to use an XML DOM library to add, edit and remove nodes to the document. PHP's DOMDocument is almost identical to Javascript's XML DOM API so I recommend reading the XML DOM tutorial and then studying PHP's DOMDocument extension

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...