Skip to content

CS311 - Introduction to Web Services Development

9 Topics 29 Posts
  • 0 Votes
    1 Posts
    401 Views
    No one has replied
  • 0 Votes
    1 Posts
    327 Views
    No one has replied
  • CS311 Assignment 1 Solution and Discussion

    Solved
    2
    0 Votes
    2 Posts
    378 Views
    zaasmiZ

    @zareen said in CS311 Assignment 1 Solution and Discussion:

    Q. Create an internal DTD and XML Document for the XML tree drawn below.
    DTD (10 marks)
    XML Document (10 marks)

    Solution Idea
    DTD:

    <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE league [ <!ELEMENT league (franchise)> <!ATTLIST league name CDATA #REQUIRED> <!ATTLIST league year CDATA #REQUIRED> <!ELEMENT franchise (team+)> <!ATTLIST franchise name CDATA #REQUIRED> <!ATTLIST franchise owner CDATA #REQUIRED> <!ATTLIST franchise city CDATA #REQUIRED> <!ELEMENT team (win,losses,coach,player+)> <!ELEMENT win (#PCDATA)> <!ELEMENT losses (#PCDATA)> <!ELEMENT coach (#PCDATA)> <!ELEMENT player (name,age,runs,matches)> <!ELEMENT name (#PCDATA)> <!ELEMENT age (#PCDATA)> <!ELEMENT matches (#PCDATA)> <!ELEMENT runs (#PCDATA)> ]>

    XML:

    <?xml version="1.0" encoding="UTF-8"?> <league year="" name=""> <franchise owner="" name="" city=""> <team> <wins></wins> <losses></losses> <coach></coach> <player> <name></name> <age></age> <matches></matches> <runs></runs> </player> </team> </franchise> </league>
  • CS311 GDB 1 Solution and Discussion

    1
    0 Votes
    1 Posts
    649 Views
    No one has replied
  • 0 Votes
    4 Posts
    509 Views
    cyberianC

    https://cyberian.pk/topic/1166/cs311-3-fall19-solution-file

  • CS311-3-FALL19-Solution-File

    1
    0 Votes
    1 Posts
    115 Views
    No one has replied
  • CS311 Assignment 2 Solution and Discussion

    Solved
    2
    0 Votes
    2 Posts
    217 Views
    zareenZ

    Solution Ideas:

    Write XML Schema (.xsd) code for the given XML

    Answer

    XSD Code <?xml version="1.0" encoding="utf-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:element name="BookStore"> <xs:complexType> <xs:sequence> <xs:element name="Book" maxOccurs="unbounded"> <xs:complexType> <xs:sequence> <xs:element name="Title" type="xs:string"/> <xs:element name="Course" type="xs:string"/> <xs:element name="Year" type="xs:unsignedShort"/> <xs:element name="Publisher" type="xs:string"/> <xs:element name="Author" type="xs:string"/> </xs:sequence> </xs:complexType> </xs:element> </xs:sequence> </xs:complexType> </xs:element> </xs:schema> Generate the following XML on a server as output using PHP
    Answer
    PHP CODE <?php header("Content-type: text/xml"); echo"<BookStore>"; echo"<Book>"; echo"<Title>Introduction to Computing</Title>"; echo"<Course>CS101</Course>"; echo"<Year>2016</Year>"; echo"<Publisher>Virtual University of Pakistan </Publisher>"; echo"<Author>Dr Tanveer Ahmad</Author>"; echo"</Book>"; echo"<Book>"; echo"<Title>Object Oriented Programming</Title>"; echo"<Course>CS304</Course>"; echo"<Year>2017</Year>"; echo"<Publisher>Virtual University of Pakistan</Publisher>"; echo"<Author>Dr Shafeeq</Author>"; echo"</Book>"; echo"</BookStore>"; ?>

    PHP OUTPUT

  • CS311 Assignment 1 Solution and Discussion

    Solved
    3
    0 Votes
    3 Posts
    211 Views
    zareenZ

    @zareen said in CS311 Assignment 1 Solution and Discussion:

    Q. Create an internal DTD and XML Document for the XML tree drawn below.
    DTD (10 marks)
    XML Document (10 marks)

    Solution
    DTD:

    <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE league [ <!ELEMENT league (franchise)> <!ATTLIST league name CDATA #REQUIRED> <!ATTLIST league year CDATA #REQUIRED> <!ELEMENT franchise (team+)> <!ATTLIST franchise name CDATA #REQUIRED> <!ATTLIST franchise owner CDATA #REQUIRED> <!ATTLIST franchise city CDATA #REQUIRED> <!ELEMENT team (win,losses,coach,player+)> <!ELEMENT win (#PCDATA)> <!ELEMENT losses (#PCDATA)> <!ELEMENT coach (#PCDATA)> <!ELEMENT player (name,age,runs,matches)> <!ELEMENT name (#PCDATA)> <!ELEMENT age (#PCDATA)> <!ELEMENT matches (#PCDATA)> <!ELEMENT runs (#PCDATA)> ]>

    XML:

    <?xml version="1.0" encoding="UTF-8"?> <league year="" name=""> <franchise owner="" name="" city=""> <team> <wins></wins> <losses></losses> <coach></coach> <player> <name></name> <age></age> <matches></matches> <runs></runs> </player> </team> </franchise> </league>
  • CS311 Quiz 2 Solution and Discussion

    Unsolved
    14
    0 Votes
    14 Posts
    4k Views
    M

    XML Quiz
    For each question, choose the best choice out of the given choices.

    What does XML stand for?
    A. X-Markup Language
    B. eXtra Modern Link
    C. Example Markup Language
    D. eXtensible Markup Language

    XML’s goal is to replace HTML
    A. True
    B. False

    What does DTD stand for?
    A. Direct Type Definition
    B. Document Type Definition
    C. Document Type Declaration

    Is this a correct XML document?

    Students
    Teacher
    Reminder

    We are at Software Park, Thailand A. Yes **B. No**

    Which statement is true?
    A. All XML elements must have a closing tag
    B. All XML documents must have a DTD or an XML schema
    C. All XML elements must be lowercase
    D. All of the statements are true

    Which statement is true?
    A. XML tags are case sensitive
    B. XML elements must be properly nested
    C. XML documents must have the root element
    D. All the statements are true

    XML preserves white spaces
    A. True
    B. False

    Is this a correct XML document?

    Students Teacher

    A. No
    B. Yes

    XML elements cannot be empty
    A. True
    B. False

    Which is not a correct name for an XML element?
    A.
    B.
    C. <1dollar>
    D. All 3 names are incorrect

    Which is not a correct name for an XML element?
    A.
    B.
    C.
    D. All 3 names are incorrect

    Which is not a correct name for an XML element?
    A.
    B.
    C.

    For the XML parser to ignore a certain section of your XML document, which syntax is correct?
    A. <xml:CDATA[ Text to be ignored]>
    B. Text to be ignored
    C.

    XML is a subset of SGML
    A. True
    B. False

    XML attributes must be in double quotes
    A. True
    B. False

    XML attributes must be assigned values
    A. True
    B. False

    The Document Type Definition must be stored in an external file
    A. True
    B. False

    What can XML do?
    A. The standard for automating data exchange between systems
    B. The standard for displaying data on the Web
    C. The standard for a cross-platform programming language

    Which is false?
    A. XML is used to describe only structured data
    B. XML is used to only on the Internet
    C. XML is used to represent only simple data
    D. All of the above

    Which of the following comments are not well formed?
    A.
    B.
    C. <!-- declaration — 10.27.2004 -->
    D.

    Provided that the file x.dtd has the following contents. Which of the xml files are valid?

    a.



    text

    b.


    Element can
    contain

    c.

    Sample

    How can you declare in a DTD that the element x contains either the element a or the element b, but not both of them
    a)
    b)
    c)
    d) It is not possible to declare in a DTD that one element contains either the element a or the element b, but not both of them

    How can you declare in a DTD that the element x contains the element a, or the element b, or both of them in the sequence a b.
    a)
    b)
    c)
    d) None of the declarations above does solve the problem.

    How can you declare in a DTD that the empty element x has either the attribute a or the attribute b (or both of them). The attributes contain any value.
    a)

    b)

    c)

    d) It is not possible to make the presence of one attribute depend on another attribute

    How can you in a DTD declare that the element x contains both attributes a and b and that the order of them has to be ab? The attributes can contain any value
    a)

    b)

    c)

    b CDATA #REQUIRED>

    d) It is not possible to specify the order of attributes in a DTD. The order of attributes does not matter in XML.

    e) It is not possible to specify the order of attributes in a DTD. The order of attributes can be specified only in an XML schema.

    Valid names of elements and attributes start with a letter, an underscore or a colon, the following allowed characters are letters, numeric characters, colon, underscore, dot and hyphen (minus). Names which start with “xml” (in any case) are reserverd for W3C. The colon has a special meaning with namespaces and should not be used with any other semantic.