liveBook · Manning

Xml

As explained in Software Testing with Generative AI

XML is a markup language and data-interchange standard for representing structured information with nested elements and attributes.

XML represents structured test data through nested elements, a root node, and explicitly named fields. Prompt instructions can request the same dataset in XML instead of JSON or another format. section 6.1.1 section 2.4.3

A practical XML-generation prompt specifies:

  • The root element, represented with a # marker. section 6.1.1
  • Each field’s name, data type, and allowed or randomized values. section 6.1.1
  • The required number of XML entries, checked before output. section 6.1.1

Room data

A generated document can place repeated room elements inside a rooms root, with fields for type, beds, accessibility, images, features, and price. The structure may be valid while its values still require review: a single room might receive three beds, or an image URL might point to example.com rather than a real image. section 6.1.1

<rooms>
    <room>
        <room_name>A1</room_name>
        <type>single</type>
        <beds>3</beds>
        <accessible>true</accessible>
        <image>https://example.com/room_a1.jpg</image>
        <description>Cozy room</description>
        <features>
            <feature>Wifi</feature>
            <feature>TV</feature>
        </features>
        <roomPrice>150</roomPrice>
    </room>
    <room>
        <room_name>B2</room_name>
        <type>double</type>
        <beds>2</beds>
        <accessible>false</accessible>
        <image>https://example.com/room_b2.jpg</image>
        <description>Spacious suite</description>
        <features>
            <feature>TV</feature>
            <feature>Safe</feature>
        </features>
        <roomPrice>180</roomPrice>
    </room>
    <room>
        <room_name>C3</room_name>
        <type>single</type>
        <beds>1</beds>
        <accessible>true</accessible>
        <image>https://example.com/room_c3.jpg</image>
        <description>Modern design</description>
        <features>
            <feature>Wifi</feature>
            <feature>Safe</feature>
        </features>
        <roomPrice>130</roomPrice>
    </room>
</rooms>

Inspect a concrete XML listing with nested rooms, repeated features, typed-looking values, and generated placeholder URLs. section 6.1.1

How Software Testing with Generative AI covers it

How deep it goes
Demonstrates root and field conventions plus validation concerns, but stops short of defining XML syntax or processing internals.
Examples
Uses room records with nested features, prices, accessibility values, bed counts, and placeholder image URLs.
What you can do after
Apply it via prompt engineering to request XML datasets, convert structured objects between formats, and verify generated values against requirements.
How it connects
Connects XML with JSON, YAML, structured output, prompt engineering, large language models, and test data generation.

Also explained in

Compare how 5 books explain xml →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Software Testing with Generative AI. The section links point to the parts of the book it draws on.