Sandeep,
First, get the schema for the XML document you’re trying to convert from string format into a webMethods Document.
Use the schema to create a webMethods Document type in your package.
Then use the following to convert the XML document in string form into an instance of the webMethods Document type just created:
pub.xml:xmlStringToXMLNode
pub.xml:xmlNodeToDocument
Map the output document to a docRef of the webMethods Document type created from the schema.
This converts both attributes and child elements just fine.
If you wish to validate the new XML Document against the schema, you can use the intermediate node that is created by pub.xml:xmlStringToXMLNode to call:
pub.schema:validate
#webMethods#Integration-Server-and-ESB#Flow-and-Java-services