XML extract from site.

Sep 7th, 2013
DotaCN
Category:
Programming
Price: $50 USD

Question description

For this assignment you will model and process an XML document   ttp://free1.ed.gov/xml/gemexport.xml) containing a set of teaching and learning resources produced by the Department of Education (http://www.ed.gov/)

You will need to extract the following data from each of <resource> elements in the document:
 

  • title

  • description

  • url

  • the list of subjects, both
         the categories and subcategories.

You will need to define an appropriate set of classes that model
the structure of the XML document using the approach described in the content.
You only need to model the subset of information that needs to be collected. It
will require more than one class, however.

Further, you must create a class, ResourceImporter, which has exactly
two operations:

public class ResourceImporter {

  private static
Document loadXMLDocument(String documentLocation) { ... }

  public static
Resources importResourcesFromXML(String documentLocation) { ... }


}

where Resources is the class that represents the element <root> in the resource
document. Technically, if you apply the method for mapping an XML structure to a
set of classes, the name of the class should be Root but Resources is more meaningful. The class should load and parse the resources XML document, similar to how TopTracksImporter worked in the
LastFM example.

You must also have a class T_Resources which contains the  main(). It must be the only file that contains a main(). It will use ResourceImporter to load the document and then use the returned Resources object to produce formatted output. Given a structure that looks like the following (note that
the irrelevant parts of the structure have been stripped)

<resource>

  <title>Ben's
Guide to the U.S. Government for Kids</title>

 
<description>Help's K-12 students learn...</description>

  <identifier>

 
<url>http://bensguide.gpo.gov/</url>

  </identifier>

  <subjects>

  <subject>

 
<category>Government</category>

 
<subcategory>Elections</subcategory>

  </subject>

  <subject>

 
<category>Government</category>

 
<subcategory>Other</subcategory>

  </subject>

  <subject>

 
<category>Government</category>

 
<subcategory>Congress</subcategory>

  </subject>

  </subjects>

 

</resource>

 

The output should look like

 

Ben's Guide to the U.S. Government for Kids'

 

http://bensguide.gpo.gov

 

  Government ::
Elections

 

  Government :: Other

 

  Government :: Congress

 

A blank line should appear between the outputs of the different
resources.

Submission Requirements

Your submission for this assignment will consist of a single zip
file that contains the Java source code files (no .class files!). The files
should not be nested in another folder. The Java classes cannot depend on
anything more than each other and the standard Java libraries.

Each class you define should be contained in its own .java file. Each file requires a header at the top of the file of the form

To do this, we will use the
Document Object Model (DOM). The DOM is an API maintained by the World Wide Web
Consortium (W3C). An API just tells what's available and how things work. There
needs to be an implementation of the API and, conveniently, Java provides one.




Tutor Answer

(Top Tutor) Daniel C.
(997)
School: University of Virginia
PREMIUM TUTOR

Studypool has helped 1,244,100 students

8 Reviews


Summary
Quality
Communication
On Time
Value
kevin12622
Nov 28th, 2016
" Goes above and beyond expectations ! "
kiln82
Nov 19th, 2016
" awesome work thanks "
ashleyisgod
Nov 15th, 2016
" Top quality work from this guy! I'll be back! "
likeplum4
Nov 6th, 2016
" Excellent work as usual "
Molly_Moon
Oct 23rd, 2016
" AMAZING as always! "
kpcutie
Oct 14th, 2016
" Excellent job "
Hemapathy
Oct 1st, 2016
" all I can say is wow very fast work, great work thanks "
pmallory
Sep 22nd, 2016
" Totally impressed with results!! :-) "
Ask your homework questions. Receive quality answers!

Type your question here (or upload an image)

1827 tutors are online

Brown University





1271 Tutors

California Institute of Technology




2131 Tutors

Carnegie Mellon University




982 Tutors

Columbia University





1256 Tutors

Dartmouth University





2113 Tutors

Emory University





2279 Tutors

Harvard University





599 Tutors

Massachusetts Institute of Technology



2319 Tutors

New York University





1645 Tutors

Notre Dam University





1911 Tutors

Oklahoma University





2122 Tutors

Pennsylvania State University





932 Tutors

Princeton University





1211 Tutors

Stanford University





983 Tutors

University of California





1282 Tutors

Oxford University





123 Tutors

Yale University





2325 Tutors