Giter Site home page Giter Site logo

nhbfiudy-task7's Introduction

Practical task №7


The task is defined as follows.

  1. Create an XML file (input.xml) and a corresponding XSD schema (input.xsd).

  2. When developing XSD, you are required to use:

simple and compound types, enumerations, templates, and limit values.

  1. Create a Java class corresponding to this description.

  2. Create a Java application (name it ‘Main’) for parsing the XML document and initialization of the container of objects with information from the XML file.

For parsing, use: SAX, StAX parsers, as well as the DOM analyzer (all three options).

  1. Define methods that will sort container objects using the Comparator interface by some parameter or set of parameters

(three parsers => three sorting options => three methods).

  1. Validate XML document against XSD (using a validating parser or validation API).

  2. Define a method for saving information to the XML document from the container.

  3. Demonstrate the operation of the application:

a) read the XML document using each parser;

b) receive the container of objects;

c) sort the objects in the container (using one of three sorting options);

d) save the sorted container to the XML document (to the file).

  1. The application input data is the names of the two files:

the XML document and the XSD document;

the output data is three XML files.

Set input file names with the command line parameters (two parameters or one, if the validation will occur against the scheme, defined inside the XML document).

  1. To demonstrate the operation of the application, create Demo class, that calls the Main.main method of your application with the appropriate parameters of the command line:

Demo.java

———————————————————————-

package com.epam.rd.java.basic.practice7;

/**

  • Demo class to run project WO command line.

*/

class Demo {

 public static void main(String[] args) throws Exception {

     Main.main(new String[] { "input.xml" });

 }

}

———————————————————————-

  1. Top-level classes and non-trivial methods should be documented.

  2. Optional. Create an XSL document that converts an XML document into an HTML document.


Naming convention

Name the root element of the XML document according to the name of the task or based on the fact that this is a container of elements of the same type whose name is specified in the task.

Example: if the task is called Testing, and the element is named Test, then the root element can be called either Testing or Tests.

Input and output files should have the following names.

Input files:

———————————————————————-

input.xml - An XML document, valid against input.xsd

input.xsd - XSD document, schema for input.xml

———————————————————————-

Output files (the result)

———————————————————————-

output.dom.xml - the result of the DOM analyzer work and subsequent

sorting using one of the three sorting options.

output.sax.xml - the result of the SAX parser work and subsequent sorting using one of the three sorting options.

output.stax.xml - the result of the StAX parser work after sorting using one of the three sorting options.

———————————————————————-

Note.

  1. input.xsd should declare the target namespace (the targetNamespace attribute should be present).

  2. input.xml should be valid against input.xsd

  3. XML output documents output.dom.xml, output.sax.xml and output.stax.xml should be valid against the source XML schema input.xsd, if the declaration of the target namespace is excluded from it (see file input-no-targetNamespace.xsd in the sample project).

(Note: XML output documents are not required to declare the noNamespaceSchemaLocation attribute)

nhbfiudy-task7's People

Contributors

sergaav avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.