kvnmck18 Posted June 29, 2009 Share Posted June 29, 2009 It has been a good couple of years since I have used SimpleXML to add and modify nodes/attributes. For a personal project I am working on it would be the easiest solution. Below I have posted an example of my XML. The XML is used to build forms for an little jQuery web-app. I am trying to use PHP to create new <Type/> with an inner child of <form/> that will have different <input/> nodes that will have different content in their attributes. Basically, it's pretty simple - I just need some refreshing on how to do this. The only "tricky" part is if a node is added with a the @type="select" it will have it's own children (<input/>).I just need a simple way to create these nodes/attributes and modify them. It's sad that php.net documentation is horrible on this topic and you have to dig deep into XML DOM to even get started.Another tricky thing is that I do not want to delete nodes, the "delete function" I want to work as a "comment out" for that node. So wrap that node with a "<!-- <node/> -->" <Site> <Page> <Type title="Web form" description="Create a new form"> <form name="webpageFORM"> <input title="Question" type="checkbox" defaultValue="1"/> <input title="Email" type="input" defaultValue=""/> <input title="Select" type="select" defaultValue=""> <input title="Opt 1" defaultValue="1"/> <input title="Opt 2" defaultValue="2"/> <input title="Opt 3" defaultValue="3"/> </input> </form> </Type> </Page></Site> Hope someone can help me out. Let me know if I didn't explain this good enough // I'm pretty tired.Thanks in advance!-Kevin Link to comment Share on other sites More sharing options...
This topic is now archived and is closed to further replies.