Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Xml For Dummies Chapter 16 Xml And Forms it-slideshares.blogspot.com
1. XML FOR DUMMIES Book author: Lucinda Dykes and Ed Tittel Slides Prepared by Cong Tan Part V : XML Application Development Chapter 16: XML and Forms.
3. 1. Collecting Information with Forms: The Basics. Most of us are used to filling in blanks and checking boxes to provide requested information on a printed form. Web users have also become very familiar with completing online HTML forms, including text in boxes, choosing radio buttons, checking boxes, and selecting options from scrolling lists. Most interaction on the Web takes place through the use of forms. But form is involved. Data collection and submission with forms, HTML form elements can create interactivity via scripting languages such as JavaScript.
4. 2. HTML Forms. You can use HTML to create forms for display on Web pages. HTML includes elements for creating text boxes, text areas, radio buttons, check boxes, and menus. These forms have a standard look and structure, which makes it easy for Web users to use them to enter data. Figure 16-1 shows a standard HTML form.
5. 2. HTML Forms(cont…). HTML form elements, can create only the structure of a form for display on a Web page. Collecting the data that’s entered on an HTML form requires the use of a scripting or programming language in addition HMTL. Perl, PHP, and Java are programming languages commonly used for forms processing. Form data is submitted to a Web server and processed by a server-side script that conforms to the CGI specification. The form results can then be returned to a Web page, sent in a e-mail message, saved as a data file, or submitted to a database. You can use XML files to create XML forms and collect data with Xforms or InfoPath.
6. 3. XML Forms. XML and forms go together well — both XML and forms have to do with collecting and exchanging data. You can use XSLT to generate HTML forms code, two new options(Xforms and InfoPath) provide easier solutions for XML data exchange.
7. 3.1 XForms. XForms is an XML application created by the W3C. Xforms allows the separation of presentation and content, expanded form capabilities, and a decreased reliance on scripting for forms validation and processing. Why use Xforms?Using Xformsfor your XML data has several advangtages over using HTML forms: Form data can be collected and submitted as XML. External XML documents can be loaded as initial form data. XPath expressions and XML Schema datatypes can be used with Xforms. Xforms can be integrated with Web services. Xforms is device independent . XForms properties. XForms markup is shown in Listing 16-1.
8. • XForms does not include a form element; the form markup is divided between the head section and the body section of the document. • The head element contains a model element with a submission element that includes the attributes that are usually contained in an HTML form element: action, method, and id.. • XFormsis the default namespace, and the XHTML namespace uses an h: prefix. • The input element include ref attribute.
9. 3.1 XForms(cont…) . XForms includes all the form control elements of HTML forms. In the case of XForms, markup is used to control the action of form elements. For example: XForms includes a select and a select1 element. You use the selectelement when there are zero or more choices and a select1element when only one choice can be selected. An appearance attribute specifies the appearance of select or select1 elements, as in. For radio-button markup <select1 appearance=”full” ref=”bk1”> <label>Content Type</label> <item><label>Fiction</label><value>F</value></item> <item><label>Nonfiction</label><value>NF</value></item> </select1> For check-box markup <select appearance=”full” ref=”bk1”> <label>Shipping Options</label> <item><label>Gift Wrap</label><value>GW</value></item> <item><label>Gift Card</label><value>GC</value></item> </select>
10. 3.1 XForms(cont…) . XForms includes the following built-in features that require scripting when used in HTML forms: Required values: A required value must be entered in the form before the form can be submitted. Value containts: A value must be within a certain range of values. Datatypes for values: An XML Schema datatype can be specified for a value. Values that are calculated form other values: An Xpath expression is used to calculate a new value from other values in the form… XForms also provides these additional features: The capability to specify an initial value for form data. P3ptypes for privacy-related values: P3P datatypes can be used for private monitoring. A switch element for creating wizard-like behavior for form completion(as shown in Figure 16-2). A repeat element that allows items to be added and deleted, as in a shopping cart. Function galore — including arithmetic functions, string manipulation, date handling, and conditional statements using if.
11.
12. 3.1 XForms(cont…) . Submission options. XForms includes several options for the method of submitting form data. Three of these methods are similar to those available with HTML forms: method=“get” method=“urlencodedpost” method=“form-data-post” In addition, XForms offers: method=“post” (posts the results as an XML document) method=“put”(puts the result in an XML document) For example: Figure 16-3, 16-4, and 16-5 show the use of “put” method.
13. Show an XML document with content. Shows an XForms form to edit this content
14. Shows the same XML document with new content.
15. 3.2 InfoPath. InfoPath is a WYSIWYG XML forms editor that can create an XML form from an XML document or XML Schema document. InfoPath forms can be used online or downloaded and completed offline.
16. 3.2.1 Why use InfoPath? You should consider using InfoPath for several reasons: InfoPath is easy to use and doesn’t require any knowledge of XML. Form data from InfoPath can be exported to other Microsoft applications, such as Excel 2003. InfoPath allows you to select multiple forms and combine the data into one form. You can use an existing XML Schema document and automatically create a form based on the structure of the schema. InfoPath can be integrated with Web services. InfoPath includes data validation and conditional formatting fearures.
17. 3.2.2 Automated form design from an XML Schema. You can easily design a form an existing XML Schema in InfoPath: Open InfoPath, and select File➪Design a Form . From the Design a New Form list in the task pane on the right side of the page, select New from XML Document or Schema. Click the Browse button in the Data Source Wizard window, and browse to the location of the bookstore.xsd file. Select the bookstore.xsd file, click Open, and then click Next in the Data Source Wizard window. Choose No in response to the question and then click the Finish button. Select the Layout task pane from the list at the top of the task pane and then select Two Column Table from the Insert Layout Tables menu in the task pane. Select the Data Source task pane, highlight the book element in the task pane, and then drag the book element into the left column of the table. Choose Section with Controls from the contextual menu. Select and drag the totalCost element into the bottom of the left column, below the repeating section. Then select and drag the cus-tomerelement into the lower-right cell. Choose Section with Controls from the contextual menu. The bottom of your form should now resemble Figure 16-6.
18. 11. Choose File➪SaveAs➪Save➪ to open the Save As dialog box. Enter bookstore.xsn for the file name and then click the Save button. 12. Choose File➪Preview Form. Then choose With Data File from the submenu. 13. Browse to the location of bookstore_schema.xml from Chapter 9, select it, and then click Preview (Figure 16-7 shows the InfoPath Preview file). 14. Publish your file to a folder, and put your form to work.
19. • Now you can see why we included InfoPath in this chapter — it’s fast, and it’s easy to • Create a working XML form document that can be opulated with data from any XML document that corresponds to the XML Schema the form is based on. • Fill out new data in a blank form based on a form template document.