cancel
Showing results for 
Search instead for 
Did you mean: 

XML Data to Context

Former Member
0 Kudos

Hi all,

I am using Adobe IF in order to send data via mail (the data is in XML form).

Now I need to read the XML file form the mail and copy it to the context.

I have managed to read the data from the mail attachment, but I can't transfer the data to my context.

Aviad

Accepted Solutions (0)

Answers (2)

Answers (2)

siarhei_pisarenka3
Active Contributor
0 Kudos

Hi Aviad

I suppose that you have the data as java.io.InputStream. Then create new attribute in the context and set attribute type as "java.io.InputStream". Then set the attribute value as usual.

If you want you can convert InputStream to String and store the in a simple String attribute in the context.

BR, Sergei

Former Member
0 Kudos

What exactly is the problem?

Armin

Former Member
0 Kudos

How can I transfer the XML data (without writing a parser) to the context?

Former Member
0 Kudos

Still unclear to me. How does the context structure look like?

Armin

Former Member
0 Kudos

Hi,

Here i am giving code for how to get the data from XML file available in server.

 
public void getmailAddr(){
	 	String spath="Path\\xml name.xml";
	 	try {
			DocumentBuilderFactory documentFactory=DocumentBuilderFactory.newInstance();
			DocumentBuilder documentBuilder=documentFactory.newDocumentBuilder();
			//wdComponentAPI.getMessageManager().reportSuccess("Before File(spath)");
			Document doc=documentBuilder.parse(new File(spath));
			//wdComponentAPI.getMessageManager().reportSuccess("After File(spath)");
			doc.getDocumentElement().normalize();
			org.w3c.dom.NodeList listOfObjects=doc.getElementsByTagName("Service");
			
			
			Node ColoumnNode = listOfObjects.item(0);
			
            for (int i = 0; i < ColoumnNode.getChildNodes().getLength();i++){
            	
				Node node = ColoumnNode.getChildNodes().item(i);
				if (node.getNodeType() == Node.ELEMENT_NODE) {
					
						String nodevalue=node.getChildNodes().item(0).getNodeValue();
						String bol=listOfObjects.item(0).getAttributes().getNamedItem("PropertiesModified").getNodeValue();
						//wdComponentAPI.getMessageManager().reportSuccess("bol:"+bol);
						
						if(node.getAttributes().item(0).getNodeValue().equals("to")){
						mail=node.getChildNodes().item(0).getNodeValue();
						//wdComponentAPI.getMessageManager().reportSuccess("ColoumnNode.getChildNodes().getLength():"+ColoumnNode.getChildNodes().getLength());
						}
						if(node.getAttributes().item(0).getNodeValue().equals("cc")){
						mail2=node.getChildNodes().item(0).getNodeValue();
						//wdComponentAPI.getMessageManager().reportSuccess("mail address:"+mail);
						}
					}
            }

Regards,

surya.

Former Member
0 Kudos

Hi surya,

I looking for a non coding method to implement this feature.

Aviad