tailieunhanh - Pro PHP XML and Web Services phần 4

. Bạn chỉ có thể tham khảo các nhóm được đặt tên. Lấy trường hợp của một địa chỉ. Một tài liệu có thể có một Khi sử dụng các dữ liệu XML với một phong cách trang có chứa các mẫu sau đây: PHP XML Trang web phù hợp với Mẫu này kiểm tra các thuộc tính num của phần tử trang web hiện tại trong bối cảnh. | 266 CHAPTER 7 SIMPLEXML Initial entry point so load the PAD template created from DOM sxetemplate simplexml_load_file padtemplate If in working state display the working template for editing or preview if bSave print form method POST Base64-encoded working template to allow XML to be passed in hidden field print input type hidden name ptemplate value . base64_encode sxetemplate- asXML . printDisplay sxe sxetemplate bPreview print br br nbsp nbsp nbsp nbsp nbsp . input type Submit name Preview value Preview and Validate PAD if bError isset _POST Preview Working template is valid and in preview mode. Allow additional editing or final Save print nbsp nbsp nbsp nbsp nbsp . input type Submit name Edit value Edit PAD print nbsp nbsp nbsp nbsp nbsp . input type Submit name Save value Save PAD print form br br else Final PAD file has been saved - Just print message print PAD File Saved as savefile else Application unable to retrieve the specification file - Error print Unable to load PAD Specification File body html The important areas to look at within this application are the user variables and the defined functions. The remainder of the application just pieces it all together. You must set three user variables. The default values will work just as well but you can change them with respect to your current setup. These are the three user variables padspec Location of PAD specification file. By default it pulls from http but you can have it reside locally in that case modify the value to point to your local copy. padtemplate Location of the PAD template generated by the DOM extension in Chapter 6. savefile Location to save the final generated PAD file to when done. The specification file is used in every step of the process so the first thing the application does is have SimpleXML load it. Initially none of the POST variables is set and SimpleXML is CHAPTER 7 SIMPLEXML 267 called on again to load the empty template created by the DOM extension. This is .