By YiyaoPublished Updated
Choose the records before converting
XML can describe a document, a hierarchy or a set of repeated records. A CSV table needs a clear decision about what counts as one row. Start by selecting the repeated record element, then map the fields that belong to that record.
Choose Preview CSV before downloading. Check the header, row count and at least one representative record with a missing or repeated field.
Define the row and column contract
| Decision | Example | Result to inspect |
|---|---|---|
| Record element | Each item beneath catalog | One output row per selected item |
| Attribute | @id | The @id column keeps leading zeros |
| Child text | name | Text in the name column |
| Optional field | A missing price element | An empty field, not an invented zero |
| Repeated child | tag | The tag column joins values with “ | ” |
Use namespace-aware selection when element names share prefixes or namespaces. Two elements with similar display names are not necessarily the same field. If the source file fails to parse, check its XML syntax before changing the record path or field mapping.
Check a two-record example
Set the record path to /catalog/item and enter @id, name, price and tag on separate lines. Item 001 has name Desk, oak, price 29.00 and two tag children (wood and sale). Item 002 has name Chair and one tag (wood), with no price.
| @id | name | price | tag |
|---|---|---|---|
| 001 | Desk, oak | 29.00 | wood | sale |
| 002 | Chair | wood |
The first name contains a comma, so CSV serialization must quote that field. The missing price remains empty. The preview should contain two records, not one catalog row or four rows created by treating child elements as separate records.
CSV carries text fields, not a full type system. When opening the file in a spreadsheet, import the identifier column as text to keep 001 and 002.
Handle nested and repeated values deliberately
Each selected item produces one row. When a field path matches multiple child values in that item, the converter joins them in one cell with the separator “ | ”.
Compare the number of selected items with the preview row count. For the example above, the first tag cell reads wood | sale and the preview contains two rows.
Keep the mapping with the exported file so that another person can reproduce it. A tidy table without a known mapping is difficult to audit later. If the receiving application needs structured data instead of table rows, convert the XML to JSON and compare the resulting structure with the source.
Prepare a safe handoff
Inspect cells beginning with spreadsheet formula characters before opening untrusted content in a spreadsheet. Offer a separate spreadsheet-safe export that neutralizes those cells and explains the transformation. Preserve raw data only for a controlled importer that needs the exact source value.
When your starting point is a web page, collect the permitted content first, then extract or obtain the XML records. Crawler Console's documented HTML or Markdown output is not automatically an XML dataset.
FAQ and next step
Can every XML file become a useful CSV? Document-style XML with mixed text and nested sections may need a custom mapping. Record-oriented XML is a more natural fit.
How are repeated child values exported? Each selected record produces one row. Repeated values for the same field are joined with “ | ” in one cell.
Should an empty price become zero? Keep it empty unless the receiving data contract explicitly defines missing prices as zero.
