CSC/ECE 517 Fall 2015/oss/M1503/IntegrateXMLParser: Difference between revisions

From Expertiza_Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 1: Line 1:
== Rust ==
== Rust ==


Rust is a general-purpose, compiled programming language developed by Mozilla Research. The syntax of [[Rust]] is somewhat  similar to [[C]] and [[C++]], with blocks of code delimited by curly brackets, and control flow and structure. Rust does not use automatic [[garbage collection]] mechanism similar to [[java]]. It accomplishes the goals of memory safe without using garbage collection and it supports concurrency and parallelism in building platforms.
Rust is a general-purpose, compiled programming language developed by Mozilla Research. The syntax of [[Rust]] is somewhat  similar to [[C]] and [[C++]], with blocks of code delimited by curly brackets, and control flow and structure. Rust does not use automatic [[garbage collection]] mechanism similar to [[java]]. It accomplishes the goals of memory safe without using garbage collection and it supports concurrency and parallelism in building platforms.


== Servo ==
== Servo ==


Servo is web browser layout engine developed by Mozilla Research. It was developed in Rust. Servo handles parallel environments such as rendering, layout, image decoding as a separate tasks. Servo provides [[API]]s, [[JavaScript]] support. Servo was not developed explicitly to create full web browser but to achieve maximum parallelism.
Servo is web browser layout engine developed by Mozilla Research. It was developed in Rust. Servo handles parallel environments such as rendering, layout, image decoding as a separate tasks. Servo provides [[API]]s, [[JavaScript]] support. Servo was not developed explicitly to create full web browser but to achieve maximum parallelism.


== Compilation and Build ==
== Compilation and Build ==
Line 14: Line 11:
Code link: https://github.com/servo/servo/ . This repository is forked to https://github.com/ronak6892/servo .
Code link: https://github.com/servo/servo/ . This repository is forked to https://github.com/ronak6892/servo .
Build success is ensured by commands ./mach build --dev and ./mach run tests/html/about-mozilla.html.
Build success is ensured by commands ./mach build --dev and ./mach run tests/html/about-mozilla.html.


== Project Description ==
== Project Description ==


Servo currently lacks a parser for [[XML]] documents, which prevents implementation of several APIs. The goal of the project is to integrate xml5ever parser into Servo.
Servo currently lacks a parser for [[XML]] documents, which prevents implementation of several APIs. The goal of the project is to integrate xml5ever parser into Servo.


== Design ==
== Design ==
Line 25: Line 20:
To integrate XML5ever, dependency was added for XML5ever parser similar to HTML5ever.A separate interface was defined in ServoXMLParser webidl file and this interface was implemented in its corresponding rust file along with necessary stubs to parse XML.  
To integrate XML5ever, dependency was added for XML5ever parser similar to HTML5ever.A separate interface was defined in ServoXMLParser webidl file and this interface was implemented in its corresponding rust file along with necessary stubs to parse XML.  
The Adapter Design Pattern was applied to enhance parsing mechanism for XML5 in Servo. Interface defined using adapter pattern closely resembles servoHTMLParser interface as this will facilitate parsing or modifying any code for both XML and [[HTML]] documents and future reader don't have to understand code for both separately as they are related in their functionality.
The Adapter Design Pattern was applied to enhance parsing mechanism for XML5 in Servo. Interface defined using adapter pattern closely resembles servoHTMLParser interface as this will facilitate parsing or modifying any code for both XML and [[HTML]] documents and future reader don't have to understand code for both separately as they are related in their functionality.


== Initial Implementation ==
== Initial Implementation ==
Line 38: Line 32:


Called parse_xml from domparser.rs located at components/script/dom this will help compile.
Called parse_xml from domparser.rs located at components/script/dom this will help compile.


== Challenges ==
== Challenges ==


Primary challenge is to continuously sync with the latest commits of servo and ensuring build success after integrating each step. And keep on adding of necessary stubs as per the new changes in parsing mechanism also need continuous and careful efforts.
Primary challenge is to continuously sync with the latest commits of servo and ensuring build success after integrating each step. And keep on adding of necessary stubs as per the new changes in parsing mechanism also need continuous and careful efforts.


== Subsequent steps for final project ==
== Subsequent steps for final project ==
Line 54: Line 46:


Implement XMLDocument API by following the documentation and implementing the steps laid out in the specification for the load method.
Implement XMLDocument API by following the documentation and implementing the steps laid out in the specification for the load method.


== External Links ==
== External Links ==


HTML5ever - https://github.com/servo/html5ever/
HTML5ever - https://github.com/servo/html5ever/
Line 66: Line 56:


YouTube - https://youtu.be/i8dONOzYwlc
YouTube - https://youtu.be/i8dONOzYwlc


== References ==
== References ==

Revision as of 01:55, 1 November 2015

Rust

Rust is a general-purpose, compiled programming language developed by Mozilla Research. The syntax of Rust is somewhat similar to C and C++, with blocks of code delimited by curly brackets, and control flow and structure. Rust does not use automatic garbage collection mechanism similar to java. It accomplishes the goals of memory safe without using garbage collection and it supports concurrency and parallelism in building platforms.

Servo

Servo is web browser layout engine developed by Mozilla Research. It was developed in Rust. Servo handles parallel environments such as rendering, layout, image decoding as a separate tasks. Servo provides APIs, JavaScript support. Servo was not developed explicitly to create full web browser but to achieve maximum parallelism.

Compilation and Build

Code link: https://github.com/servo/servo/ . This repository is forked to https://github.com/ronak6892/servo . Build success is ensured by commands ./mach build --dev and ./mach run tests/html/about-mozilla.html.

Project Description

Servo currently lacks a parser for XML documents, which prevents implementation of several APIs. The goal of the project is to integrate xml5ever parser into Servo.

Design

To integrate XML5ever, dependency was added for XML5ever parser similar to HTML5ever.A separate interface was defined in ServoXMLParser webidl file and this interface was implemented in its corresponding rust file along with necessary stubs to parse XML. The Adapter Design Pattern was applied to enhance parsing mechanism for XML5 in Servo. Interface defined using adapter pattern closely resembles servoHTMLParser interface as this will facilitate parsing or modifying any code for both XML and HTML documents and future reader don't have to understand code for both separately as they are related in their functionality.

Initial Implementation

To achieve project goal we have done following initial steps.

Complied servo and add xml5ever as a dependency to the script using cargo package manager. To do this we edited Cargo.toml located at components/script by adding xml5ever as a dependency.

Added xml.rs at components/script/parse with parse_xml() as a function. mod.rs also need to be modified in order to declare file.

Added ServoXMLParser interface with necessary stubs in servoxmlparser.rs located at components/script/dom. Also servoxmlparser need to be declared in mod.rs located at components/script/dom.

Called parse_xml from domparser.rs located at components/script/dom this will help compile.

Challenges

Primary challenge is to continuously sync with the latest commits of servo and ensuring build success after integrating each step. And keep on adding of necessary stubs as per the new changes in parsing mechanism also need continuous and careful efforts.

Subsequent steps for final project

Modify ScriptTask::load in script_task.rs to recognize the text/xml content type and call parse_xml instead of parse_html as appropriate, while passing the appropriate flag to the Document constructor.

Implement a TreeSink for the XML parser that performs appropriate tree modifications for each action.

Implement support in xmlhttprequest.rs for XML document responses (see step 7 in https://xhr.spec.whatwg.org/#document-response).

Implement XMLDocument API by following the documentation and implementing the steps laid out in the specification for the load method.

External Links

HTML5ever - https://github.com/servo/html5ever/

XML5ever - https://github.com/Ygg01/xml5ever

Pull request - https://github.com/servo/servo/pull/8278

YouTube - https://youtu.be/i8dONOzYwlc

References

Servo Documentation - http://doc.servo.org/servo/index.html

Project Definition - https://github.com/servo/servo/wiki/Integrate-xml5ever

Rust Documentation - https://doc.rust-lang.org/nightly/index.html