web stats
Unable to access XML elements by name - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 05-05-2015, 09:31 AM
arpitgoel arpitgoel is offline
Mirth Newb
 
Join Date: Apr 2015
Posts: 8
arpitgoel is on a distinguished road
Default Unable to access XML elements by name

XML :
HTML Code:
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:os="http://a9.com/-/spec/opensearch/1.1/">
    <title>Search results</title>
    <updated>2015-05-05T08:56:29.566372Z</updated>
    <id>http://localhost:5000/Patient%3Fidentifier%3D3333</id>
    <link href="http://localhost:5000/Patient?identifier=3333" rel="self"/>
    <author>
        <name>GNU Health</name>
    </author>
    <entry>
        <title>Patient, Demo</title>
        <id>http://localhost:5000/Patient/1</id>
        <updated>2015-05-05T06:30:12.158869Z</updated>
        <published>2015-05-04T19:44:56.401653Z</published>
    </entry>
    <os:totalResults>1</os:totalResults>
</feed>
I'm able to fetch elements using this code :
Code:
var tmp_xml = new XML(data);      //data holds xml string
for each (column in tmp_xml.children()) {
	logger.info('column: '+column.toString());
}
But both of these codes return empty string :
Code:
//var title = tmp_xml.title.toString());
var title = tmp_xml['title'].toString();
logger.info(title);
Reply With Quote
Reply

Tags
xml, xml child segments, xml name spaces

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -8. The time now is 04:14 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2020, vBulletin Solutions, Inc.
Mirth Corporation