SlideServe
Menu
Préférences
© SlideServe · v2026

XML Challenges and Solutions: Understanding Attributes, Elements, and More

mahon avatar
11 diapositives · 251 Views · Aug 29, 2014

This guide addresses common XML problems and their solutions, such as deciding between attributes and elements, managing DOM performance, and handling binary data. It covers serialization issues in Java, the relationship between XML and relational databases, encoding challenges, and how to publish XML content as HTML using XSL stylesheets. Additionally, it provides insights into browser support for XML standards, ensuring your XML documents are well-structured and accessible. Connect with the latest practices in XML to enhance your applications.

XML Challenges and Solutions: Understanding Attributes, Elements, and More - slide 1
01 / 11XML Challenges and Solutions: Understanding Attributes, Elements, and More
1 / 17

Télécharger la présentation

XML Challenges and Solutions: Understanding Attributes, Elements, and More
Une image / un lien ci-dessous est fourni (tel quel) pour télécharger la présentation

Politique de téléchargement : le contenu du site vous est fourni TEL QUEL pour votre information et votre usage personnel ; il ne peut être vendu, concédé sous licence ni partagé sur d’autres sites sans l’accord de son auteur.Le contenu vous est fourni TEL QUEL, pour votre information et votre usage personnel uniquement. Téléchargez la présentation en cliquant sur ce lien. Lors du téléchargement, si vous ne parvenez pas à télécharger une présentation, l’éditeur a peut-être supprimé le fichier de son serveur.Pendant le téléchargement, si vous ne parvenez pas à obtenir une présentation, le fichier a peut-être été supprimé par l’éditeur.

F I N

Plus de contenu associé

Transcription de la présentation
  1. XML Problems and Solutions Andy Clark 17 Apr 2002

  2. Attributes vs. Elements • Problem: • I can't decide between using attributes and elements. • Solution: • With DTDs, attributes offer limited "datatype" support but are less flexible. XML Schema (among other schema languages) have true datatype support and can be used for attribute and element content.

  3. DOM Performance • Problem: • The DOM tree uses a lot of memory. • Solution: • Don't use DOM. Instead, use a SAX parser and build custom, efficient data structures as needed.

  4. Java Serialization of DOM • Problem: • I want to use RMI to serialize my document to a remote object but it's not working. • Solution: • DOM tree implementations are not required to be serializable. And since the XML format is a more efficient representation than Java serialization, use a serializable object that writes XML and re-parse the document on the remote end.

  5. Relational Databases • Problem: • I have heard XML is the next "big thing". Do I have to throw away my relational database? • Solution: • All of the major relational database vendors are incorporating XML support into their products. Your legacy data is safe and will play well with all of the new kids in town.

  6. Binary Data in XML • Problem: • I want to embed binary data in my document but the parser complains about invalid characters. • Solution: • The XML specification does not allow all Unicode characters to appear in a document. The binary data must be encoded using legal XML characters (e.g. base64). The application is then responsible for decoding the information.

  7. Invalid Encoding • Problem: • I am using ISO Latin 1 characters in my document but my parser doesn't like it. • Solution: • You must specify the proper encoding in the XML Declaration line of your XML file. The encoding name for ISO Latin 1 is "ISO-8859-1". By default, XML parsers assume "UTF-8". [Note that ASCII is equivalent to UTF-8 chars 0-127.] • e.g. <?xml version=‘1.0’ encoding=‘ISO-8859-1’?>

  8. Publish as HTML • Problem: • I want my customers to view an HTML version of my XML data. What can I do? • Solution: • Use XSL stylesheets to transform your XML documents into HTML. Using stylesheets separates the content from the presentation and makes it easy to change the "look & feel" of your website without changing your data.

  9. Browser Support • Problem: • Can I use the DOM and XSL in browsers on the client side? • Solution: • Some of the latest browsers have support for latest DOM and XSL standards (e.g. IE 6.0+). Best suggestion is to statically generate the pages, if applicable, or dynamically generate the HTML on the server side (e.g. using servlets).

  10. Useful Links • World Wide Web Consortium (W3C) • http://www.w3.org/ • XML.com • http://www.xml.com/

  11. XML Problems and Solutions Andy Clark