Error Saving Revision 1
XMLToJSON[{0}]: Either Options or Format must be specified.
Exemple de capture d'écran
Cause
Si l'un des éléments <Options> ou <Format> n'est pas déclaré dans la règle XML vers JSON, le déploiement du proxy d'API échoue.
<Options> est requis si <Format> n'est pas utilisé.
Utilisez l'élément <Format> ou le groupe d'éléments <Options>. Vous ne pouvez pas utiliser à la fois <Format> et <Options>. Les formats prédéfinis sont les suivants : xml.com, yahoo, google et badgerFish.
Diagnostic
Examinez chacune des règles XML vers JSON dans le proxy d'API spécifique où l'échec a eu lieu. S'il existe une règle XML vers JSON dans laquelle l'un des éléments <Options> ou <Format> n'est pas déclaré, alors il s'agit de la cause de l'erreur.
Par exemple, la règle suivante n'a aucun des éléments déclarés :
Si un format inconnu est défini sur l'élément <Format> de la règle XML vers JSON, le déploiement du proxy d'API échoue.
Les formats prédéfinis sont les suivants : xml.com, yahoo, google et badgerFish.
Diagnostic
Identifiez la règle XML vers JSON où l'erreur s'est produite et le format inconnu. Vous trouverez cette information dans le message d'erreur. Par exemple, dans l'erreur suivante, le nom de la règle est WithFormat et le format inconnu est google.com :
Vérifiez que le format inconnu spécifié dans la règle XML vers JSON ayant échoué correspond à la valeur identifiée dans le message d'erreur (étape 1 ci-dessus). Par exemple, la règle suivante spécifie le format google.com, qui correspond au contenu du message d'erreur :
Si le format spécifié n'est pas l'un des formats prédéfinis xml.com, yahoo, google ou badgerFish, alors il s'agit de la cause de l'erreur.
Dans l'exemple de règle XML vers JSON présenté ci-dessus, le format est google.com, ce qui n'est pas un format valide. Par conséquent, le déploiement du proxy d'API échoue avec l'erreur suivante :
XMLToJSON[WithFormat]:UnknownFormatgoogle.com.
Solution
Assurez-vous que le format spécifié dans l'élément <Format> de la règle XML vers JSON est valide. Exemple :
Sauf indication contraire, le contenu de cette page est régi par une licence Creative Commons Attribution 4.0, et les échantillons de code sont régis par une licence Apache 2.0. Pour en savoir plus, consultez les Règles du site Google Developers. Java est une marque déposée d'Oracle et/ou de ses sociétés affiliées.
Dernière mise à jour le 2025/09/08 (UTC).
[[["Facile à comprendre","easyToUnderstand","thumb-up"],["J'ai pu résoudre mon problème","solvedMyProblem","thumb-up"],["Autre","otherUp","thumb-up"]],[["Difficile à comprendre","hardToUnderstand","thumb-down"],["Informations ou exemple de code incorrects","incorrectInformationOrSampleCode","thumb-down"],["Il n'y a pas l'information/les exemples dont j'ai besoin","missingTheInformationSamplesINeed","thumb-down"],["Problème de traduction","translationIssue","thumb-down"],["Autre","otherDown","thumb-down"]],["Dernière mise à jour le 2025/09/08 (UTC)."],[[["\u003cp\u003eAPI proxy deployment fails if the XML to JSON policy lacks either the \u003ccode\u003e<Options>\u003c/code\u003e or \u003ccode\u003e<Format>\u003c/code\u003e element, as one of them is required.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003e<Format>\u003c/code\u003e element in the XML to JSON policy must contain one of the predefined formats: \u003ccode\u003exml.com\u003c/code\u003e, \u003ccode\u003eyahoo\u003c/code\u003e, \u003ccode\u003egoogle\u003c/code\u003e, or \u003ccode\u003ebadgerFish\u003c/code\u003e, or else the proxy deployment will fail.\u003c/p\u003e\n"],["\u003cp\u003eUsing both the \u003ccode\u003e<Format>\u003c/code\u003e and \u003ccode\u003e<Options>\u003c/code\u003e elements within the same XML to JSON policy is not allowed and will result in deployment failure.\u003c/p\u003e\n"],["\u003cp\u003eIf an unknown format is defined within the \u003ccode\u003e<Format>\u003c/code\u003e element of the XML to JSON policy, it will result in a proxy deployment failure with an "Unknown Format" error message.\u003c/p\u003e\n"],["\u003cp\u003eThe error message will contain the name of the policy as well as the format that caused the error.\u003c/p\u003e\n"]]],[],null,["# XML to JSON policy deployment error troubleshooting\n\n*You're viewing **Apigee** and **Apigee hybrid** documentation.\nView [Apigee Edge](https://docs.apigee.com/api-platform/troubleshoot/policies/deployment/xmltojson-deployment-errors) documentation.*\n| Was this troubleshooting playbook helpful? Please let us know by clicking [Send Feedback]().\n\nEitherOptionOrFormat\n--------------------\n\n### Error message\n\nDeployment of the API proxy through either the Apigee UI or API fails with this error message: \n\n```transact-sql\nError Saving Revision [revision_number]\nXMLToJSON[{0}]: Either Options or Format must be specified.\n```\n\n### Example error\n\n Error Saving Revision 1\n XMLToJSON[{0}]: Either Options or Format must be specified.\n\n### Example screenshot\n\n### Cause\n\nIf one of the elements `\u003cOptions\u003e` or `\u003cFormat\u003e` is not declared in the XML to JSON Policy, then the deployment of the API proxy fails.\n\n`\u003cOptions\u003e` is required if `\u003cFormat\u003e` isn't used.\n\nUse either the `\u003cFormat\u003e` element or `\u003cOptions\u003e` element group. You cannot use both `\u003cFormat\u003e` and `\u003cOptions\u003e`. Predefined formats include: `xml.com`, `yahoo`, `google`, and `badgerFish`.\n\n### Diagnosis\n\n1. Examine all the XML to JSON policies in the specific API proxy where the failure has occurred. If there is any XML to JSON policy in which either of the elements `\u003cOptions\u003e` or `\u003cFormat\u003e` is not declared, then that's the cause of the error.\n\n For example, the following policy does not have either of the elements declared: \n\n \u003c?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?\u003e\n \u003cXMLToJSON async=\"false\" continueOnError=\"false\" enabled=\"true\" name=\"XMLToJSON\"\u003e\n \u003cDisplayName\u003eXMLToJSON\u003c/DisplayName\u003e\n \u003cProperties/\u003e\n \u003cOutputVariable\u003eresponse\u003c/OutputVariable\u003e\n \u003cSource\u003eresponse\u003c/Source\u003e\n \u003c/XMLToJSON\u003e\n\n### Resolution\n\nEnsure that the XML of the XML to JSON policy has one of the elements `\u003cOptions\u003e` or `\u003cFormat\u003e` declared in the policy.\n\nExample 1: \n\n \u003c?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?\u003e\n \u003cXMLToJSON async=\"false\" continueOnError=\"false\" enabled=\"true\" name=\"XMLToJSON\"\u003e\n \u003cDisplayName\u003eXMLToJSON\u003c/DisplayName\u003e\n \u003cProperties/\u003e\n \u003cFormat\u003egoogle\u003c/Format\u003e\n \u003cOutputVariable\u003eresponse\u003c/OutputVariable\u003e\n \u003cSource\u003eresponse\u003c/Source\u003e\n \u003c/XMLToJSON\u003e\n\nExample 2: \n\n \u003c?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?\u003e\n \u003cXMLToJSON async=\"false\" continueOnError=\"false\" enabled=\"true\" name=\"XMLToJSON\"\u003e\n \u003cDisplayName\u003eXMLToJSON\u003c/DisplayName\u003e\n \u003cProperties/\u003e\n \u003cOptions\u003e\n \u003cRecognizeNumber\u003etrue\u003c/RecognizeNumber\u003e\n \u003cRecognizeBoolean\u003etrue\u003c/RecognizeBoolean\u003e\n \u003cRecognizeNull\u003etrue\u003c/RecognizeNull\u003e\n \u003c/Options\u003e\n \u003cOutputVariable\u003eresponse\u003c/OutputVariable\u003e\n \u003cSource\u003eresponse\u003c/Source\u003e\n \u003c/XMLToJSON\u003e\n\nUnknownFormat\n-------------\n\n### Error message\n\nDeployment of the API proxy through either the Apigee UI or API fails with this error message: \n\n```transact-sql\nError Saving Revision [revision_number]\nXMLToJSON[policy_name]: Unknown Format [unknown_format].\n```\n\n### Example error\n\n Error Saving Revision 1\n XMLToJSON[WithFormat]: Unknown Format google.com.\n\n### Example screenshot\n\n### Cause\n\nIf the `\u003cFormat\u003e` element within the XML to JSON policy has an unknown format defined, then the deployment of the API proxy fails.\n\nPredefined formats include: `xml.com`, `yahoo`, `google`, and `badgerFish`.\n\n### Diagnosis\n\n1. Identify the XML to JSON policy where the error occurred and the unknown format. You can find this information from the error message. For example, in the following error, the policy name is `WithFormat` and the unknown format is `google.com`:\n\n Error Saving Revision 1\n XMLToJSON[WithFormat]: Unknown Format google.com.\n\n2. Verify that the unknown format specified in the failed XML to JSON policy matches with the value identified in the error message (step #1 above). For example, the following policy specifies the format as `google.com`, which matches what's in the error message:\n\n \u003cXMLToJSON async=\"false\" continueOnError=\"false\" enabled=\"true\" name=\"WithFormat\"\u003e\n \u003cDisplayName\u003eWithFormat\u003c/DisplayName\u003e\n \u003cProperties/\u003e\n \u003cFormat\u003egoogle.com\u003c/Format\u003e\n \u003cOutputVariable\u003eresponse\u003c/OutputVariable\u003e\n \u003cSource\u003eresponse\u003c/Source\u003e\n \u003c/XMLToJSON\u003e\n\n3. If the Format specified is not one among the predefined formats `xml.com`, `yahoo`, `google`, or `badgerFish`, then that's the cause of the error.\n\n In the example XML to JSON Policy shown above, the format is `google.com` which is invalid. Therefore, the deployment of the API Proxy fails with the error: \n\n XMLToJSON[WithFormat]: Unknown Format google.com.\n\n### Resolution\n\nEnsure that the format specified in the `\u003cFormat\u003e` element of the XML to JSON policy\nis valid. For example: \n\n \u003c?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?\u003e\n \u003cXMLToJSON async=\"false\" continueOnError=\"false\" enabled=\"true\" name=\"WithFormat\"\u003e\n \u003cDisplayName\u003eWithFormat\u003c/DisplayName\u003e\n \u003cProperties/\u003e\n \u003cFormat\u003egoogle\u003c/Format\u003e\n \u003cOutputVariable\u003eresponse\u003c/OutputVariable\u003e\n \u003cSource\u003eresponse\u003c/Source\u003e\n \u003c/XMLToJSON\u003e"]]