Open Side Menu Go to the Top

07-18-2013 , 07:03 PM
So I am taking a summer course on XML and it moves very quickly so I just want to make sure I am understanding it before moving on. I would really appreciate it if someone that is good with XML would take a look at this and let me know if there are any glaring errors?


Assignment Description
CS 366 Homework 1 (Due to Dropbox by 8:00PM 7/18/2013)
50 Points
Note that the bold faced terms form the vocabulary of this XML application document.
Part I. Well-Formedness (25pts)
Create a well-formed XML document for a mock Fall 2018 computer
science courses listed in Table 1. The requirements and
structure of the document is defined as follows.
1. The document should begin with the XML declaration. The version
is 1.0, and the encoding UTF-8.
2. The document should be well-formed.
3. Define your own namespace and declare it as your default namespace.
4. The child elements of an element must appear in the order as described in the following.
5.The root element is courses. The child element of the root is course.
6. Each course consists of one title and one or more section child elements, and has attributes course number and number of credits.
7. Each section consists of one enrollment, one date, zero or one days, zero or one time, zero or one room, and at least one instructor child elements.
8. The room element has a campus attribute.
9. Each section also has a section number, an id, and a type of delivery attributes. The value of the delivery attribute is one of Classroom, Online, or ITV.
10. The date element consists of two child elements, startDate and endDate.
11. The time element consists of two child elements, startTime and endTime.
12. Each instructor has a first name and last name. That is, the instructor element has two child elements first and last.
13. Include documentation (i.e., comments) in your XML file.
14. The bold-face words constitute our vocabulary.
Tip: It helps to first draw the hierarchy of information for the document.
At this point, make sure your XML document is well-formed before starting Part II.

Part II. Validation with DTD (25pts)
The objective of Part II is to learn how to validate the XML document using DTD. The XML document is based on the one in Part I.
The requirements and structure of the document is defined as follows.
1. In the XML file, use the relative path, not full path, to declare the location of the DTD file.
2. Include documentation (i.e.,comments) in your files.
3. DTD requirements
a. Use external DTD.
b. Follow the cardinality requirements specified in Part I.
c. Every attribute is required.
d. id of a section has the type ID.
e. The value of delivery is one of Classroom, Online, or ITV.
f. Declare an internal general entity for the instructor element for Chi-Cheng Lin and reference it in the XML file. You need to modify the XML file.
g. Define the type of date element in another DTD file. Declare an external parameter entity for the date element type and reference it in your main DTD file.
h. You might need to “cheat” in the DTD by defining the default namespace as an attribute although it is not.
Submission
Files to submit include
1. XML file
2. Main DTD file
3. DTD file for the parameter entity
Please zip them into one file and submit the zipped file to D2L Dropbox.
If you cannot make entities work for you, submit a “fallback,” working version without using entities. Note that a submission that is not well-formed and/or invalid is much worse than a working one that fails to meet the entity requirement.

hw1.xml
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE courses SYSTEM "hw1.dtd">
<courses xmlns="http://www.alexgronseth.com/CS366/hw1">
  <course number="CS341" credits="4">
    <title>Data Structures</title>
    <section number="01" id="X001780" delivery="Classroom">
      <enrollment>15</enrollment>
      <date>
        <startDate>08/26/2018</startDate>
        <endDate>12/11/2018</endDate>
      </date>
      <days>TTh</days>
      <time>
        <startTime>16:00</startTime>
        <endTime>17:50</endTime>
      </time>
      <room campus="Rochester">EA244</room>
      <instructor>
        <first>Nicole</first>
        <last>Anderson</last>
      </instructor>
    </section>
    <section number="02" id="X001784" delivery="Online">
      <enrollment>10</enrollment>
      <date>
        <startDate>08/29/2018</startDate>
        <endDate>12/12/2018</endDate>
      </date>
      <instructor>
        <first>Nicole</first>
        <last>Anderson</last>
      </instructor>
      &instructorChi;
    </section>
    <section number="03" id="X001788" delivery="Classroom">
      <enrollment>12</enrollment>
      <date>
        <startDate>08/29/2018</startDate>
        <endDate>12/12/2018</endDate>
      </date>
      <days>TTh</days>
      <time>
        <startTime>18:00</startTime>
        <endTime>19:50</endTime>
      </time>
      <room campus="Rochester">SH102</room>
      <instructor>
        <first>Mark</first>
        <last>Funk</last>
      </instructor>
    </section>
  </course>
  <course number="CS368" credits="3">
    <title>Introduction to Bioinformatics</title>
    <section number="01" id="X001781" delivery="ITV">
      <enrollment>9</enrollment>
      <date>
        <startDate>08/27/2018</startDate>
        <endDate>12/10/2018</endDate>
      </date>
      <days>W</days>
      <time>
        <startTime>18:00</startTime>
        <endTime>20:40</endTime>
      </time>
      <room campus="Rochester">AT102</room>
      &instructorChi;
      <instructor>
        <first>Mingrui</first>
        <last>Zhang</last>
      </instructor>
    </section>
  </course>
  <course number="CS375" credits="4">
    <title>Computer Systems</title>
    <section number="01" id="X001782" delivery="Classroom">
      <enrollment>18</enrollment>
      <date>
        <startDate>08/25/2018</startDate>
        <endDate>12/10/2018</endDate>
      </date>
      <days>MW</days>
      <time>
        <startTime>16:00</startTime>
        <endTime>17:50</endTime>
      </time>
      <room campus="Rochester">EA244</room>
      &instructorChi;
    </section>
  </course>
  <course number="CS385" credits="3">
    <title>Applied Database Management Systems</title>
    <section number="01" id="X001783" delivery="Classroom">
      <enrollment>26</enrollment>
      <date>
        <startDate>08/26/2018</startDate>
        <endDate>12/11/2018</endDate>
      </date>
      <days>TTh</days>
      <time>
        <startTime>11:00</startTime>
        <endTime>12:20</endTime>
      </time>
      <room campus="Rochester">ST108</room>
      <instructor>
        <first>Nicole</first>
        <last>Anderson</last>
      </instructor>
    </section>
  </course>
  <course number="CS413" credits="3">
    <title>Advanced Networking</title>
    <section number="01" id="X001786" delivery="Online">
      <enrollment>10</enrollment>
      <date>
        <startDate>08/26/2018</startDate>
        <endDate>12/11/2018</endDate>
      </date>
      &instructorChi;
    </section>
  </course>
</courses>
hw1.dtd
Code:
<!ELEMENT courses (course)*>
<!ATTLIST courses xmlns CDATA #REQUIRED>

<!ELEMENT course (title, section+)>
<!ATTLIST course number CDATA #REQUIRED>
<!ATTLIST course credits CDATA #REQUIRED>

<!ELEMENT title (#PCDATA)>

<!ELEMENT section (enrollment, date, days?, time?, room?, instructor+)>
<!ATTLIST section number CDATA #REQUIRED>
<!ATTLIST section id ID #REQUIRED>
<!ATTLIST section delivery (Classroom|Online|ITV) "Classroom">

<!ELEMENT enrollment (#PCDATA)>

<!ENTITY % date SYSTEM "date.dtd">
%date;

<!ELEMENT days (#PCDATA)>

<!ELEMENT time (startTime, endTime)>

<!ELEMENT startTime (#PCDATA)>

<!ELEMENT endTime (#PCDATA)>

<!ELEMENT room (#PCDATA)>
<!ATTLIST room campus CDATA #REQUIRED>

<!ELEMENT instructor (first, last)>

<!ELEMENT first (#PCDATA)>

<!ELEMENT last (#PCDATA)>

<!ENTITY instructorChi "<instructor><first>Chi-Cheng</first><last>Lin</last></instructor>">
date.dtd
Code:
<!ELEMENT date (startDate, endDate)>

<!ELEMENT startDate (#PCDATA)>

<!ELEMENT endDate (#PCDATA)>
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **
$25m Guaranteed WPM on CoinPoker
Join the action now
Daily Rewards • Splash Pots • CoinRaces
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **
07-18-2013 , 08:38 PM
Quote:
Originally Posted by KatoKrazy
So I am taking a summer course on XML
i'm sorry to hear that
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-18-2013 , 09:01 PM
Quote:
Originally Posted by e i pi
i'm sorry to hear that
yeah. i don't mean this in a mean way, but taking an entire course on XML is a huge waste of time. i'm actually pretty shocked that a course in it is offered anywhere.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-18-2013 , 09:17 PM
XSLT tho

Last edited by tyler_cracker; 07-18-2013 at 09:19 PM. Reason: yo dawg, i hear you like data, so i put some data in your data so you can turn data into other data
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-18-2013 , 09:19 PM
Quote:
Originally Posted by gaming_mouse
yeah. i don't mean this in a mean way, but taking an entire course on XML is a huge waste of time. i'm actually pretty shocked that a course in it is offered anywhere.
Hmmmm... just looking through what the course covers it seems pretty in depth.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-18-2013 , 11:52 PM
In part, about XML, zip to page 11 if you need the brevity:

https://wiki.postgresql.org/images/b...osdem-2013.pdf
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-19-2013 , 04:49 AM
A solid understanding of vanilla XML, XSD, XSLT and related topics (ebXML) is very valuable if you ever plan on working on business software for certain industries.

[personally I don't enjoy XML at all]
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-19-2013 , 12:39 PM
Lightable test is postponed because I finally upgraded to the 21st century and bought a smartphone. Instead I'll be working through some android developers guides and whatnot. I have a decent idea for a small test porject

Javaaaaaaa
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-19-2013 , 02:18 PM
Quote:
Originally Posted by clowntable
A solid understanding of vanilla XML, XSD, XSLT and related topics (ebXML) is very valuable if you ever plan on working on business software for certain industries.

[personally I don't enjoy XML at all]
I was wondering why everyone seemed so down on it. The small company I will be interning for offers software and support mostly to the manufacturing industry. From what they were showing me in addition to X++ they use XML quite a bit.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-19-2013 , 02:42 PM
Quote:
Originally Posted by KatoKrazy
I was wondering why everyone seemed so down on it.
It's like a course on making hamburgers. Yes, hamburgers are a very large and important part of the American cuisine in terms of amount consumed, but making hamburgers is far too simple and far too narrow in scope to be its own course within a culinary curriculum. Also not much about it is interesting or applicable to the general art of cooking.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-19-2013 , 04:15 PM
Quote:
Originally Posted by candybar
It's like a course on making hamburgers. Yes, hamburgers are a very large and important part of the American cuisine in terms of amount consumed, but making hamburgers is far too simple and far too narrow in scope to be its own course within a culinary curriculum. Also not much about it is interesting or applicable to the general art of cooking.
Very well said.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-19-2013 , 06:40 PM
Quote:
Originally Posted by KatoKrazy
I was wondering why everyone seemed so down on it. The small company I will be interning for offers software and support mostly to the manufacturing industry. From what they were showing me in addition to X++ they use XML quite a bit.
Yep manufacturing and especially automotive are very invested in XML-ish stuff.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-19-2013 , 09:55 PM
XML is a terrible way to do anything when there are other options available. Just think about that XML you have right now. Once that thing gets to 100x the size, it'll be an utter mess and any bad data you have will be impossible to find.

XPath, XQuery, etc. You are writing a modified for loop to read and scan a huge file. Why do this?

XML was originally supposed to be, in part, an agnostic representation to share SQL data. The point was to export to XML and read XML and then do the queries, etc. Would anyone bother to keep the XML as-is and bake their own instead of using an RDMS with all of the fast stuff cooked in?

What benefit does creating that huge schema have over looking at a CSV file? The visualization is virtually null and it is very hard to update either with your eyes or with a machine (see about the errors above). This is even more apparent when you can just run SQL joins and export it to CSV and you have very clear visuals of what is happening.

And finally, all that stuff you are learning about can be learned fairly quick over a weekend. I really don't know what kind of sick torture you'd want to inflict on yourself for using XML over any other available tool.

I guess there is something to be said if you are really interested in working with Maven POM, but yikes.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-19-2013 , 10:06 PM
Quote:
Originally Posted by derada4
Just had my first programming related phone interview.

The three OOP questions she asked me where:
1. Name all of the different types of loops.
2. What is the difference between call-by-value and call-by-reference
3. Explain inheritance without using programming jargon

Seemed a little too easy. Is this standard?
Silly question. Why didn't you mention to her that these aren't OOP questions? Just because it is apparently some dumb secretary on the other end doesn't mean that she isn't the real McCoy or that she wasn't coached.

Sort of thinking about some article I read where the programmer girl would call and the guy was like: "Wut? I thought this was a technical interview?" Then she's play the ditz and lead them down all sorts of silly paths for her own amusement.

If someone says something wrong to you, you should be willing to point it out. I'm not sure about where you've worked, but I know that my jobs didn't like it if I didn't open my mouth when something was wrong. Of course, I'm paid to think about stuff, so take it for what its worth.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-19-2013 , 10:18 PM
Pointing out to someone that questions that they called OOP questions aren't actually OOP questions just seems dickish. Why does it matter?

I don't think I would want to work with someone that corrects me on every meaningless mistake I make.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-19-2013 , 10:27 PM
Then think about a nice way of saying it. Like, if she says: "I'm going to ask you a 3 OOP questions." Then after she is done, you say, "Oh, I thought there were three questions on OOP I had to answer?"

And then go from there. I don't understand how that would be dickish, but whatever.

Besides, I find it odd that a programmer wouldn't want to be corrected in something silly and small considering the consequences of many silly and minute mistakes.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-19-2013 , 10:55 PM
Calling her out on it would be stereotypical no-social-skill nerd behavior, which may or may not be what they are looking for.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-20-2013 , 12:06 AM
Quote:
Originally Posted by daveT
Then think about a nice way of saying it. Like, if she says: "I'm going to ask you a 3 OOP questions." Then after she is done, you say, "Oh, I thought there were three questions on OOP I had to answer?"

And then go from there. I don't understand how that would be dickish, but whatever.

Besides, I find it odd that a programmer wouldn't want to be corrected in something silly and small considering the consequences of many silly and minute mistakes.
Def a dick move if it's an HR person. They are trained to ask these scripted basic tech questions. I think it's ridiculous they are expected to ask questions about topics they have almost zero knowledge in, but I know several big companies do this.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-20-2013 , 12:17 AM
Quote:
Originally Posted by daveT
Then think about a nice way of saying it. Like, if she says: "I'm going to ask you a 3 OOP questions." Then after she is done, you say, "Oh, I thought there were three questions on OOP I had to answer?"

And then go from there. I don't understand how that would be dickish, but whatever.

Besides, I find it odd that a programmer wouldn't want to be corrected in something silly and small considering the consequences of many silly and minute mistakes.
What are the consequences of calling a question OOP when its not? Or like if I say Java when I meant Javascript but everybody knew I was talking about Javascript - do we need to call it out? Or if you see an inconsequential word missing in a presentation do you interrupt and point it out? If I see an error message in the code base that isn't wrong should I track down the developer that committed it and tell them about it or should I just fix it and move on?

Knowing when to just overlook an inconsequential mistake seems like a valuable life skill to me. It also means if I point out a problem to somebody they're more likely to listen since I don't usually waste their time.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-20-2013 , 02:40 AM
Do you know for certain this is an HR lady? If I don't know what she does, then I am not safe to make any assumptions about her abilities.

Asking someone to name a few loops, which has a few single word answers, then asking to describe inheritance, especially when our hapless HR person should have no clue what a "good" answer should be is a pretty large logical distance from "She's an idiot reading off a script."

In actuality, I would be sort of uncomfortable because I would be expecting 2 more OOP questions and saying that's all of them would make me wonder if my answer was unsatisfactory, and I would ask if I was wrong or if there was something I didn't describe appropriately.

At least in my interviewing experience, I've faced a few interviewers that played the ditz to great effect, and it generally took a bit of well-framed questions from me to figure out they were much smarter than first blush. The point is that I don't ever trust my first instincts on people.

The idea that I would be willing to correct people is probably a function of the kind of work I do on a daily basis, which yes, involved and involves correcting people and being corrected. Maybe I have a much thicker skin than most people, but there is a "good" way and a "bad" way to approach these subjects.

Just the other day I was asked to compute a simple math problem. I got the correct answer, but I went about it a different way than the company usually does it. In my own defense, I didn't quite understand the problem and I think the guy was just tossing out extra info to see if I was going to use it. Anyways, he took my answer and then walked over the guy that normally does it and corroborated my number. This same person asked me to compute the same problem yester, but this time with missing numbers. I thought for about 4 seconds and gave him an answer. He looked at me and said, "Hey, don't you need to know xyz number?" No, I didn't, and I told him so.

My last job -- not the internship -- was brutal with correcting me and tossing a bunch of questions at me. I had to defend everything I said and guess what? There were times I was wrong.

Yes, I am well aware of what it feels like to be challenged, many times incorrectly, by people and I am aware that there are certain ways of saying things to not hurt people's feelings. If saying "well, actually..." is nerd anti-social behavior and somehow inferior to sitting on your hands and not quacking, then I think said nerd has some serious social issues. It is far more valuable, IMHO, to learn how to correct people without hurting their feelings. I guess if you can't, then don't, but don't assume that I am a dick for correcting someone no more than you can correctly assume said woman is HR without further, clarifying, information.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-20-2013 , 02:44 AM
Quote:
Originally Posted by muttiah
Def a dick move if it's an HR person. They are trained to ask these scripted basic tech questions. I think it's ridiculous they are expected to ask questions about topics they have almost zero knowledge in, but I know several big companies do this.
Yes, if knew this was an HR person, then it is certainly a pointless correction to make.

Kind of off-handed, but I wonder if the assumption she was HR would have been made if it was a he asking these questions.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-20-2013 , 02:54 AM
Quote:
Originally Posted by jjshabado
What are the consequences of calling a question OOP when its not? Or like if I say Java when I meant Javascript but everybody knew I was talking about Javascript - do we need to call it out? Or if you see an inconsequential word missing in a presentation do you interrupt and point it out? If I see an error message in the code base that isn't wrong should I track down the developer that committed it and tell them about it or should I just fix it and move on?

Knowing when to just overlook an inconsequential mistake seems like a valuable life skill to me. It also means if I point out a problem to somebody they're more likely to listen since I don't usually waste their time.
this +1000. i feel like as a general rule certain programmers are the worst offenders against this advice, and cannot help nitpicking on technical errors (about names, definitions, grammar, you name it) even when the intention and meaning of the person they're correcting is crystal clear. it's an insufferable trait.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-20-2013 , 05:41 AM
hi hi hi there. I was wondering if someone that knows about web site building/design could do me a favor? An indie band I really love made a new website, and they need constructive feedback, but I don't know **** about web sites. Anyone have any advice? Thanks.

http://www.chaoschaosmusic.com/
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-20-2013 , 06:52 AM
i really like the design. simple and clear, but still with style.

my only comment is that it loaded fairly slowly for me, like 10-20 seconds. i noticed the page made about 150 requests. so combining assets might help. they also might want to invest in faster hosting.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-20-2013 , 07:58 AM
Quote:
Originally Posted by daveT
At least in my interviewing experience, I've faced a few interviewers that played the ditz to great effect, and it generally took a bit of well-framed questions from me to figure out they were much smarter than first blush. The point is that I don't ever trust my first instincts on people.
Slightly unrelated I'd be unimpressed with a company that interviewed by pretending to be people they aren't. To me it's disrespectful of the idea that we're there to get to know each other and decide if this is a good fit.

Quote:
Originally Posted by daveT
I guess if you can't, then don't, but don't assume that I am a dick for correcting someone no more than you can correctly assume said woman is HR without further, clarifying, information.
I actually don't care about if the woman is an HR person or their best programmer I don't see the value in discussing if those questions are OOP or not.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **
$25m Guaranteed WPM on CoinPoker
Join the action now
Daily Rewards • Splash Pots • CoinRaces
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **

      
m