Parsing of XML files in CDM
Summarize
Summary of Parsing of XML files in CDM
The CDM XML parser in the Zurich release enables ServiceNow customers to upload and manage configuration data from XML files by parsing attribute key-value pairs. This functionality converts XML attributes into a JSON format within CDM, making it easier to distinguish and manipulate configuration data attributes in the CDM editor and list views.
Show less
Important: DevOps Config is deprecated and no longer supported for new activations.
Key Features
- Converts XML attribute key-value pairs into JSON format when importing config data into CDM.
- Prefixes attribute keys with @ in JSON to clearly identify them as XML element attributes.
- Uses a #text key in JSON to represent the enclosing text of XML elements that have both attributes and text content.
- Supports validation of imported CSV data with attributes for deployment within CDM.
- Enables conversion back from JSON to XML by requiring the same @ prefix and #text key conventions, preserving the original XML attribute and text structure upon export.
Practical Application
When importing an XML file, the parser automatically converts attributes and text to JSON format with clear markers, facilitating easier editing and review of configuration data in CDM. For example, attributes like type="B2C" in XML become "@type": "B2C" in JSON, and enclosed text content is stored under the #text key.
To export configuration data back to XML with accurate attributes and text, ensure that JSON keys use the @ prefix for attributes and #text for element text.
Benefits for ServiceNow Customers
- Streamlines the process of uploading and managing complex configuration data from XML files within CDM.
- Improves clarity and differentiation of attributes versus element data in the CDM UI.
- Supports accurate data validation and deployment readiness by preserving attribute structures.
- Maintains data fidelity when exporting configuration data back to XML format.
The CDM XML parser enables the parsing of attribute key-value pairs in XML files, so when you upload config data from an XML file into CDM, you can easily identify the attributes of each element in the CDM editor or list view.
- Uploading existing config data from an XML file, including the attributes of XML elements as appropriate key-value pairs in JSON.
- Differentiating attributes from the config data items easily in the CDM editor.
- Validating imported CSV data with attributes in CDM for deployment.
- Converting attribute key-value pairs in JSON format as XML element attributes in XML file.
Parsing of XML to JSON during import
- Adds the @ prefix to all key names corresponding to attributes of XML elements.
- Adds a #text key for the enclosing text value of XML elements that have both attributes and enclosing text.
- XML format
<app> <components> <paymentService type="B2C"> <provider region="EMEA">ABCPay</provider> <service>XYZPay</service> </paymentService> </components> <app>- JSON format
{ "app" : { "components" : { "paymentService" : { //key-value pair for XML elements with attributes "@type" : "B2C", // @ prefix for attribute "provider" : { "@region" : "EMEA", // @ prefix to key name for attribute "#text" : "ABCPay" // #text key name for enclosing text }, "service" : "XYZPay" //key-value pair for XML elements without attributes } } } }
Parsing of JSON to XML during export
- Add the @ prefix to all key names to make them parse as attributes of XML elements.
- Add keys named #text to CDIs that should be parsed as the enclosing text value of XML elements, when both attributes and enclosing text are present.