Question: In Java. You may use your own xml file. XmlTagStack1 class: Use the XmlTag.java class and the XmlTagStack.java interface and put them in the xmlvalidator

In Java. You may use your own xml file.

XmlTagStack1 class: Use the XmlTag.java class and the XmlTagStack.java interface and put them in the xmlvalidator package. Create a new class named XmlTagStack1 in the xmlvalidator package. In the class creation wizard, click the Add (interface) button, and search for XmlTagStack. Click the Inherited abstract methods box and click finish. Dont change XmlTagStack interface. Add code in XmlTagStack1 class.

XmlTag.java

package xmlvalidator;

public class XmlTag {

public String name;

public int index;

public XmlTag(String name, int index) {

super();

this.name = name;

this.index = index;}}

XmlTagStack.java

package xmlvalidator;

public interface XmlTagStack {

//Pushes the given item onto the top of the stack. @param item

public void push(XmlTag item);

//Removes the top item from the stack. @return The removed item. If the stack is empty when this method is called, null is returned.

public XmlTag pop();

//Returns, but does not remove, the item at the given position. 0 is the top, 1 is the second item, and so on. @param position

//@return the item at the given position. If the stack is empty when method is called, or position is greater than count -1, null is returned.

public XmlTag peek(int position);

//@return the number of items on the stack

public int getCount(); }

XmlValidator1 class: Use the XmlValidator.java interface and put it in the xmlvalidator package. Create a new class named XmlValidator1 in the xmlvalidator package. In the class creation wizard, click the Add (interface) button, and search for XmlValidator. Check the Inherited abstract methods box and click Finish. Dont change the XmlValidator interface. Add code in XmlValidator1 class.

XmlValidator.java

package xmlvalidator;

import java.util.*;

public interface XmlValidator {

public List validate(String xmlDocument);

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!