DOC PREVIEW
Columbia COMS W4115 - TweaXML

This preview shows page 1-2-3-4-5-6-7-51-52-53-54-55-56-57-58-102-103-104-105-106-107-108 out of 108 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 108 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 108 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 108 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 108 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 108 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 108 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 108 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 108 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 108 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 108 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 108 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 108 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 108 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 108 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 108 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 108 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 108 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 108 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 108 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 108 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 108 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 108 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 108 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Programming Languages and TranslatorsCOMS W4115Prof. Stephen EdwardsTweaXMLFinal ReportBy:Kaushal Kumar([email protected])Srinivasa Valluripalli([email protected])Contents1. Introduction ………………………………………………………………. 3- Abstract- Introduction2. Language Features ……………………………………………………………….. 43. Language Tutorial ……………………………………………………………….. 64. Language Manual ………………………………………………………………. 10 5. Project Plan ………………………………………………………………. 23- Project Processes- Project Timeline- Roles and Responsibilities- Software Development Environment- Project Log6. Architectural Design ………………………………………………………………. 267. Test Plan ………………………………………………………………. 278. Lessons Learned ………………………………………………………………. 309. Appendix ………………………………………………………………. 31- Code Listing1. IntroductionAbstractIn this document, we present the description, tutorial, sample programs and test classesfor TweaXML, a high level language for manipulation of XML documents. We will discuss the motivation behind the idea and key features of the language. IntroductionTweaXML is a simple language that helps us manipulate and perform various operations on XML documents, like extracting specific data, performing arithmetic/string operations on the extracted data and saving the data in a desired format to a file.The Extensible Markup Language (XML) is a general-purpose markup language. It is classified as an extensible language because it allows the users to define their own tags. XML is designed primarily to share information across heterogeneous systems, regardless of the specific architecture or language of the systems. It is adopted as an interoperable language across various technologies and component vendors, for example, it is used to share data across J2EE components and .NET components.Since XML is highly customizable and contains user-defined tags, the technologies to parse an XML document are quite complex. For example, Java provides APIs, like SAX and DOM Parsers to parse XML documents, but they are quite complex and require a thorough knowledge of Java. Therefore we have implemented TweaXML, a language which will be easy to use and will require minimal amount of a prior knowledge of programming to get started right away. TweaXML will enable a novice user to manipulate and operate on XML documents, extract its data, and do arithmetic/string operations on it and save it in a desired format.2. Language FeaturesData Typesstring – Data type containing data of character and string types.file – Data type for writing file on a file system.node – Data type for a XML element.int – Standard int data type.OperatorsArithmetic Operators:+ (addition)- (subtraction)* (multiplication)/ (division)= (assignment)== (equal)> (greater than)< (less than)>= (greater than or equal to)<= (less than or equal to)!= (not equal to)Scope Operators:“{“ , “}”“(“ , “)”// commentLooping constructs:If() {…} else {…}While(){…}FOREACH(){…}Methods available on STRING, NODE and FILE data-types:STRING:If the string variable represents a number, arithmetic operations can be done on it using following inbuilt functions:add str1 str2 - adds two numbers. Concatenates them if both of them are not numbers.subtract str1 str2 – subtracts the two numbers represented by str1 and str2. It throws a runtime exception if they are not numbers.multiply str1 str2 – multiplies the two numbers represented by str1 and str2. It throws a runtime exception if they are not numbers.divide str1 str2 – divide the two numbers represented by str1 and str2. It throws a runtime exception if they are not numbers.NODE:getchild node path_to_child_node – gives an arraylist of child nodes defined by xpath (given as the 2nd argument).length nodes[] – gives the number of nodes present in the nodes array.getvalue node – gives the value of the node (in string format).FILE:open path_of_input_file – opens the input xml file to read and returns the root node.create path_of_output_file – creates an output file to write and returns a file data type.Close file_name – closes the output file after all the operations are done.3. Language TutorialTweaXML is designed to handle XML files, extract data from it, do arithmetic/string operations on it and write the data in an output format in desired format. This tutorial will help programmers learn TweaXML as quickly and easily as possible.Before we get started on the programs, lets look at the input file for the following set of the programs.<students><student><name>kaushal</name><homework1>85</homework1><homework2>85</homework2><midterm>70</midterm><final>90</final></student><student><name>Srini</name><homework1>80</homework1><homework2>85</homework2><midterm>87</midterm><final>95</final></student></students>This input file contains the information about each student’s marks in a class for various exams. The final aim is to parse this input xml file and extract the data and calculate average marks of each student.2.1 TweaXML program:This program shows how to open an XML file to read, extract the child nodes of a node and get the value of a node. Also it will show how to use various statements like if, else, while etc.start(){file output;node rootNode;output = create "AvgMarks.csv";rootNode = open "marks_data.xml";node studentNodes[];studentNodes = getchild rootNode "student";int len;len = length studentNodes;if(len > 0){int j;j=0;while(j < len){node nameNode[], homework1Node[], homework2Node[], midtermNode[], finalNode[];string name, homework1Marks, homework2Marks, midtermMarks, finalMarks;nameNode = getchild studentNodes[j] "name";homework1Node = getchild studentNodes[j] "homework1";homework2Node = getchild studentNodes[j] "homework2";midtermNode = getchild studentNodes[j] "midterm";finalNode = getchild studentNodes[j] "final";name = getvalue nameNode[0];homework1Marks = getvalue homework1Node[0];homework2Marks = getvalue


View Full Document

Columbia COMS W4115 - TweaXML

Documents in this Course
YOLT

YOLT

13 pages

Lattakia

Lattakia

15 pages

EasyQL

EasyQL

14 pages

Photogram

Photogram

163 pages

Espresso

Espresso

27 pages

NumLang

NumLang

6 pages

EMPATH

EMPATH

14 pages

La Mesa

La Mesa

9 pages

JTemplate

JTemplate

238 pages

MATVEC

MATVEC

4 pages

TONEDEF

TONEDEF

14 pages

SASSi

SASSi

16 pages

JTemplate

JTemplate

39 pages

BATS

BATS

10 pages

Synapse

Synapse

11 pages

c.def

c.def

116 pages

Load more
Download TweaXML
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view TweaXML and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view TweaXML 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?