Priti's Technical Corner

October 29, 2008

XML Questions

Filed under: XML — Tags: , , — pritisolanki @ 8:35 am

Question 1: what is CDATA?
Answer 1: CDATA stands for “character data”. The string kept in CDATA in XML will not be parsed by parser. It will simply be considered as string.

Example:

<![CDATA[You & Me]]>

Question 2: What is Tree based and DOM based parsers.
Answer 2:

Tree Based Parser

1.XML Data is treated as tree based structure. In term of nodes

2.It store the complete XML structure in memory

3.It can validate your XML data.

4.DOM based parsers are document-centric. i.e. when your intention is complete XML.

5.DOM based parser is suitable for xml data to be read repeatedly or out of sequence order.

Event Based Parser.

1.Event Based parser are those parsers which sees XML data as series of event like opening element, closing element , access node etc.

2.It cann’t validate your data as event-based parser does not load whole data in memory.

3.It loads part of the XML data into memory

4.Event-based parser is suitable for sequential parsing of document

5.Faster then Tree based

Question 3: Which ext you will use in PHP 5 for implementing tree based parser?
Answer 3 :DOMDocument or SimpleXML.

Question 4: What is SimpleXML in php5?
Answer   4: SimpleXML extension provide a easy way to convert XML to an object that can be processed with normal property selectors and array iterators.

Advertisements

Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Create a free website or blog at WordPress.com.

%d bloggers like this: