SlideShare une entreprise Scribd logo
1  sur  12
Télécharger pour lire hors ligne
Disclaimer: This presentation is prepared
by trainees of baabtra as a part of
mentoring program. This is not official
document of baabtra –Mentoring Partner
Baabtra-Mentoring Partner is the mentoring division of baabte System
Technologies Pvt . Ltd
Typing Speed
Week

Targ
et

Achieve
d

1

20

18

2

25

23

3

30

27

4

50

38
Jobs Applied
#

Company

Designation

Applied
Date

Current
Status

1

Skillsearch limited

Python developer

7/08/13

No status

2

ioss

php developer

20/08/13

Not selected

3
XML parsing in python
●

Shameena

●

shameenavayoli@gmail.com

●

www.facebook.com/shameenalatheef

●

twitter.com/shameena

●

in.linkedin.com/in/shamean

●

9567135569
What is xml?
→ extensible markup language
→ it is portable
XML Parser Architectures and APIs
→ T he two most basic and broadly used
APIs to XML data are the SAX and DOM
interfaces.
Simple API for XML (SAX) :
→ T his is useful when your documents are larg e or
you have memorylimitations
→ SAX is read-only

Parsing XML with SAX APIs:
→ SAX is a standard interface for event-driven XML parsing
→requires you tocreate your own
subclassing xml.sax.ContentHandler.

ContentHandler

by

→ T he methods startDocument and endDocument are called
at the start and the end of the XML file

●

●
→ T he ContentHandler is called at the start and end
of each element.
The parse Method:
xml.sax.parse( xmlfile, contenthandler[,
errorhandler])
→ xmlfile:T his is the name of the XML file to read
from
→ contenthandler: This must be a ContentHandler
object
→ errorhandler: If specified, errorhandler must be a
SAX ErrorHandler object.
●

●

●
Parsing XML with DOM APIs
→ The Document Object Model, or "DOM," is a
cross-language API from the World Wide Web
Consortium(W3C) for accessing and modifying XML
documents.

→ The DOM is extremely useful for randomaccess applications
→Easiest way to quickly load an XML document
and to create a minidom object using the xml
from lxml import etree
from StringIO import StringIO
def parseXML(xmlFile):
f = open(xmlFile)
xml = f.read()
f.close()
tree= etree.parse(StringIO(xml))
print tree.docinfo.doctype
c=etree.iterparse(StringIO(xml)'''
c = etree.iterparse(xmlFile) # other method
for action,entry in c:
text = entry.text
print entry.tag + " => " + text
if __name__ == "__main__":
parseXML('movie.xml')
If this presentation helped you, please
visit our page facebook.com/baabtra and
like it.

Thanks in advance. 
 
www.baabtra.com | www.massbaab.com |
www.baabte.com
Contact Us
Emarald Mall (Big
Bazar Building)
Mavoor Road,
Kozhikode,
Kerala, India.
Ph: + 91 – 495 40 25
550

Start up Village
Eranakulam,
Kerala, India.
Email:
info@baabtra.com

NC Complex,
Near Bus
Stand
Mukkam,
Kozhikode,
Kerala, India.
Ph: + 91 –
495 40 25
550

Contenu connexe

Tendances

Tendances (20)

Basics of XML
Basics of XMLBasics of XML
Basics of XML
 
Xml basics for beginning
Xml basics for beginningXml basics for beginning
Xml basics for beginning
 
uptu web technology unit 2 Xml2
uptu web technology unit 2 Xml2uptu web technology unit 2 Xml2
uptu web technology unit 2 Xml2
 
Unit 2.3
Unit 2.3Unit 2.3
Unit 2.3
 
uptu web technology unit 2 Xml2
uptu web technology unit 2 Xml2uptu web technology unit 2 Xml2
uptu web technology unit 2 Xml2
 
SAX, DOM & JDOM parsers for beginners
SAX, DOM & JDOM parsers for beginnersSAX, DOM & JDOM parsers for beginners
SAX, DOM & JDOM parsers for beginners
 
uptu web technology unit 2 Xml2
uptu web technology unit 2 Xml2uptu web technology unit 2 Xml2
uptu web technology unit 2 Xml2
 
Parsing XML Data
Parsing XML DataParsing XML Data
Parsing XML Data
 
Introduction to XML and Databases
Introduction to XML and DatabasesIntroduction to XML and Databases
Introduction to XML and Databases
 
Unit 2.3
Unit 2.3Unit 2.3
Unit 2.3
 
Sax parser
Sax parserSax parser
Sax parser
 
uptu web technology unit 2 Xml2
uptu web technology unit 2 Xml2uptu web technology unit 2 Xml2
uptu web technology unit 2 Xml2
 
XML/XSLT
XML/XSLTXML/XSLT
XML/XSLT
 
Learning XSLT
Learning XSLTLearning XSLT
Learning XSLT
 
Normalizing Data for Migrations
Normalizing Data for MigrationsNormalizing Data for Migrations
Normalizing Data for Migrations
 
Xml and DTD's
Xml and DTD'sXml and DTD's
Xml and DTD's
 
Intro to XML in libraries
Intro to XML in librariesIntro to XML in libraries
Intro to XML in libraries
 
Xml
XmlXml
Xml
 
Xml dom
Xml domXml dom
Xml dom
 
Java XML Parsing
Java XML ParsingJava XML Parsing
Java XML Parsing
 

Similaire à Xml passing in python

Introductionto Xm Lmessaging
Introductionto Xm LmessagingIntroductionto Xm Lmessaging
Introductionto Xm Lmessaging
LiquidHub
 

Similaire à Xml passing in python (20)

Xml parsing in codeigniter
Xml parsing in codeigniterXml parsing in codeigniter
Xml parsing in codeigniter
 
Xml and xml processor
Xml and xml processorXml and xml processor
Xml and xml processor
 
First Steps in Python Programming
First Steps in Python ProgrammingFirst Steps in Python Programming
First Steps in Python Programming
 
Interop 2015: Hardly Enough Theory, Barley Enough Code
Interop 2015: Hardly Enough Theory, Barley Enough CodeInterop 2015: Hardly Enough Theory, Barley Enough Code
Interop 2015: Hardly Enough Theory, Barley Enough Code
 
CrashCourse: XML technologies
CrashCourse: XML technologiesCrashCourse: XML technologies
CrashCourse: XML technologies
 
XML
XMLXML
XML
 
Automating API Documentation
Automating API DocumentationAutomating API Documentation
Automating API Documentation
 
Xml
XmlXml
Xml
 
Unit 5
Unit 5Unit 5
Unit 5
 
Django Introdcution
Django IntrodcutionDjango Introdcution
Django Introdcution
 
Python Session - 2
Python Session - 2Python Session - 2
Python Session - 2
 
lf-2003_01-0269
lf-2003_01-0269lf-2003_01-0269
lf-2003_01-0269
 
lf-2003_01-0269
lf-2003_01-0269lf-2003_01-0269
lf-2003_01-0269
 
Introductionto Xm Lmessaging
Introductionto Xm LmessagingIntroductionto Xm Lmessaging
Introductionto Xm Lmessaging
 
Monitoring.pptx
Monitoring.pptxMonitoring.pptx
Monitoring.pptx
 
Processing XML with Java
Processing XML with JavaProcessing XML with Java
Processing XML with Java
 
Xml
XmlXml
Xml
 
Markdown - friend or foe?
Markdown - friend or foe?Markdown - friend or foe?
Markdown - friend or foe?
 
Terraform in production - experiences, best practices and deep dive- Piotr Ki...
Terraform in production - experiences, best practices and deep dive- Piotr Ki...Terraform in production - experiences, best practices and deep dive- Piotr Ki...
Terraform in production - experiences, best practices and deep dive- Piotr Ki...
 
XML Tutor maXbox starter27
XML Tutor maXbox starter27XML Tutor maXbox starter27
XML Tutor maXbox starter27
 

Plus de baabtra.com - No. 1 supplier of quality freshers

Plus de baabtra.com - No. 1 supplier of quality freshers (20)

Agile methodology and scrum development
Agile methodology and scrum developmentAgile methodology and scrum development
Agile methodology and scrum development
 
Best coding practices
Best coding practicesBest coding practices
Best coding practices
 
Core java - baabtra
Core java - baabtraCore java - baabtra
Core java - baabtra
 
Acquiring new skills what you should know
Acquiring new skills   what you should knowAcquiring new skills   what you should know
Acquiring new skills what you should know
 
Baabtra.com programming at school
Baabtra.com programming at schoolBaabtra.com programming at school
Baabtra.com programming at school
 
99LMS for Enterprises - LMS that you will love
99LMS for Enterprises - LMS that you will love 99LMS for Enterprises - LMS that you will love
99LMS for Enterprises - LMS that you will love
 
Php sessions & cookies
Php sessions & cookiesPhp sessions & cookies
Php sessions & cookies
 
Php database connectivity
Php database connectivityPhp database connectivity
Php database connectivity
 
Chapter 6 database normalisation
Chapter 6  database normalisationChapter 6  database normalisation
Chapter 6 database normalisation
 
Chapter 5 transactions and dcl statements
Chapter 5  transactions and dcl statementsChapter 5  transactions and dcl statements
Chapter 5 transactions and dcl statements
 
Chapter 4 functions, views, indexing
Chapter 4  functions, views, indexingChapter 4  functions, views, indexing
Chapter 4 functions, views, indexing
 
Chapter 3 stored procedures
Chapter 3 stored proceduresChapter 3 stored procedures
Chapter 3 stored procedures
 
Chapter 2 grouping,scalar and aggergate functions,joins inner join,outer join
Chapter 2  grouping,scalar and aggergate functions,joins   inner join,outer joinChapter 2  grouping,scalar and aggergate functions,joins   inner join,outer join
Chapter 2 grouping,scalar and aggergate functions,joins inner join,outer join
 
Chapter 1 introduction to sql server
Chapter 1 introduction to sql serverChapter 1 introduction to sql server
Chapter 1 introduction to sql server
 
Chapter 1 introduction to sql server
Chapter 1 introduction to sql serverChapter 1 introduction to sql server
Chapter 1 introduction to sql server
 
Microsoft holo lens
Microsoft holo lensMicrosoft holo lens
Microsoft holo lens
 
Blue brain
Blue brainBlue brain
Blue brain
 
5g
5g5g
5g
 
Aptitude skills baabtra
Aptitude skills baabtraAptitude skills baabtra
Aptitude skills baabtra
 
Gd baabtra
Gd baabtraGd baabtra
Gd baabtra
 

Dernier

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Dernier (20)

Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 

Xml passing in python

  • 1.
  • 2. Disclaimer: This presentation is prepared by trainees of baabtra as a part of mentoring program. This is not official document of baabtra –Mentoring Partner Baabtra-Mentoring Partner is the mentoring division of baabte System Technologies Pvt . Ltd
  • 4. Jobs Applied # Company Designation Applied Date Current Status 1 Skillsearch limited Python developer 7/08/13 No status 2 ioss php developer 20/08/13 Not selected 3
  • 5. XML parsing in python ● Shameena ● shameenavayoli@gmail.com ● www.facebook.com/shameenalatheef ● twitter.com/shameena ● in.linkedin.com/in/shamean ● 9567135569
  • 6. What is xml? → extensible markup language → it is portable XML Parser Architectures and APIs → T he two most basic and broadly used APIs to XML data are the SAX and DOM interfaces.
  • 7. Simple API for XML (SAX) : → T his is useful when your documents are larg e or you have memorylimitations → SAX is read-only Parsing XML with SAX APIs: → SAX is a standard interface for event-driven XML parsing →requires you tocreate your own subclassing xml.sax.ContentHandler. ContentHandler by → T he methods startDocument and endDocument are called at the start and the end of the XML file ● ●
  • 8. → T he ContentHandler is called at the start and end of each element. The parse Method: xml.sax.parse( xmlfile, contenthandler[, errorhandler]) → xmlfile:T his is the name of the XML file to read from → contenthandler: This must be a ContentHandler object → errorhandler: If specified, errorhandler must be a SAX ErrorHandler object. ● ● ●
  • 9. Parsing XML with DOM APIs → The Document Object Model, or "DOM," is a cross-language API from the World Wide Web Consortium(W3C) for accessing and modifying XML documents. → The DOM is extremely useful for randomaccess applications →Easiest way to quickly load an XML document and to create a minidom object using the xml
  • 10. from lxml import etree from StringIO import StringIO def parseXML(xmlFile): f = open(xmlFile) xml = f.read() f.close() tree= etree.parse(StringIO(xml)) print tree.docinfo.doctype c=etree.iterparse(StringIO(xml)''' c = etree.iterparse(xmlFile) # other method for action,entry in c: text = entry.text print entry.tag + " => " + text if __name__ == "__main__": parseXML('movie.xml')
  • 11. If this presentation helped you, please visit our page facebook.com/baabtra and like it. Thanks in advance.    www.baabtra.com | www.massbaab.com | www.baabte.com
  • 12. Contact Us Emarald Mall (Big Bazar Building) Mavoor Road, Kozhikode, Kerala, India. Ph: + 91 – 495 40 25 550 Start up Village Eranakulam, Kerala, India. Email: info@baabtra.com NC Complex, Near Bus Stand Mukkam, Kozhikode, Kerala, India. Ph: + 91 – 495 40 25 550