1 / 34

XML

XML. Why is XML so popular? It’s flexible It enables you to create your own documents with elements (tags) that you define Non-XML example: <p>This is a paragraph of text</p> What does this tell you? What does it tell a program?. XML. What does the browser see? <p> blah, blah, blah </p>.

tao
Download Presentation

XML

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. XML • Why is XML so popular? • It’s flexible • It enables you to create your own documents with elements (tags) that you define • Non-XML example: <p>This is a paragraph of text</p> • What does this tell you? • What does it tell a program?

  2. XML • What does the browser see? <p>blah, blah, blah</p>

  3. XML • XML example: <pets> <pet> <type>Dog</type> <name>Rover</name> <age>12</age> <owner>Dave</owner> </pet> </pets> <html> <body> <p> <img…> <a href=…> <script…> <form…> </body> </html>

  4. XML • XML tags provide meaning or context • Programs can interpret these meanings • XML is ideal for sharing data between programs • One user can encode data using XML and share it with others • A different user can interpret that data

  5. XML • XML documents may have three parts • Prolog • Body • Epilog • Prolog • Comments & processing instructions • Version information • Reference to a specific XML DTD or schema

  6. XML • Epilog • Comments & processing instructions • Body • One or more elements • Defined by the DTD or schema • Forms a hierarchical tree structure • One top-level element • All others below it in the hierarchy

  7. XML • Why is XML important? • Forms the basis for web services • How is XML different from HTML? • HTML is fairly forgiving of errors <p>This is a paragraph will probably work OK • You can mix upper and lower case • Attribute values don’t have to be enclosed in quotes

  8. XML • Bottom line: • Poorly-formed HTML documents are no big deal • XML does not provide that level of informality • You have to follow the rules • What are the rules to remember?

  9. XML • XHTML documents must have a DOCTYPE declaration <!DOCTYPE html PUBLIC ¬ “-//W3C//DTD XHTML 1.0 Transitional//EN” ¬ http://www/w3/org/TR/xhtml/11/DTD/xhtml1- transitional.dtd> • Must occur before the root element

  10. XML • Root element • Top of the hierarchy of elements (<html>) • Only one element at this level • No other elements before it • No other elements after the ending tag (</html>) • Lowercase only (XML is case sensitive)

  11. XML • Attribute values must be encased in quotes • HTML: <img … width=72> • XML: <img … width=“72”> • Attribute values must not be minimized • That is, the name entered without a value • That’s why selected=“selected” • Spaces in attribute values will be removed

  12. XML • Only the id attribute is used to uniquely identify an element • The name element is not recognized • Both starting and ending tags are required • HTML: <br> • XML: <br/> • Elements must be nested, not overlapping

  13. XML • <script> and <style> elements must be marked as CDATA areas <script language=”Javascript”> <![CDATA[ function clickalert() { alert(“VSNET is cool!”) } ]]> </script>

  14. Object-Oriented Concepts • Object-oriented programming • Certain block of code treated as reusable objects • Accept certain inputs • Produce certain outputs • Programmer doesn’t have to know how the output is produced, only how to manipulate the object • Programmer has to know what parts of an object can be manipulated

  15. Object-Oriented Concepts • Properties • Contain values • Addressable • That is, programmer has access to the property • Methods • Functions that the object can perform • Can supply data via arguments • Don’t have to know how they work

  16. Object-Oriented Concepts • Events • Triggers that are activated in specific situations • Affects object without user intervention • Many objects are already part of the VS.NET environment • You don’t have to create them, only use them • You can build your own objects if you need to

  17. Object-Oriented Concepts • Objects are derived from classes • Classes are basically templates • Human is a class • An object is an instance of a class • Creating an object is called instantiation • Making a baby is instantiating a human

  18. Object-Oriented Concepts • Encapsulation • Objects can be used without knowing what goes on inside them • Inheritance • New classes can be created based on base classes • Each new derived class • Inherits the properties and methods of the base class • May have properties and methods not in the base class

  19. Object-Oriented Concepts • Polymorphism • Properties and methods of both base and derived classes can have the same name and be used in the same way • This means that the output of a method may be produced by completely different internal processing methods • The user doesn’t care

  20. .NET Structures & Languages • Common Language Runtime (CLR) • CLR is an intermediate state • Not source • Not object • Makes VS.NET applications machine independent • Code running within the CLR is called managed code

  21. .NET Structures & Languages • Communications protocols • VS.NET supports many • Necessary for networked environment • Multiple computers • Multiple operating systems • Encoding formats • ISO 8859-1 • Unicode

  22. .NET Structures & Languages • VS.NET supports • Visual Basic (VB.NET) • C# • J# • Others being added • We’ll be using VB.NET • It’s components are …

  23. .NET Structures & Languages • Variables • Strongly typed • Name begins with alphabetic character • May contain alphabetic characters or digits • No special characters or punctuation symbols • No more than 255 characters in length • Cannot match a reserved word • Declared: dim SSN as String

  24. .NET Structures & Languages • Constants • Literals (simply a value): Const 19.95 • Symbolic (includes name): Const TVPrice=19.95 • Comments • Begins with apostrophe

  25. .NET Structures & Languages • Data types • Boolean • String • Integer • Decimal • Date • Object • User-defined

  26. .NET Structures & Languages • Operators • Assignment • = • Arithmetic • + - / * ^ • Relational • < <= = <> >= > • Like • Wild cards * and ?

  27. .NET Structures & Languages • Operators (cont.) • Logical • and • or • Concatenation • + &

  28. .NET Structures & Languages • Control Structures • if…then • do • for…next • select case • while…wend • with

  29. .NET Structures & Languages • Namespaces • Closed set of names that identifies elements from a DTD • Can be used to include classes of objects in an application • Scope • Local • Blobal

  30. Example Application • What savings are needed to achieve a specific retirement goal? • Variables • Amount at retirement • Amount saved each month • Time until retirement • Interest rate

  31. Example Application • Web page format • Welcome page with link to a form • Data entry form • Results shown in browser window • Validation on client side • Javascript • Processing on server side • Computations

  32. Example Application • Server-side processing is a little different • Web form – web page in HTML with a form • Form written in HTML on client side • Comes to client from server • Page & form start on server • Contains HTML and other elements (XML) • Application also includes code behind the page • Web form and Code-Behind page automatically generated by VS.NET

  33. Assignment • Complete the application described on pages 53 thru 63 • Follow the instructions exactly • You can check your code the same way I will • Through a browser: http://coit-ts2003.uncc.edu/ • Grade based on functionality

More Related