How to add new tag in xml structure payload using dataweave (mule) - mule

I have an xml file like in the image below I want to add an xml tag in my file so that the xml schema becomes like this
i want to add this tag with in the payload with dataweave

Related

Persisting an XML element in eXist-db with CDATA content

I put the following in an xquery module declare option output:cdata-section-elements "xquery"; while trying to save a document. The element xquery is in the xpath /group/schedules/schedule/xquery and the element did not save as a CDATA. What am I missing?

Allow custom attribute to a script tag element?

I can't validate script tag with attribute nomodule.
I am using odoo framework which is a python backend. It is using lxml to validate xml views or pages. I am building a view with a script tag like:
<script src="src.js" nomodule></script>
It returns an error
lxml.etree.XMLSyntaxError: Specification mandate value for attribute nomodule
However this should be valid according to https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script
Is there a way so that I can make the parser ignore this new attribute or I can bypass such as special data or character.
That's possibly because XML != HTML. And as you can see in the error, it's an XML error.
Is an xml attribute without a value, valid? --> your attribute isn't valid.
You need to specify the attribute value always in xml. Odoo uses xml to produce html, so you need to comply with xml rules. You can do it in this case by specifying an empty value for xml attribute like this:
<script src="src.js" nomodule=””></script>

How to add xml data(containing tags) in extent-report.html

I'm trying to add xml string into my extent-report. It is instead treating it as an html tag and displaying in the dom instead of UI.
I tried adding chars before and after xml string and then it is printing the chars but not the xml data
Reporter.addStepLog("text is <"+"<response><abc value=10></abc></response>"+">"
I want the report to show o/p as-> text is <<response><abc value=10></abc></response>>
but i am getting-> text is <>
P.S.:If you see the console you will get what i am trying to explain !
you may try to use following html element :
Reporter.addStepLog("text is <textarea rows='20' cols='40' style='border:none;'>"+"<response><abc value=10></abc></response>"+"</textarea>");
For information, I found this trick on this site :
Display XML content in HTML page

How to split xml blob content in database into multiple files based on tag in mule

How to split xml file into multiple files based on a tag in xml file using mule
In xml we have <EOF> data based on <EOF> we need to chunk the xml.
You can do something similar to:
<splitter expression="#[xpath('//EOF')]" />
That would generate many messages one for each EOF tag in your XML. Depending on the structure you may need to fix the Xpath expression to be more precise.
Use splitter component in Mule
http://www.mulesoft.org/documentation/display/current/Splitter+Flow+Control+Reference

Transforming a single xml to many documents

I have to create a mapping between two xsd schemas, where the input document contains a list (sequence) of elements, each of which maps to a single output document. Moreover, each output document should include top level input data that is not a part of the list. To illustrate the problem, the input document contains data about a customer (contact info, etc) and list of invoices for them, and the output should be multiple documents, each containing one invoice and the customer data.
Can I somehow do this using DataMapper or some other approach? If I create a mapping between the input list elements and the output document, DataMapper will output an aggregation of all the created output documents. It also seems that I can not refer to the input top level elements from inside the "list element to output document" mapping.
Supposing root element in your source XSD contained a list of "Item" elements, you could first split the document into Items:
<splitter expression="#[xpath('//Item')]" doc:name="Splitter" enableCorrelation="IF_NOT_SET"/>
And then after the splitter use a DataMapper to map the Item elements to a target element in your other XSD. DataMapper requires that "Item" also be a root element in your source XSD in order to do the mapping from XSD to XSD. If it's not possible/desirable to make "Item" a root element in the source XSD, then you could create a sample XML and use DataMapper to generate an XSD from that. Otherwise you could roll your own transformer or use the XSLT transformer.