SlideShare a Scribd company logo
1 of 7
Download to read offline
XML
XML literals



val xml = <xhtml>
             <body>
                <p>Hello, World</p>
             </body>
          </xhtml>
Code and XML
val name = “Scala course”


val xml = <xhtml>
             <body>
                <p>Hello, { name }</p>
             </body>
          </xhtml>
Code and XML 2
val names = List(“Alf”, “Fredrik”)


<ul>{ for (name <- names)
    yield <li>{ name }</li>
}</ul>
XML (de)serialization
val xml = xml.XML.loadFile(“filename.xml”)


xml.XML.saveFull(“filename.xml”, xml,
              “UTF-8”, true, null)
XML parsing
xml  “ul”             // xml.NodeSeq
xml  “li”
xml  “ul”  “li”
xml  “a”  “@href”   // xml.NodeSeq.Empty


<p>Hello</p>.text      // java.lang.String (“Hello”)
XML pattern matching
xml match {
    case <ul>{contents}</ul> => “Unordered list”
    case <ol>{contents}</ol> => “Ordered list”
    case _ => “Something else”
}

More Related Content

Similar to 2.4 xml support

Oracle XML Handling
Oracle XML HandlingOracle XML Handling
Oracle XML Handlingazharpro
 
eXtensible Markup Language (XML)
eXtensible Markup Language (XML)eXtensible Markup Language (XML)
eXtensible Markup Language (XML)Serhii Kartashov
 
Php Simple Xml
Php Simple XmlPhp Simple Xml
Php Simple Xmlmussawir20
 
XML Support: Specifications and Development
XML Support: Specifications and DevelopmentXML Support: Specifications and Development
XML Support: Specifications and DevelopmentPeter Eisentraut
 
Learning spark ch05 - Loading and Saving Your Data
Learning spark ch05 - Loading and Saving Your DataLearning spark ch05 - Loading and Saving Your Data
Learning spark ch05 - Loading and Saving Your Dataphanleson
 
XML Tools for Perl
XML Tools for PerlXML Tools for Perl
XML Tools for PerlGeir Aalberg
 
XSLT 3.0 - new features
XSLT 3.0 - new featuresXSLT 3.0 - new features
XSLT 3.0 - new featuresJakub Malý
 
PostgreSQL's Secret NoSQL Superpowers
PostgreSQL's Secret NoSQL SuperpowersPostgreSQL's Secret NoSQL Superpowers
PostgreSQL's Secret NoSQL SuperpowersAmanda Gilmore
 
SXML: S-expression eXtensible Markup Language
SXML: S-expression eXtensible Markup LanguageSXML: S-expression eXtensible Markup Language
SXML: S-expression eXtensible Markup Languageelliando dias
 
Xml processing in scala
Xml processing in scalaXml processing in scala
Xml processing in scalaKnoldus Inc.
 
Boost Your Environment With XMLDB - UKOUG 2008 - Marco Gralike
Boost Your Environment With XMLDB - UKOUG 2008 - Marco GralikeBoost Your Environment With XMLDB - UKOUG 2008 - Marco Gralike
Boost Your Environment With XMLDB - UKOUG 2008 - Marco GralikeMarco Gralike
 
Coding using jscript test complete
Coding using jscript test completeCoding using jscript test complete
Coding using jscript test completeViresh Doshi
 
Stepping Up : A Brief Intro to Scala
Stepping Up : A Brief Intro to ScalaStepping Up : A Brief Intro to Scala
Stepping Up : A Brief Intro to ScalaDerek Chen-Becker
 

Similar to 2.4 xml support (20)

Oracle XML Handling
Oracle XML HandlingOracle XML Handling
Oracle XML Handling
 
eXtensible Markup Language (XML)
eXtensible Markup Language (XML)eXtensible Markup Language (XML)
eXtensible Markup Language (XML)
 
PostgreSQL and XML
PostgreSQL and XMLPostgreSQL and XML
PostgreSQL and XML
 
XML for bioinformatics
XML for bioinformaticsXML for bioinformatics
XML for bioinformatics
 
Xml & Java
Xml & JavaXml & Java
Xml & Java
 
2310 b 12
2310 b 122310 b 12
2310 b 12
 
Php Simple Xml
Php Simple XmlPhp Simple Xml
Php Simple Xml
 
XML Support: Specifications and Development
XML Support: Specifications and DevelopmentXML Support: Specifications and Development
XML Support: Specifications and Development
 
DB2 Native XML
DB2 Native XMLDB2 Native XML
DB2 Native XML
 
Learning spark ch05 - Loading and Saving Your Data
Learning spark ch05 - Loading and Saving Your DataLearning spark ch05 - Loading and Saving Your Data
Learning spark ch05 - Loading and Saving Your Data
 
XML Tools for Perl
XML Tools for PerlXML Tools for Perl
XML Tools for Perl
 
XSLT 3.0 - new features
XSLT 3.0 - new featuresXSLT 3.0 - new features
XSLT 3.0 - new features
 
PostgreSQL's Secret NoSQL Superpowers
PostgreSQL's Secret NoSQL SuperpowersPostgreSQL's Secret NoSQL Superpowers
PostgreSQL's Secret NoSQL Superpowers
 
SXML: S-expression eXtensible Markup Language
SXML: S-expression eXtensible Markup LanguageSXML: S-expression eXtensible Markup Language
SXML: S-expression eXtensible Markup Language
 
Xml processing in scala
Xml processing in scalaXml processing in scala
Xml processing in scala
 
Xml processing in scala
Xml processing in scalaXml processing in scala
Xml processing in scala
 
Boost Your Environment With XMLDB - UKOUG 2008 - Marco Gralike
Boost Your Environment With XMLDB - UKOUG 2008 - Marco GralikeBoost Your Environment With XMLDB - UKOUG 2008 - Marco Gralike
Boost Your Environment With XMLDB - UKOUG 2008 - Marco Gralike
 
XSLT presentation
XSLT presentationXSLT presentation
XSLT presentation
 
Coding using jscript test complete
Coding using jscript test completeCoding using jscript test complete
Coding using jscript test complete
 
Stepping Up : A Brief Intro to Scala
Stepping Up : A Brief Intro to ScalaStepping Up : A Brief Intro to Scala
Stepping Up : A Brief Intro to Scala
 

Recently uploaded

AI Fame Rush Review – Virtual Influencer Creation In Just Minutes
AI Fame Rush Review – Virtual Influencer Creation In Just MinutesAI Fame Rush Review – Virtual Influencer Creation In Just Minutes
AI Fame Rush Review – Virtual Influencer Creation In Just MinutesMd Hossain Ali
 
Building AI-Driven Apps Using Semantic Kernel.pptx
Building AI-Driven Apps Using Semantic Kernel.pptxBuilding AI-Driven Apps Using Semantic Kernel.pptx
Building AI-Driven Apps Using Semantic Kernel.pptxUdaiappa Ramachandran
 
Empowering Africa's Next Generation: The AI Leadership Blueprint
Empowering Africa's Next Generation: The AI Leadership BlueprintEmpowering Africa's Next Generation: The AI Leadership Blueprint
Empowering Africa's Next Generation: The AI Leadership BlueprintMahmoud Rabie
 
GenAI and AI GCC State of AI_Object Automation Inc
GenAI and AI GCC State of AI_Object Automation IncGenAI and AI GCC State of AI_Object Automation Inc
GenAI and AI GCC State of AI_Object Automation IncObject Automation
 
Unleashing the power of AI in UiPath Studio with UiPath Autopilot.
Unleashing the power of AI in UiPath Studio with UiPath Autopilot.Unleashing the power of AI in UiPath Studio with UiPath Autopilot.
Unleashing the power of AI in UiPath Studio with UiPath Autopilot.DianaGray10
 
Babel Compiler - Transforming JavaScript for All Browsers.pptx
Babel Compiler - Transforming JavaScript for All Browsers.pptxBabel Compiler - Transforming JavaScript for All Browsers.pptx
Babel Compiler - Transforming JavaScript for All Browsers.pptxYounusS2
 
DS Lesson 2 - Subsets, Supersets and Power Set.pdf
DS Lesson 2 - Subsets, Supersets and Power Set.pdfDS Lesson 2 - Subsets, Supersets and Power Set.pdf
DS Lesson 2 - Subsets, Supersets and Power Set.pdfROWELL MARQUINA
 
Tracking license compliance made easy - intro to Grant (OSS)
Tracking license compliance made easy - intro to Grant (OSS)Tracking license compliance made easy - intro to Grant (OSS)
Tracking license compliance made easy - intro to Grant (OSS)Anchore
 
ict grade 12 lesson 2 sinhala medium notes pdf
ict grade 12 lesson 2 sinhala medium notes pdfict grade 12 lesson 2 sinhala medium notes pdf
ict grade 12 lesson 2 sinhala medium notes pdfruhisiya9
 
GDG Cloud Southlake 31: Santosh Chennuri and Festus Yeboah: Empowering Develo...
GDG Cloud Southlake 31: Santosh Chennuri and Festus Yeboah: Empowering Develo...GDG Cloud Southlake 31: Santosh Chennuri and Festus Yeboah: Empowering Develo...
GDG Cloud Southlake 31: Santosh Chennuri and Festus Yeboah: Empowering Develo...James Anderson
 
RAG Patterns and Vector Search in Generative AI
RAG Patterns and Vector Search in Generative AIRAG Patterns and Vector Search in Generative AI
RAG Patterns and Vector Search in Generative AIUdaiappa Ramachandran
 
AI-based audio transcription solutions (IDP)
AI-based audio transcription solutions (IDP)AI-based audio transcription solutions (IDP)
AI-based audio transcription solutions (IDP)KapilVaidya4
 
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCost
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCostKubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCost
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCostMatt Ray
 
AI Health Agents: Longevity as a Service in the Web3 GenAI Quantum Revolution
AI Health Agents: Longevity as a Service in the Web3 GenAI Quantum RevolutionAI Health Agents: Longevity as a Service in the Web3 GenAI Quantum Revolution
AI Health Agents: Longevity as a Service in the Web3 GenAI Quantum RevolutionMelanie Swan
 
COMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online CollaborationCOMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online Collaborationbruanjhuli
 
IEEE Computer Society 2024 Technology Predictions Update
IEEE Computer Society 2024 Technology Predictions UpdateIEEE Computer Society 2024 Technology Predictions Update
IEEE Computer Society 2024 Technology Predictions UpdateHironori Washizaki
 
Plant tissue culture pharmacongosy-1 Semester 4
Plant tissue culture pharmacongosy-1 Semester 4Plant tissue culture pharmacongosy-1 Semester 4
Plant tissue culture pharmacongosy-1 Semester 4Nandakishor Deshmukh
 
Digital magic. A small project for controlling smart light bulbs.
Digital magic. A small project for controlling smart light bulbs.Digital magic. A small project for controlling smart light bulbs.
Digital magic. A small project for controlling smart light bulbs.francesco barbera
 
LLM Threats: Prompt Injections and Jailbreak Attacks
LLM Threats: Prompt Injections and Jailbreak AttacksLLM Threats: Prompt Injections and Jailbreak Attacks
LLM Threats: Prompt Injections and Jailbreak AttacksThien Q. Tran
 
High-Level Synthesis for the Design of AI Chips
High-Level Synthesis for the Design of AI ChipsHigh-Level Synthesis for the Design of AI Chips
High-Level Synthesis for the Design of AI ChipsObject Automation
 

Recently uploaded (20)

AI Fame Rush Review – Virtual Influencer Creation In Just Minutes
AI Fame Rush Review – Virtual Influencer Creation In Just MinutesAI Fame Rush Review – Virtual Influencer Creation In Just Minutes
AI Fame Rush Review – Virtual Influencer Creation In Just Minutes
 
Building AI-Driven Apps Using Semantic Kernel.pptx
Building AI-Driven Apps Using Semantic Kernel.pptxBuilding AI-Driven Apps Using Semantic Kernel.pptx
Building AI-Driven Apps Using Semantic Kernel.pptx
 
Empowering Africa's Next Generation: The AI Leadership Blueprint
Empowering Africa's Next Generation: The AI Leadership BlueprintEmpowering Africa's Next Generation: The AI Leadership Blueprint
Empowering Africa's Next Generation: The AI Leadership Blueprint
 
GenAI and AI GCC State of AI_Object Automation Inc
GenAI and AI GCC State of AI_Object Automation IncGenAI and AI GCC State of AI_Object Automation Inc
GenAI and AI GCC State of AI_Object Automation Inc
 
Unleashing the power of AI in UiPath Studio with UiPath Autopilot.
Unleashing the power of AI in UiPath Studio with UiPath Autopilot.Unleashing the power of AI in UiPath Studio with UiPath Autopilot.
Unleashing the power of AI in UiPath Studio with UiPath Autopilot.
 
Babel Compiler - Transforming JavaScript for All Browsers.pptx
Babel Compiler - Transforming JavaScript for All Browsers.pptxBabel Compiler - Transforming JavaScript for All Browsers.pptx
Babel Compiler - Transforming JavaScript for All Browsers.pptx
 
DS Lesson 2 - Subsets, Supersets and Power Set.pdf
DS Lesson 2 - Subsets, Supersets and Power Set.pdfDS Lesson 2 - Subsets, Supersets and Power Set.pdf
DS Lesson 2 - Subsets, Supersets and Power Set.pdf
 
Tracking license compliance made easy - intro to Grant (OSS)
Tracking license compliance made easy - intro to Grant (OSS)Tracking license compliance made easy - intro to Grant (OSS)
Tracking license compliance made easy - intro to Grant (OSS)
 
ict grade 12 lesson 2 sinhala medium notes pdf
ict grade 12 lesson 2 sinhala medium notes pdfict grade 12 lesson 2 sinhala medium notes pdf
ict grade 12 lesson 2 sinhala medium notes pdf
 
GDG Cloud Southlake 31: Santosh Chennuri and Festus Yeboah: Empowering Develo...
GDG Cloud Southlake 31: Santosh Chennuri and Festus Yeboah: Empowering Develo...GDG Cloud Southlake 31: Santosh Chennuri and Festus Yeboah: Empowering Develo...
GDG Cloud Southlake 31: Santosh Chennuri and Festus Yeboah: Empowering Develo...
 
RAG Patterns and Vector Search in Generative AI
RAG Patterns and Vector Search in Generative AIRAG Patterns and Vector Search in Generative AI
RAG Patterns and Vector Search in Generative AI
 
AI-based audio transcription solutions (IDP)
AI-based audio transcription solutions (IDP)AI-based audio transcription solutions (IDP)
AI-based audio transcription solutions (IDP)
 
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCost
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCostKubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCost
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCost
 
AI Health Agents: Longevity as a Service in the Web3 GenAI Quantum Revolution
AI Health Agents: Longevity as a Service in the Web3 GenAI Quantum RevolutionAI Health Agents: Longevity as a Service in the Web3 GenAI Quantum Revolution
AI Health Agents: Longevity as a Service in the Web3 GenAI Quantum Revolution
 
COMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online CollaborationCOMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online Collaboration
 
IEEE Computer Society 2024 Technology Predictions Update
IEEE Computer Society 2024 Technology Predictions UpdateIEEE Computer Society 2024 Technology Predictions Update
IEEE Computer Society 2024 Technology Predictions Update
 
Plant tissue culture pharmacongosy-1 Semester 4
Plant tissue culture pharmacongosy-1 Semester 4Plant tissue culture pharmacongosy-1 Semester 4
Plant tissue culture pharmacongosy-1 Semester 4
 
Digital magic. A small project for controlling smart light bulbs.
Digital magic. A small project for controlling smart light bulbs.Digital magic. A small project for controlling smart light bulbs.
Digital magic. A small project for controlling smart light bulbs.
 
LLM Threats: Prompt Injections and Jailbreak Attacks
LLM Threats: Prompt Injections and Jailbreak AttacksLLM Threats: Prompt Injections and Jailbreak Attacks
LLM Threats: Prompt Injections and Jailbreak Attacks
 
High-Level Synthesis for the Design of AI Chips
High-Level Synthesis for the Design of AI ChipsHigh-Level Synthesis for the Design of AI Chips
High-Level Synthesis for the Design of AI Chips
 

2.4 xml support

  • 1. XML
  • 2. XML literals val xml = <xhtml> <body> <p>Hello, World</p> </body> </xhtml>
  • 3. Code and XML val name = “Scala course” val xml = <xhtml> <body> <p>Hello, { name }</p> </body> </xhtml>
  • 4. Code and XML 2 val names = List(“Alf”, “Fredrik”) <ul>{ for (name <- names) yield <li>{ name }</li> }</ul>
  • 5. XML (de)serialization val xml = xml.XML.loadFile(“filename.xml”) xml.XML.saveFull(“filename.xml”, xml, “UTF-8”, true, null)
  • 6. XML parsing xml “ul” // xml.NodeSeq xml “li” xml “ul” “li” xml “a” “@href” // xml.NodeSeq.Empty <p>Hello</p>.text // java.lang.String (“Hello”)
  • 7. XML pattern matching xml match { case <ul>{contents}</ul> => “Unordered list” case <ol>{contents}</ol> => “Ordered list” case _ => “Something else” }