Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

Simple XML Checker!

Objective:

Write a program that checks whether or not a given file is formatted correctly for a very simple version of XML. In this simple version of XML you have tags that denote information.

Each tag has a "start-tag", and an "end-tag". The start-tag is denoted by a value enclosed by "< >", and the end-tag similarly denoted by "".

Each start-tag must have an end-tag. Elements fall in between the start and end tags, and can also other tags can be nested in as well.

In this version of XML you can assume that tags and elements will always be on separate lines, and no additional attributes (such as id = "3">) will be a part.

Well formatted example

33

Another well formatted example

100

Not well formatted example

44

Another not well formatted example

33

To solve this problem you must:

Write a stack, and use it to solve this problem

You may NOT use the built-in java stack

You may either implement the stack as a linked structure or an array. If you use an array assume the max size is 100;

Write another class that has a main method which takes in a file name and checks whether or not that file is correctly formatted.

Here's a basic idea:

If the next line is enclosed by "< >" with a tag in between, then push the tag onto the stack

If the next line is enclosed by "" with a tag in between, then

Pop one element off the stack

Check if that element matches with end-tag. If it does then continue on, but if it doesn't then it is not formatted correctly

All other values and elements can be ignored

If by the end there are no tags left on the stack then it is properly formatted, but if the stack still has tags then it is not properly formatted.

Also the string methods "charAt(index)" and "substring(startIndex, endIndex)" may be very useful

Here are some files to test with

goodXML1

goodXML2

goodXML3

badXML1

badXML2

badXML3

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M93119337

Have any Question?


Related Questions in Computer Engineering

This is sports data analysis with python classone way to

This is sports data analysis with python class. One way to judge a basketball lineup is to determine the point differential when that particular combination of players is in the game - in other words, how many points doe ...

You have a senior project you have to write 20 page long

You have a senior project You have to write 20 page long pages. You also have to make a project on a card explain what i m talkiing about. it should CIS program so utilize thre SDLC project management, databases, coding, ...

Question lessons learned from the mirai botnet attack of

Question: Lessons learned from the Mirai Botnet attack of 2016 • Why was it so much more effective than previous BotNet designs? • What kind of mitigations would you recommend for protection? These two points must be ans ...

Question suppose you have a table employee with the

Question : Suppose you have a table, EMPLOYEE, with the following attributes: eid, work_title, fname, lname, ssn, salary, date_of_birth, and commission_rate. Ms. Smith is vice president of sales. She and three regional s ...

Question please read this instruction and section 5 and 6

Question: Please read this instruction, and section 5 and 6 in particular, CAREFULLY as it affects all future programming assignments. 1. Setup Android Studio Development Environment 1.1 Download necessary packages using ...

Question topic business informationsearching relevant

Question: Topic: Business Information Searching relevant scholarly journal articles, research and discuss the following prompts. Include a minimum of two (2) scholarly journal articles relevant to each prompt for a total ...

We have seen that a block cipher such as aes is insecure if

We have seen that a Block cipher such as AES is insecure if an attacker can have a very large number of chosen plain-text messages (e.g.2 50 messages) for which he gets the corresponding cypher-text. Suppose that we cons ...

Question 1 explain the various types of green architecture

Question: 1. Explain the various types of Green architecture within the enterprise, such as information architecture and solutions architecture. 2. Explain how a Green systems architecture evolves from a basic to a linea ...

Scruffie the cat has 15 to spend each month on cat toys

Scruffie the cat has $15 to spend each month on cat toys, which cost $3 each, and cat treats, which cost $1.50 each. Draw a budget line to show the combination of each good that scuffie can afford if she spends her entir ...

What is the purpose of load balancing i need full

What is the purpose of load balancing? (I need full explanation) I already know what load balancing is, I just need to know why we use it

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As