{"id":28332807,"url":"https://github.com/dinochiesa/apigee-java-edit-xml-node","last_synced_at":"2025-06-10T19:13:45.764Z","repository":{"id":147637051,"uuid":"52071370","full_name":"DinoChiesa/Apigee-Java-Edit-Xml-Node","owner":"DinoChiesa","description":"a custom policy for Apigee, implemented in Java, which edits an XML document: adds a Node (element or attribute) to a document, modifies a Node, or removes a node. This is offered as a possibly friendlier alternative to using XSLT.","archived":false,"fork":false,"pushed_at":"2024-06-17T17:16:35.000Z","size":570,"stargazers_count":0,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-26T20:28:28.048Z","etag":null,"topics":["apigee","java","xml"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/DinoChiesa.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-02-19T07:59:52.000Z","updated_at":"2024-06-17T17:16:39.000Z","dependencies_parsed_at":null,"dependency_job_id":"d7d6bf1a-a9f8-4e8c-9233-aa8fc4b9036d","html_url":"https://github.com/DinoChiesa/Apigee-Java-Edit-Xml-Node","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DinoChiesa%2FApigee-Java-Edit-Xml-Node","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DinoChiesa%2FApigee-Java-Edit-Xml-Node/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DinoChiesa%2FApigee-Java-Edit-Xml-Node/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DinoChiesa%2FApigee-Java-Edit-Xml-Node/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DinoChiesa","download_url":"https://codeload.github.com/DinoChiesa/Apigee-Java-Edit-Xml-Node/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DinoChiesa%2FApigee-Java-Edit-Xml-Node/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259133000,"owners_count":22810513,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["apigee","java","xml"],"created_at":"2025-05-26T20:22:27.741Z","updated_at":"2025-06-10T19:13:45.754Z","avatar_url":"https://github.com/DinoChiesa.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Apigee Edit Xml Node\n\nThis directory contains the Java source code and pom.xml file required to\ncompile a simple custom policy for Apigee. The policy adds a node to an XML\ndocument, replaces a node in a document, or removes a node from a document.\n\nSuppose you have a document like this:\n```xml\n \u003csoap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\"\u003e\n  \u003csoap:Header/\u003e\n  \u003csoap:Body\u003e\n    \u003cact:test xmlns:act=\"http://yyyy.com\"\u003e\n      \u003cabc\u003e\n        \u003cact:demo\u003efokyCS2jrkE5s+bC25L1Aax5sK....08GXIpwlq3QBJuG7a4Xgm4Vk\u003c/act:demo\u003e\n      \u003c/abc\u003e\n    \u003c/act:test\u003e\n  \u003c/soap:Body\u003e\n\u003c/soap:Envelope\u003e\n```\n\nAnd you'd like to replace the text node in the middle of that\ndocument with something else, maybe the decrypted version of that\nstring. This policy lets you do that, allowing you to transform the\nabove into this:\n\n```xml\n\u003csoap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\"\u003e\n  \u003csoap:Header/\u003e\n  \u003csoap:Body\u003e\n    \u003cact:test xmlns:act=\"http://yyyy.com\"\u003e\n      \u003cabc\u003e\n        \u003cact:demo\u003edecrypted-text-here\u003c/act:demo\u003e\n      \u003c/abc\u003e\n    \u003c/act:test\u003e\n  \u003c/soap:Body\u003e\n\u003c/soap:Envelope\u003e\n```\n\nToday, in Apigee, you could do this with an XSLT policy and an XSLT module.\nBut many people don't want to write or maintain XSLT.  This policy allows you to\naccomplish the task with No coding required!  [This policy does not perform decryption, just XML surgery.]\n\nIn addition to allowing you to replace a node in a document, this policy also\nallows you to remove a single node (an attribute or element) from an XML document, or to insert a single\nnode into an XML document. Again, you could do this with XSLT, but ... then you'd have\nto code XSLT. This callout is just an alternative.\n\n\n## Disclaimer\n\nThis example is not an official Google product, nor is it part of an\nofficial Google product.\n\n\n## Using this policy\n\nYou do not need to build the source code in order to use the policy\nin Apigee.  All you need is the built JAR, and the appropriate\nconfiguration for the policy.  If you want to build it, feel free.\nThe instructions are at the bottom of this readme.\n\n\n1. copy the jar file, available in  target/apigee-custom-edit-xml-node-20240614.jar , if you have built the jar, or in [the repo](bundle/apiproxy/resources/java/apigee-custom-edit-xml-node-20240614.jar) if you have not, to your apiproxy/resources/java directory. You can do this offline, or using the graphical Proxy Editor in the Apigee Admin Portal.\n\n2. include an XML file for the Java callout policy in your\n   apiproxy/resources/policies directory. It should look\n   like this:\n   ```xml\n    \u003cJavaCallout name='Java-EditXmlNode-1'\u003e\n        ...\n      \u003cClassName\u003ecom.google.apigee.callouts.EditXmlNode\u003c/ClassName\u003e\n      \u003cResourceURL\u003ejava://apigee-custom-edit-xml-node-20240614.jar\u003c/ResourceURL\u003e\n    \u003c/JavaCallout\u003e\n   ```\n\n3. use the Apigee administrative UI, or a command-line tool like [importAndDeploy.js](https://github.com/DinoChiesa/apigee-edge-js/blob/master/examples/importAndDeploy.js) or similar to\n   import the proxy into an Apigee organization, and then deploy the proxy .\n   Eg,\n   ```\n   node ./importAndDeploy.js -v -o $ORG -e $ENV -d ./bundle\n   ```\n\n4. Use a client to generate and send http requests to the proxy you just deployed . Eg,\n   ```\n   curl -i -X POST -H content-type:text/xml \\\n     'https://$ORG-$ENV.apigee.net/edit-xml-node/t1?texttoadd=seven\u0026xpath=/root/a/text()' \\\n     -d '\u003croot\u003e\u003ca\u003ebeta\u003c/a\u003e\u003c/root\u003e'\n   ```\n\n\n## Notes on Usage\n\nThere is one callout class, com.google.apigee.callouts.EditXmlNode.\n\nThe policy is configured via properties set in the XML.  You can set these properties:\n\n\n| property name     | status    | description                               |\n| ----------------- |-----------|-------------------------------------------|\n| action            | Required  | append, insert-before, replace, or remove |\n| xpath             | Required  | the xpath to resolve to a single node in the source document. |\n| source            | Optional  | the source xml document. This should be the name of a context variable. If you omit this property, the policy will use \"message.content\" as the source. |\n| new-node-type     | Required* | should be one of element, attribute, text. |\n| new-node-text     | Required* | Depending on the value of new-node-type, this must take a value that corresponds to an element, attribute, or text node.  For an element, eg, `\u003cfoo\u003ebar\u003c/foo\u003e`.  For an attribute, do not use any quotes.  Eg, `attr1=value`  Or, for a Text node, any text string. |\n| output-variable   | Optional  | the name of a variable to hold the result. If not present, the result is placed into \"message.content\". |\n\n\n*The new-node-type and new-node-text are not required if removing a node. When you do use new-node-type, the type of the node to which the `xpath` resolves must match the `new-node-type` you specify in the configuration.  In other words, you can replace a text node with a text node. Or, you can replace an element with an element. Or you can use `insert-before` to insert an additional attribute before an existing attribute. You cannot use this policy to replace, for example, an element with a text node. Or to append a text node to an attribute. or to `insert-before` on an attribute if the result of the xpath reference is an element. All of this should make sense.\n\nNB: There is no support for namespace-qualified attributes.\n\n\n## Example Policy Configurations\n\n### Appending an Element\n\n```xml\n\u003cJavaCallout name='Java-InsertXmlNode-1'\u003e\n  \u003cProperties\u003e\n    \u003cProperty name='source'\u003erequest.content\u003c/Property\u003e\n    \u003cProperty name='new-node-type'\u003eelement\u003c/Property\u003e\n    \u003cProperty name='new-node-text'\u003e\u003cFoo\u003etext-value\u003c/Foo\u003e\u003c/Property\u003e\n    \u003cProperty name='xpath'\u003e{request.queryparam.xpath}\u003c/Property\u003e\n    \u003cProperty name='action'\u003eappend\u003c/Property\u003e\n  \u003c/Properties\u003e\n  \u003cClassName\u003ecom.google.apigee.callouts.EditXmlNode\u003c/ClassName\u003e\n  \u003cResourceURL\u003ejava://apigee-custom-edit-xml-node-20240614.jar\u003c/ResourceURL\u003e\n\u003c/JavaCallout\u003e\n```\n\n\n### Replacing a text node\n\n```xml\n\u003cJavaCallout name='Java-ReplaceXmlNode-1'\u003e\n  \u003cProperties\u003e\n    \u003cProperty name='source'\u003erequest.content\u003c/Property\u003e\n    \u003cProperty name='new-node-type'\u003etext\u003c/Property\u003e\n    \u003cProperty name='new-node-text'\u003e{request.queryparam.texttoinsert}\u003c/Property\u003e\n    \u003cProperty name='xpath'\u003e{request.queryparam.xpath}\u003c/Property\u003e\n    \u003cProperty name='action'\u003ereplace\u003c/Property\u003e\n    \u003cProperty name='output-variable'\u003emy_variable\u003c/Property\u003e\n  \u003c/Properties\u003e\n  \u003cClassName\u003ecom.google.apigee.callouts.EditXmlNode\u003c/ClassName\u003e\n  \u003cResourceURL\u003ejava://apigee-custom-edit-xml-node-20240614.jar\u003c/ResourceURL\u003e\n\u003c/JavaCallout\u003e\n```\n\n### Replacing a text node using XML namespaces\n\nAny property name that begins with `xmlns:` is treated as an xml prefix and namespace by the custom policy. The policy can use any of these namespaces for xpath resolution. You must specify a prefix to apply an xpath to a document that uses namespaces. Of course the prefix you use in your xpath need not match the prefix used in the document, according to XML and XPath processing rules. Only the namepace is required to be the same.\n\n```xml\n\u003cJavaCallout name='Java-ReplaceXmlNode-2'\u003e\n  \u003cProperties\u003e\n    \u003cProperty name='xmlns:soap'\u003ehttp://schemas.xmlsoap.org/soap/envelope/\u003c/Property\u003e\n    \u003cProperty name='xmlns:act'\u003ehttp://yyyy.com\u003c/Property\u003e\n    \u003cProperty name='source'\u003erequest.content\u003c/Property\u003e\n    \u003cProperty name='new-node-type'\u003etext\u003c/Property\u003e\n    \u003cProperty name='new-node-text'\u003e{request.queryparam.texttoinsert}\u003c/Property\u003e\n    \u003cProperty name='xpath'\u003e/soap:Envelope/soap:Body/act:test/abc/act:demo/text()\u003c/Property\u003e\n    \u003cProperty name='action'\u003ereplace\u003c/Property\u003e\n  \u003c/Properties\u003e\n  \u003cClassName\u003ecom.google.apigee.callouts.EditXmlNode\u003c/ClassName\u003e\n  \u003cResourceURL\u003ejava://apigee-custom-edit-xml-node-20240614.jar\u003c/ResourceURL\u003e\n\u003c/JavaCallout\u003e\n```\n\nApplied against a source a document like this:\n```xml\n \u003csoap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\"\u003e\n  \u003csoap:Header/\u003e\n  \u003csoap:Body\u003e\n    \u003cact:test xmlns:act=\"http://yyyy.com\"\u003e\n      \u003cabc\u003e\n        \u003cact:demo\u003efokyCS2jrkE5s+bC25L1Aax5sK...J7nmd3OwHq/08GXIpwlq3QBJuG7a4Xgm4Vk\u003c/act:demo\u003e\n      \u003c/abc\u003e\n    \u003c/act:test\u003e\n  \u003c/soap:Body\u003e\n\u003c/soap:Envelope\u003e\n```\n\nThe above policy configuration would produce this output\n\n```xml\n\u003csoap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\"\u003e\n  \u003csoap:Header/\u003e\n  \u003csoap:Body\u003e\n    \u003cact:test xmlns:act=\"http://yyyy.com\"\u003e\n      \u003cabc\u003e\n        \u003cact:demo\u003eTHE VALUE OF request.queryparam.texttoinsert APPEARS HERE\u003c/act:demo\u003e\n      \u003c/abc\u003e\n    \u003c/act:test\u003e\n  \u003c/soap:Body\u003e\n\u003c/soap:Envelope\u003e\n```\n\n\nWhether inserting, appending, or replacing an element, the `new-node-text` may\nbe a fragment that refers to XML namespaces that have been declared in the\npolicy configuration. The policy at runtime will inject the appropriate\nnamespace declarations into the toplevel element.  For example, this is ok:\n\n```xml\n\u003cJavaCallout name='Java-InsertXmlNode-1'\u003e\n  \u003cProperties\u003e\n    \u003c!-- declare the namespace and prefix here --\u003e\n    \u003cProperty name='xmlns:ns1\u003ehttp://foo.bar\u003c/Property\u003e\n    \u003cProperty name='source'\u003erequest.content\u003c/Property\u003e\n    \u003cProperty name='new-node-type'\u003eelement\u003c/Property\u003e\n    \u003c!-- use cdata here so that namespaces do not need to be declared within the fragment --\u003e\n    \u003cProperty name='new-node-text'\u003e\u003c![CDATA[\u003cns1:Foo\u003etext-value\u003c/ns1:Foo\u003e]]\u003e\u003c/Property\u003e\n    \u003cProperty name='xpath'\u003e{request.queryparam.xpath}\u003c/Property\u003e\n    \u003cProperty name='action'\u003eappend\u003c/Property\u003e\n  \u003c/Properties\u003e\n  \u003cClassName\u003ecom.google.apigee.callouts.EditXmlNode\u003c/ClassName\u003e\n  \u003cResourceURL\u003ejava://apigee-custom-edit-xml-node-20240614.jar\u003c/ResourceURL\u003e\n\u003c/JavaCallout\u003e\n```\n\n\n### Removing a SOAP Header\n\nUsing the \"remove\" action, you can also remove a node (which may have children) from an XML document.\n\n```xml\n\u003cJavaCallout name='Java-RemoveSoapHeader'\u003e\n  \u003cProperties\u003e\n    \u003cProperty name='xmlns:soap'\u003ehttp://schemas.xmlsoap.org/soap/envelope/\u003c/Property\u003e\n    \u003cProperty name='source'\u003erequest.content\u003c/Property\u003e\n    \u003cProperty name='xpath'\u003e/soap:Envelope/soap:Header\u003c/Property\u003e\n    \u003cProperty name='action'\u003eremove\u003c/Property\u003e\n  \u003c/Properties\u003e\n  \u003cClassName\u003ecom.google.apigee.callouts.EditXmlNode\u003c/ClassName\u003e\n  \u003cResourceURL\u003ejava://apigee-custom-edit-xml-node-20240614.jar\u003c/ResourceURL\u003e\n\u003c/JavaCallout\u003e\n```\n\nApplied against a source a document like this:\n```xml\n \u003csoap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\"\u003e\n  \u003csoap:Header\u003e\n     \u003cElement1\u003e....\u003c/Element1\u003e\n     \u003cElement2\u003e....\u003c/Element2\u003e\n  \u003c/soap:Header\u003e\n  \u003csoap:Body\u003e\n    \u003cact:test xmlns:act=\"http://yyyy.com\"\u003e\n      \u003cabc\u003e\n        \u003cact:demo\u003efokyCS2jrkE5s+bC25L1Aax5sK...J7nmd3OwHq/08GXIpwlq3QBJuG7a4Xgm4Vk\u003c/act:demo\u003e\n      \u003c/abc\u003e\n    \u003c/act:test\u003e\n  \u003c/soap:Body\u003e\n\u003c/soap:Envelope\u003e\n```\n\nThe above policy configuration would produce this output:\n\n```xml\n\u003csoap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\"\u003e\n  \u003csoap:Body\u003e\n    \u003cact:test xmlns:act=\"http://yyyy.com\"\u003e\n      \u003cabc\u003e\n        \u003cact:demo\u003efokyCS2jrkE5s+bC25L1Aax5sK...J7nmd3OwHq/08GXIpwlq3QBJuG7a4Xgm4Vk\u003c/act:demo\u003e\n      \u003c/abc\u003e\n    \u003c/act:test\u003e\n  \u003c/soap:Body\u003e\n\u003c/soap:Envelope\u003e\n```\n\n### Inserting a SOAP WS-Security Header\n\nUsing the \"insert-before\" action, you can insert a soap security header into a SOAP document that does not have a header.\n\n\n```xml\n\u003cJavaCallout name='Java-InsertSoapHeader'\u003e\n  \u003cProperties\u003e\n    \u003cProperty name='xmlns:soap'\u003ehttp://schemas.xmlsoap.org/soap/envelope/\u003c/Property\u003e\n    \u003cProperty name='xmlns:wsse'\u003ehttp://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd\u003c/Property\u003e\n    \u003cProperty name='xmlns:wsu'\u003ehttp://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\u003c/Property\u003e\n    \u003cProperty name='source'\u003erequest.content\u003c/Property\u003e\n    \u003cProperty name='xpath'\u003e/soap:Envelope/soap:Body\u003c/Property\u003e\n    \u003cProperty name='action'\u003einsert-before\u003c/Property\u003e\n    \u003cProperty name='new-node-type'\u003eelement\u003c/Property\u003e\n    \u003c!-- use cdata here so that namespaces do not need to be declared --\u003e\n    \u003c!-- References to context variables get expanded. --\u003e\n    \u003cProperty name='new-node-text'\u003e\u003c![CDATA[\n    \u003csoap:Header\u003e\n      \u003cwsse:Security soap:mustUnderstand='1'\u003e\n         \u003cwsse:UsernameToken wsu:Id='UsernameToken-459'\u003e\n            \u003cwsse:Username\u003e{my.username}\u003c/wsse:Username\u003e\n            \u003cwsse:Password Type='http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText'\u003e{my.password}\u003c/wsse:Password\u003e\n         \u003c/wsse:UsernameToken\u003e\n      \u003c/wsse:Security\u003e\n    \u003c/soap:Header\u003e\n    ]]\u003e\n    \u003c/Property\u003e\n  \u003c/Properties\u003e\n  \u003cClassName\u003ecom.google.apigee.callouts.EditXmlNode\u003c/ClassName\u003e\n  \u003cResourceURL\u003ejava://apigee-custom-edit-xml-node-20240614.jar\u003c/ResourceURL\u003e\n\u003c/JavaCallout\u003e\n```\n\nApplied against a source a document like this:\n```xml\n \u003csoap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\"\u003e\n  \u003csoap:Body\u003e\n    \u003cact:test xmlns:act=\"http://yyyy.com\"\u003e\n      \u003cabc\u003exyz\u003c/abc\u003e\n    \u003c/act:test\u003e\n  \u003c/soap:Body\u003e\n\u003c/soap:Envelope\u003e\n```\n\nThe above policy configuration would produce this output:\n\n```xml\n\u003csoap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\"\u003e\n  \u003csoap:Header xmlns:wsu=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\" xmlns:wsse=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd\"\u003e\n      \u003cwsse:Security soap:mustUnderstand=\"1\"\u003e\n         \u003cwsse:UsernameToken wsu:Id=\"UsernameToken-459\"\u003e\n            \u003cwsse:Username\u003eusername\u003c/wsse:Username\u003e\n            \u003cwsse:Password Type=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText\"\u003epassword\u003c/wsse:Password\u003e\n         \u003c/wsse:UsernameToken\u003e\n      \u003c/wsse:Security\u003e\n    \u003c/soap:Header\u003e\u003csoap:Body\u003e\n    \u003cact:test xmlns:act=\"http://yyyy.com\"\u003e\n      \u003cabc\u003exyz\u003c/abc\u003e\n    \u003c/act:test\u003e\n  \u003c/soap:Body\u003e\n\u003c/soap:Envelope\u003e\n```\n\n\n### Removing an element depending on a text value\n\nHere's another example using the \"remove\" action. This one uses an XPath that selects based on the text value of a child.\n\n```xml\n\u003cJavaCallout name='Java-RemoveElement'\u003e\n  \u003cProperties\u003e\n    \u003cProperty name='xmlns:b'\u003eb\u003c/Property\u003e\n    \u003cProperty name='source'\u003econtrivedMessage.content\u003c/Property\u003e\n    \u003cProperty name='xpath'\u003e/b:Response/b:document/b:documentProperties[b:name/text()='Property2']\u003c/Property\u003e\n    \u003cProperty name='action'\u003eremove\u003c/Property\u003e\n  \u003c/Properties\u003e\n  \u003cClassName\u003ecom.google.apigee.callouts.EditXmlNode\u003c/ClassName\u003e\n  \u003cResourceURL\u003ejava://apigee-custom-edit-xml-node-20240614.jar\u003c/ResourceURL\u003e\n\u003c/JavaCallout\u003e\n```\n\nApplied against a source a document like this:\n```xml\n\u003cb:Response xmlns:b=\"b\"\u003e\n  \u003cb:document\u003e\n    \u003cb:documentProperties\u003e\n      \u003cb:name\u003eProperty1\u003c/b:name\u003e\n      \u003cb:value\u003eValule1\u003c/b:value\u003e\n    \u003c/b:documentProperties\u003e\n    \u003cb:documentProperties\u003e\n      \u003cb:name\u003eProperty2\u003c/b:name\u003e\n      \u003cb:value\u003eValue2\u003c/b:value\u003e\n    \u003c/b:documentProperties\u003e\n  \u003c/b:document\u003e\n\u003c/b:Response\u003e\n```\n\nThe above policy configuration would produce this output:\n\n```xml\n\u003cb:Response xmlns:b=\"b\"\u003e\n  \u003cb:document\u003e\n    \u003cb:documentProperties\u003e\n      \u003cb:name\u003eProperty1\u003c/b:name\u003e\n      \u003cb:value\u003eValule1\u003c/b:value\u003e\n    \u003c/b:documentProperties\u003e\n  \u003c/b:document\u003e\n\u003c/b:Response\u003e\n```\n\n\n\n## Example API Proxy\n\nYou can find an example proxy bundle that uses the policy, [here in\nthis repo](bundle/apiproxy).\n\n\n\n## Building the Jar\n\nIf you are using Apigee X or hybrid, you do not need to build the Jar in order\nto use the custom policy. The custom policy is ready to use, with policy\nconfiguration. If you are using OPDK, which still relies on Java8, you will\nneed to re-build the JAR. The jar bundled here has been built with Java11.  If\nyou try to use it with OPDK, you will receive an error message like the\nfollowing:\n\n\u003e Failed to load java class com.google.apigee.callouts.GenerateJwe definition\n\u003e due to - com/google/apigee/callouts/GenerateJwe has been compiled by a more\n\u003e recent version of the Java Runtime (class file version 55.0), this version of\n\u003e the Java Runtime only recognizes class file versions up to 52.0.\n\n\nIf using Apigee X or hybrid, you need to re-build the jar only if you want\nto modify the behavior of the custom policy. Before you do that, be sure you understand\nall the configuration options - the policy may be usable for you without modification.\n\nIf you do wish to build the jar, you can use\n[maven](https://maven.apache.org/download.cgi) to do so, v3.9.0 or later.\n\n### To Build\n\n```\ncd callout\n\n# build with Java11\nmvn clean package\n\n# build with Java8\nmvn -f pom-java8.xml clean package\n\n```\n\nThe source code includes tests.\n\nIf you edit policies offline, copy [the jar file for the custom\npolicy](callout/target/apigee-custom-edit-xml-node-20240614.jar) and all the\ndependencies to your apiproxy/resources/java directory.  (The pom file does this\nfor you, automatically, for the sample bundle here.)  If you don't edit proxy\nbundles offline, upload that jar file into the API Proxy via the Apigee API\nProxy Editor.\n\n\n## Build Dependencies\n\n- Apigee expressions v1.0\n- Apigee message-flow v1.0\n- fasterxml jackson (needed only for building+running tests)\n- testng v6.8.7 (needed only for building+running tests)\n- jmockit v1.49 (needed only for building+running tests)\n\n\nThe pom file will take care of these Jars.\n\n\n## Support\n\nThis callout is open-source software, and is not a supported part of Apigee.  If\nyou need assistance, you can try inquiring on [the Google Cloud Community forum\ndedicated to Apigee](https://goo.gle/apigee-community) There is no service-level\nguarantee for responses to inquiries posted to that site.\n\n## License\n\nThis material is [Copyright 2015, 2016 Apigee Corporation, 2017-2024 Google LLC](./NOTICE).\nand is licensed under the [Apache 2.0 License](LICENSE). This includes the Java\ncode as well as the API Proxy configuration.\n\n## Bugs\n\n* when inserting elements, sometimes you get extraneous namespace declarations.  This is annoying but harmless.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdinochiesa%2Fapigee-java-edit-xml-node","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdinochiesa%2Fapigee-java-edit-xml-node","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdinochiesa%2Fapigee-java-edit-xml-node/lists"}