XML Schema Validation Using Java API for XML Processing

  • Shene Jalil Jamal Computer Department, College of Science, University of Sulaimani, Sulaymaniyah, Kurdistan Region, Iraq
  • Chnoor M. Rahman Department of Applied Computer, College of Medical and Applied Sciences, Charmo University, Chamchamal, Sulaymaniyah, Kurdistan Region, Iraq
  • Mzhda S. Abdulkarim Department of Applied Computer, College of Medical and Applied Sciences, Charmo University, Chamchamal, Sulaymaniyah, Kurdistan Region, Iraq
Keywords: XML Schema, XSD, JAXP, DTD, Java.

Abstract

Extensible Markup Language (XML) is a markup language that is developed to organize the structure of information in a text file. The data in XML formatted documents are represented by specifying a number of tags and determining the structural relationship between those tags. It has a simple structure and can be handled by any text editor. Therefore, XML formatted data is being commonly used to transfer and share data between different applications and organizations without having to convert the format of the data (Yang, 2019).

  In the XML world, “well-formed” and “valid” are the two most frequently used terms. A well-formed XML document is free from errors that can cause the document to not parse, such as: spelling, punctuation, grammar, and syntax errors. While in addition to having a well-formed markup, a valid XML must conform to a document type definition, this means the document must be semantically correct and matches a described standard of schemas and relationships (Appel, 2020).There are two standards of document type definition that can be used to validate an XML document, one is DTD or Document Type Definition which is used to identify the legal structure and names the legal elements of an XML document (Dykes and Tittel, 2011), and the other is XSD or XML Schema Definition. XSD is a diagrammatic representation that defines the valid structure of an XML document, it enables specifying the building blocks of an XML data set such as elements and attributes and their data types, number of child elements, fixed and default values of the elements and attributes that can appear in the documents (XML Schema Tutorial, 2020). In some applications the process of validating XML documents is combined with parsing the document. However, in some other cases the process of parsing and validating the XML documents need to be separated. This study focuses on constructing a separate XML document validator and validating XML documents against the defined XSD rules. A Java program is used to perform this experiment. Furthermore, the critical differences between XSD and DTD are also mentioned.

 

Downloads

Download data is not yet available.

Author Biographies

Shene Jalil Jamal, Computer Department, College of Science, University of Sulaimani, Sulaymaniyah, Kurdistan Region, Iraq

Shene Jalil Jamal: works at the Computer Department, College of Science, University of Sulaimani, Sulaymaniyah, Kurdistan Region, Iraq.

Chnoor M. Rahman, Department of Applied Computer, College of Medical and Applied Sciences, Charmo University, Chamchamal, Sulaymaniyah, Kurdistan Region, Iraq

Chnoor Rahman: is a PhD holder at the Department of Applied Computer, College of Medical and Applied Sciences, Charmo University, Chamchamal, Sulaymaniyah, Kurdistan Region, Iraq.

Mzhda S. Abdulkarim, Department of Applied Computer, College of Medical and Applied Sciences, Charmo University, Chamchamal, Sulaymaniyah, Kurdistan Region, Iraq

Mzhda S. Abudlkarim : works at the Department of Applied Computer, College of Medical and Applied Sciences, Charmo University, Chamchamal, Sulaymaniyah, Kurdistan Region, Iraq.

References

Ali, U. (2012). Difference between dtd and xsd. Slideshare. Retrieved 01 November 2021 from https://www.slideshare.net/umarali1981/difference-between-dtd-and-xsd.
Appel, R. (2020). Create well-formed XML and schema efficiently | The .NET Tools Blog. JetBrains Blog. Retrieved 01 October 2021 from https://blog.jetbrains.com/dotnet/2020/09/29/create-well-formed-xml-and-schema-efficiently-rider.
Dykes, L. and Tittel, E. (2011). XML For Dummies (4th ed.). Wiley.
Gandhi, M. (2014). W3c XML Schema 1.1 for Beginners (1st ed.). Reed Business Education.
Geroimenko, V. (2012). Dictionary of XML Technologies and the Semantic Web (illustrated ed.). Springer Publishing.
Henry, S. and Gao, S. (2012). W3C XML Schema Definition Language (XSD) 1.1 Part 1: Structures -- Review Version. W3C Recommendations. Retrieved 12 October 2021 from https://www.w3.org/TR/xmlschema11-1/structures.diff-1.0.html.
Joan, B. (2011). XML Schema and DTD. Difference Between. Retrieved 02 November 2021 from http://www.differencebetween.net/technology/difference-between-xml-schema-and-dtd.
Lawton, G. (2015). XSD (XML Schema Definition). WhatIs.Com. Retrieved 08 October 2021 from https://whatis.techtarget.com/definition/XSD-XML-Schema-Definition.
Li, C. (2009). XML Parsing, SAX/DOM. University of Texas at Arlington. Retrieved 15 June 2021 from https://ranger.uta.edu/~cli/pubs/2009/XMLParsing_ChengkaiLi.pdf.
McKinnon, L. and McKinnon, A. (2003). XML in 60 Minutes a Day (1st ed.). Wiley.
Nagrare, S. (2020a). Difference Between DOM and SAX ? DOM vs Sax Easy Explain. Easy Difference Between. Retrieved 20 November 2021 from https://easydifferencebetween.com/difference-between-dom-and-sax/.
Nagrare, S. (2020b). Difference Between DOM and SAX ? DOM vs Sax Easy Explain. Easy Difference Between. Retrieved 20 November 2021 from https://easydifferencebetween.com/difference-between-dom-and-sax/.
Owen, D. and Boyer, W. (Eds.). (2011). Exam 70–432: Microsoft SQL Server 2008 Implementation and Maintenance with Lab Manual Set (1st ed.). Wiley.
Tidwell, D. (2008). XSLT: Mastering XML Transformations (2nd ed.). O’Reilly Media.
Vohra, A. and Vohra, D. (2007a). Introducing Schema Validation. In Pro XML Development with Java Technology (1st ed. pp. 65–66)). Apress.
Vohra, A. and Vohra, D. (2007b). Introducing XML and Java. In Pro XML Development with Java Technology (1st ed., pp. 1–31). Apress.
W3Schools. (2021). An XML Document [Illustration]. W3Schools. Retrieved 20 November 2021 from http://www.w3schools.com/xml/schema_example.asp.
XML Schema Tutorial. (2020). W3schools. Retrieved 02 October 2021 from https://www.w3schools.com:443/Xml/schema_intro.asp.
Yang, H. (2019). XML Tutorials - Herong’s Tutorial Examples. [online] Google Books. HerongYang.com. Retrieved 15 June 2021 from https://books.google.iq/books?id=zKoDEAAAQBAJ&pg=PA13&dq=introduction+to+xml&hl=en&sa=X&ved=2ahUKEwjZs43ega_4AhXXkmoFHY31DaY4HhDoAXoECAoQAg#v=onepage&q=introduction%20to%20xml&f=false.
Published
2022-06-30
How to Cite
Jamal, S., Rahman, C., & Abdulkarim, M. (2022, June 30). XML Schema Validation Using Java API for XML Processing. UKH Journal of Science and Engineering, 6(1), 33-41. https://doi.org/https://doi.org/10.25079/ukhjse.v6n1y2022.pp33-41
Section
Research Articles
Share |