Package org.mizartools.utility.xml

Examples of org.mizartools.utility.xml.XMLElement


        return parentNode;
    }

    public static Int newInstance(INode parentNode, LinkedList<XMLElement> xmlElementList) throws ElementParseException {
        Int int_ = new Int(parentNode);
        XMLElement xmlElement = xmlElementList.poll();
        if (!xmlElement.getName().equals(NAME)){
            throw new ElementParseException(ElementParseException.NOT_VALID_ELEMENT, "XMLElement is a " + xmlElement.getName() + " not a " + NAME, xmlElementList);
        }
        for (XMLAttribute xmlAttribute : xmlElement.getXMLAttributeList()){
            if (xmlAttribute.getName().equals("x")){
                if (int_.x == null){
                    try {int_.x = Integer.parseInt(xmlAttribute.getValue());}
                    catch (Exception e) {throw new ElementParseException(ElementParseException.NOT_VALID_TYPE_OF_ATTRIBUTE_ELEMENT, "XMLElement has an attribute " + xmlAttribute.getName() + " with an invalid type", xmlElementList);};
                } else {
                    throw new ElementParseException(ElementParseException.DUPLICATE_ATTRIBUTE_ELEMENT, "XMLElement has a duplicate attribute " + xmlAttribute.getName(), xmlElementList);
                }
            } else
                throw new ElementParseException(ElementParseException.NOT_VALID_ATTRIBUTE_ELEMENT, "XMLElement has not a valid attribute " + xmlAttribute.getName(), xmlElementList);
        }

        if (!xmlElement.isEmpty()){
            while (true){
                xmlElement = xmlElementList.peek();
                if (xmlElement == null){
                    throw new ElementParseException(ElementParseException.UNEXPECTED_END_OF_FILE, "Unexpected end of XMLElement list");
                }
                if (xmlElement.getName().equals(NAME) && xmlElement.isEndElement()){
                    xmlElement = xmlElementList.poll();
                    break;
                }
                throw new ElementParseException(ElementParseException.NOT_VALID_ELEMENT, "The XMLElement " + xmlElement.getName() + " is not valid in " + NAME, xmlElementList);
            }
        }

        return int_;
    }
View Full Code Here


        return int_;
    }

    public LinkedList<XMLElement> getXMLElementList() {
        LinkedList<XMLElement> xmlElementList = new LinkedList<XMLElement>();
        XMLElement xmlElement = new XMLElement(NAME);
        if (this.x != null) {
            XMLAttribute xmlAttribute = new XMLAttribute("x", this.x);
            xmlElement.getXMLAttributeList().add(xmlAttribute);
        }
        boolean isEmpty = true;
        xmlElement.setEmpty(isEmpty);
        xmlElementList.add(xmlElement);
        if (!isEmpty) {
            xmlElement = new XMLElement(NAME);
            xmlElement.setEndElement(true);
            xmlElementList.add(xmlElement);
        }
        return xmlElementList;
    }
View Full Code Here

        return proof;
    }

    public LinkedList<XMLElement> getXMLElementList() {
        LinkedList<XMLElement> xmlElementList = new LinkedList<XMLElement>();
        XMLElement xmlElement = new XMLElement(NAME);
        if (this.nr != null) {
            XMLAttribute xmlAttribute = new XMLAttribute("nr", this.nr);
            xmlElement.getXMLAttributeList().add(xmlAttribute);
        }
        if (this.vid != null) {
            XMLAttribute xmlAttribute = new XMLAttribute("vid", this.vid);
            xmlElement.getXMLAttributeList().add(xmlAttribute);
        }
        if (this.line != null) {
            XMLAttribute xmlAttribute = new XMLAttribute("line", this.line);
            xmlElement.getXMLAttributeList().add(xmlAttribute);
        }
        if (this.col != null) {
            XMLAttribute xmlAttribute = new XMLAttribute("col", this.col);
            xmlElement.getXMLAttributeList().add(xmlAttribute);
        }
        boolean isEmpty = !(blockThesis != null);
        xmlElement.setEmpty(isEmpty);
        xmlElementList.add(xmlElement);
        if (this.blockThesis != null){
            xmlElementList.addAll(this.blockThesis.getXMLElementList());
        }
        if (this.reasoning != null){
            xmlElementList.addAll(this.reasoning.getXMLElementList());
        }
        if (!isEmpty) {
            xmlElement = new XMLElement(NAME);
            xmlElement.setEndElement(true);
            xmlElementList.add(xmlElement);
        }
        return xmlElementList;
    }
View Full Code Here

        return parentNode;
    }

    public static Signature newInstance(INode parentNode, LinkedList<XMLElement> xmlElementList) throws ElementParseException {
        Signature signature = new Signature(parentNode);
        XMLElement xmlElement = xmlElementList.poll();
        if (!xmlElement.getName().equals(NAME)){
            throw new ElementParseException(ElementParseException.NOT_VALID_ELEMENT, "XMLElement is a " + xmlElement.getName() + " not a " + NAME, xmlElementList);
        }

        if (!xmlElement.isEmpty()){
            while (true){
                xmlElement = xmlElementList.peek();
                if (xmlElement == null){
                    throw new ElementParseException(ElementParseException.UNEXPECTED_END_OF_FILE, "Unexpected end of XMLElement list");
                }
                if (xmlElement.getName().equals(NAME) && xmlElement.isEndElement()){
                    xmlElement = xmlElementList.poll();
                    break;
                }
                if (xmlElement.getName().equals("ArticleID")){
                    signature.articleIDList.add(ArticleID.newInstance(signature, xmlElementList));
                } else
                    throw new ElementParseException(ElementParseException.NOT_VALID_ELEMENT, "The XMLElement " + xmlElement.getName() + " is not valid in " + NAME, xmlElementList);
            }
        }

        return signature;
    }
View Full Code Here

        return signature;
    }

    public LinkedList<XMLElement> getXMLElementList() {
        LinkedList<XMLElement> xmlElementList = new LinkedList<XMLElement>();
        XMLElement xmlElement = new XMLElement(NAME);
        boolean isEmpty = !(!articleIDList.isEmpty());
        xmlElement.setEmpty(isEmpty);
        xmlElementList.add(xmlElement);
        for (ArticleID articleID : this.articleIDList){
            xmlElementList.addAll(articleID.getXMLElementList());
        }
        if (!isEmpty) {
            xmlElement = new XMLElement(NAME);
            xmlElement.setEndElement(true);
            xmlElementList.add(xmlElement);
        }
        return xmlElementList;
    }
View Full Code Here

        return parentNode;
    }

    public static Requirement newInstance(INode parentNode, LinkedList<XMLElement> xmlElementList) throws ElementParseException {
        Requirement requirement = new Requirement(parentNode);
        XMLElement xmlElement = xmlElementList.poll();
        if (!xmlElement.getName().equals(NAME)){
            throw new ElementParseException(ElementParseException.NOT_VALID_ELEMENT, "XMLElement is a " + xmlElement.getName() + " not a " + NAME, xmlElementList);
        }
        for (XMLAttribute xmlAttribute : xmlElement.getXMLAttributeList()){
            if (xmlAttribute.getName().equals("constrkind")){
                if (requirement.constrkind == null){
                    if (Constrkind.valueOf(xmlAttribute.getValue()) != null) {
                        requirement.constrkind = Constrkind.valueOf(xmlAttribute.getValue());
                    } else
                        throw new ElementParseException(ElementParseException.NOT_VALID_TYPE_OF_ATTRIBUTE_ELEMENT, "XMLElement has an attribute " + xmlAttribute.getName() + " with an invalid type", xmlElementList);
                } else {
                    throw new ElementParseException(ElementParseException.DUPLICATE_ATTRIBUTE_ELEMENT, "XMLElement has a duplicate attribute " + xmlAttribute.getName(), xmlElementList);
                }
            } else
            if (xmlAttribute.getName().equals("constrnr")){
                if (requirement.constrnr == null){
                    try {requirement.constrnr = Integer.parseInt(xmlAttribute.getValue());}
                    catch (Exception e) {throw new ElementParseException(ElementParseException.NOT_VALID_TYPE_OF_ATTRIBUTE_ELEMENT, "XMLElement has an attribute " + xmlAttribute.getName() + " with an invalid type", xmlElementList);};
                } else {
                    throw new ElementParseException(ElementParseException.DUPLICATE_ATTRIBUTE_ELEMENT, "XMLElement has a duplicate attribute " + xmlAttribute.getName(), xmlElementList);
                }
            } else
            if (xmlAttribute.getName().equals("nr")){
                if (requirement.nr == null){
                    try {requirement.nr = Integer.parseInt(xmlAttribute.getValue());}
                    catch (Exception e) {throw new ElementParseException(ElementParseException.NOT_VALID_TYPE_OF_ATTRIBUTE_ELEMENT, "XMLElement has an attribute " + xmlAttribute.getName() + " with an invalid type", xmlElementList);};
                } else {
                    throw new ElementParseException(ElementParseException.DUPLICATE_ATTRIBUTE_ELEMENT, "XMLElement has a duplicate attribute " + xmlAttribute.getName(), xmlElementList);
                }
            } else
            if (xmlAttribute.getName().equals("reqname")){
                if (requirement.reqname == null){
                    requirement.reqname = xmlAttribute.getValue();
                } else {
                    throw new ElementParseException(ElementParseException.DUPLICATE_ATTRIBUTE_ELEMENT, "XMLElement has a duplicate attribute " + xmlAttribute.getName(), xmlElementList);
                }
            } else
            if (xmlAttribute.getName().equals("absnr")){
                if (requirement.absnr == null){
                    try {requirement.absnr = Integer.parseInt(xmlAttribute.getValue());}
                    catch (Exception e) {throw new ElementParseException(ElementParseException.NOT_VALID_TYPE_OF_ATTRIBUTE_ELEMENT, "XMLElement has an attribute " + xmlAttribute.getName() + " with an invalid type", xmlElementList);};
                } else {
                    throw new ElementParseException(ElementParseException.DUPLICATE_ATTRIBUTE_ELEMENT, "XMLElement has a duplicate attribute " + xmlAttribute.getName(), xmlElementList);
                }
            } else
            if (xmlAttribute.getName().equals("aid")){
                if (requirement.aid == null){
                    requirement.aid = xmlAttribute.getValue();
                } else {
                    throw new ElementParseException(ElementParseException.DUPLICATE_ATTRIBUTE_ELEMENT, "XMLElement has a duplicate attribute " + xmlAttribute.getName(), xmlElementList);
                }
            } else
                throw new ElementParseException(ElementParseException.NOT_VALID_ATTRIBUTE_ELEMENT, "XMLElement has not a valid attribute " + xmlAttribute.getName(), xmlElementList);
        }

        if (!xmlElement.isEmpty()){
            while (true){
                xmlElement = xmlElementList.peek();
                if (xmlElement == null){
                    throw new ElementParseException(ElementParseException.UNEXPECTED_END_OF_FILE, "Unexpected end of XMLElement list");
                }
                if (xmlElement.getName().equals(NAME) && xmlElement.isEndElement()){
                    xmlElement = xmlElementList.poll();
                    break;
                }
                throw new ElementParseException(ElementParseException.NOT_VALID_ELEMENT, "The XMLElement " + xmlElement.getName() + " is not valid in " + NAME, xmlElementList);
            }
        }

        return requirement;
    }
View Full Code Here

        return requirement;
    }

    public LinkedList<XMLElement> getXMLElementList() {
        LinkedList<XMLElement> xmlElementList = new LinkedList<XMLElement>();
        XMLElement xmlElement = new XMLElement(NAME);
        if (this.constrkind != null) {
            XMLAttribute xmlAttribute = new XMLAttribute("constrkind", this.constrkind.name());
            xmlElement.getXMLAttributeList().add(xmlAttribute);
        }
        if (this.constrnr != null) {
            XMLAttribute xmlAttribute = new XMLAttribute("constrnr", this.constrnr);
            xmlElement.getXMLAttributeList().add(xmlAttribute);
        }
        if (this.nr != null) {
            XMLAttribute xmlAttribute = new XMLAttribute("nr", this.nr);
            xmlElement.getXMLAttributeList().add(xmlAttribute);
        }
        if (this.reqname != null) {
            XMLAttribute xmlAttribute = new XMLAttribute("reqname", this.reqname);
            xmlElement.getXMLAttributeList().add(xmlAttribute);
        }
        if (this.absnr != null) {
            XMLAttribute xmlAttribute = new XMLAttribute("absnr", this.absnr);
            xmlElement.getXMLAttributeList().add(xmlAttribute);
        }
        if (this.aid != null) {
            XMLAttribute xmlAttribute = new XMLAttribute("aid", this.aid);
            xmlElement.getXMLAttributeList().add(xmlAttribute);
        }
        boolean isEmpty = true;
        xmlElement.setEmpty(isEmpty);
        xmlElementList.add(xmlElement);
        if (!isEmpty) {
            xmlElement = new XMLElement(NAME);
            xmlElement.setEndElement(true);
            xmlElementList.add(xmlElement);
        }
        return xmlElementList;
    }
View Full Code Here

        return parentNode;
    }

    public static Cluster newInstance(INode parentNode, LinkedList<XMLElement> xmlElementList) throws ElementParseException {
        Cluster cluster = new Cluster(parentNode);
        XMLElement xmlElement = xmlElementList.poll();
        if (!xmlElement.getName().equals(NAME)){
            throw new ElementParseException(ElementParseException.NOT_VALID_ELEMENT, "XMLElement is a " + xmlElement.getName() + " not a " + NAME, xmlElementList);
        }

        if (!xmlElement.isEmpty()){
            while (true){
                xmlElement = xmlElementList.peek();
                if (xmlElement == null){
                    throw new ElementParseException(ElementParseException.UNEXPECTED_END_OF_FILE, "Unexpected end of XMLElement list");
                }
                if (xmlElement.getName().equals(NAME) && xmlElement.isEndElement()){
                    xmlElement = xmlElementList.poll();
                    break;
                }
                if (xmlElement.getName().equals("Adjective")){
                    cluster.adjectiveList.add(Adjective.newInstance(cluster, xmlElementList));
                } else
                    throw new ElementParseException(ElementParseException.NOT_VALID_ELEMENT, "The XMLElement " + xmlElement.getName() + " is not valid in " + NAME, xmlElementList);
            }
        }

        return cluster;
    }
View Full Code Here

        return cluster;
    }

    public LinkedList<XMLElement> getXMLElementList() {
        LinkedList<XMLElement> xmlElementList = new LinkedList<XMLElement>();
        XMLElement xmlElement = new XMLElement(NAME);
        boolean isEmpty = !(!adjectiveList.isEmpty());
        xmlElement.setEmpty(isEmpty);
        xmlElementList.add(xmlElement);
        for (Adjective adjective : this.adjectiveList){
            xmlElementList.addAll(adjective.getXMLElementList());
        }
        if (!isEmpty) {
            xmlElement = new XMLElement(NAME);
            xmlElement.setEndElement(true);
            xmlElementList.add(xmlElement);
        }
        return xmlElementList;
    }
View Full Code Here

        return parentNode;
    }

    public static Schemes newInstance(INode parentNode, LinkedList<XMLElement> xmlElementList) throws ElementParseException {
        Schemes schemes = new Schemes(parentNode);
        XMLElement xmlElement = xmlElementList.poll();
        if (!xmlElement.getName().equals(NAME)){
            throw new ElementParseException(ElementParseException.NOT_VALID_ELEMENT, "XMLElement is a " + xmlElement.getName() + " not a " + NAME, xmlElementList);
        }
        for (XMLAttribute xmlAttribute : xmlElement.getXMLAttributeList()){
            if (xmlAttribute.getName().equals("aid")){
                if (schemes.aid == null){
                    schemes.aid = xmlAttribute.getValue();
                } else {
                    throw new ElementParseException(ElementParseException.DUPLICATE_ATTRIBUTE_ELEMENT, "XMLElement has a duplicate attribute " + xmlAttribute.getName(), xmlElementList);
                }
            } else
            if (xmlAttribute.getName().equals("mizfiles")){
                if (schemes.mizfiles == null){
                    schemes.mizfiles = xmlAttribute.getValue();
                } else {
                    throw new ElementParseException(ElementParseException.DUPLICATE_ATTRIBUTE_ELEMENT, "XMLElement has a duplicate attribute " + xmlAttribute.getName(), xmlElementList);
                }
            } else
                throw new ElementParseException(ElementParseException.NOT_VALID_ATTRIBUTE_ELEMENT, "XMLElement has not a valid attribute " + xmlAttribute.getName(), xmlElementList);
        }

        if (!xmlElement.isEmpty()){
            while (true){
                xmlElement = xmlElementList.peek();
                if (xmlElement == null){
                    throw new ElementParseException(ElementParseException.UNEXPECTED_END_OF_FILE, "Unexpected end of XMLElement list");
                }
                if (xmlElement.getName().equals(NAME) && xmlElement.isEndElement()){
                    xmlElement = xmlElementList.poll();
                    break;
                }
                if (xmlElement.getName().equals("Signature")){
                    if (schemes.signature == null) {
                        schemes.signature = Signature.newInstance(schemes, xmlElementList);
                    } else {
                        throw new ElementParseException(ElementParseException.DUPLICATE_ELEMENT, "XMLElement list contains a duplicated <Signature> in element " + NAME, xmlElementList);
                    }
                } else if (xmlElement.getName().equals("Scheme")){
                    schemes.schemeList.add(Scheme.newInstance(schemes, xmlElementList));
                } else
                    throw new ElementParseException(ElementParseException.NOT_VALID_ELEMENT, "The XMLElement " + xmlElement.getName() + " is not valid in " + NAME, xmlElementList);
            }
        }

        return schemes;
    }
View Full Code Here

TOP

Related Classes of org.mizartools.utility.xml.XMLElement

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.