Analyseur XML
XML (Extensible Markup Language) est un langage de balisage pour l'encodage de données structurées. Bien que JSON ait remplacé XML pour de nombreuses API web, XML reste essentiel pour les systèmes d'entreprise, les services web SOAP et les fichiers de configuration. Cet outil analyse et met en forme le XML avec une indentation correcte.
Specifications
Cas d'utilisation courants
- Formater les requêtes et réponses API SOAP
- Lire et valider les fichiers Maven pom.xml
- Analyser le contenu des flux RSS et Atom
- Déboguer les fichiers de mise en page XML Android
- Traiter les fichiers graphiques SVG
- Inspecter les fichiers de configuration .NET (web.config, app.config)
Fonctionnalites
- Mise en forme avec indentation correcte
- Préserver les espaces de noms et préfixes
- Gérer les sections CDATA et les instructions de traitement
- Afficher les attributs aux côtés des éléments
- Convertir en JSON pour un traitement programmatique plus facile
- Valider la structure XML bien formée
Exemples
Maven POM
Essayer →Un modèle d'objet de projet Maven définissant les dépendances.
<?xml version="1.0" encoding="UTF-8"?>
<project>
<groupId>com.example</groupId>
<artifactId>my-app</artifactId>
<version>1.0.0</version>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13</version>
</dependency>
</dependencies>
</project>Conseils
- XML est sensible à la casse. <User> et <user> sont des éléments différents.
- Tous les éléments doivent être correctement fermés. Utilisez <br/> pour les balises auto-fermantes.
- Les valeurs d'attributs doivent être entre guillemets (simples ou doubles).
- Utilisez les sections CDATA pour le contenu contenant des caractères < ou &.
Comprendre Analyseur XML
XML (Extensible Markup Language) is a W3C standard for encoding structured data in a format that is both human-readable and machine-parseable. Unlike HTML, which has a fixed set of tags, XML lets you define your own elements and attributes, making it a meta-language for creating domain-specific markup languages. The 1.0 specification was published in 1998 and remains widely used.
XML's defining feature is its strict syntax. Every opening tag must have a closing tag (or be self-closing). Attributes must be quoted. Elements must be properly nested. A document that follows these rules is "well-formed." A document that additionally conforms to a schema (DTD, XML Schema, or RELAX NG) is "valid." This strictness makes XML reliable for data interchange between systems that may be built with different technologies.
Namespaces are XML's mechanism for avoiding element name collisions. A namespace is a URI associated with a prefix (xmlns:soap="..."), ensuring that <soap:Envelope> and <html:body> can coexist in the same document without ambiguity. Namespaces are essential in SOAP web services, SAML assertions, SVG graphics, and any document that combines vocabularies.
While JSON has replaced XML for most web APIs due to its lighter syntax, XML remains dominant in enterprise integration (SOAP, EDI), document formats (DOCX, XLSX, ODF), configuration (Maven pom.xml, .NET web.config, Android layouts), syndication (RSS, Atom), and vector graphics (SVG). Understanding XML is essential for working with legacy systems, enterprise software, and document processing pipelines.
Well-formed XML follows the basic syntax rules: proper nesting, closed tags, quoted attributes, and a single root element. Any XML parser can read well-formed XML. Valid XML goes further — it conforms to a schema (DTD, XML Schema, or RELAX NG) that defines which elements and attributes are allowed, their order, and their data types. Validation is optional but important for data interchange where both parties need to agree on the document structure.
Namespaces prevent element name collisions by associating elements with a URI. A namespace is declared with xmlns:prefix="URI" and then used as a prefix on elements (<prefix:element>). The default namespace (xmlns="URI" without a prefix) applies to the element and its unqualified descendants. The URI does not need to point to an actual resource — it serves only as a unique identifier. CDATA sections (<![CDATA[ ... ]]>) provide a way to include content that contains characters like < and & without escaping them as < and &. This is useful for embedding JavaScript, SQL queries, or HTML fragments inside XML elements.
XML offers several features that JSON lacks: namespaces for combining vocabularies, schemas for formal validation, attributes for metadata alongside element content, processing instructions, mixed content (text interleaved with elements), and XSLT for declarative transformation. XML is the better choice for document-oriented data, complex enterprise integrations, and scenarios requiring formal contracts between systems. JSON is better suited for simple data interchange in web applications where its lighter syntax and universal tooling support are more important than XML's structural richness.