468,544 Members | 1,820 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,544 developers. It's quick & easy.

Cannot retrieve attribute value

An application I'm helping develop transmits XML to an ERP and receives an
XML statement showing the result of the transmittal to the ERP. I've pasted
a copy of one of the response XML statements. I have no trouble retrieving
the statement "Environment 'DEV' could not be initialized for user; check
user, pwd and environment attribute values", which we're storing in our SQL
Server. However, I also need to retrieve the value for the code attribute,
which is 12 in this case, to pass back up to the user; retrieving that value
is the sticking point. How do I go about accomplishing that?

<?xml version='1.0'?>
<jdeResponse type='callmethod' user='JWRIGHT' pwd='JWRIGHT'
environment='DEV' session=''>
<returnCode code='12'>Environment 'DEV' could not be initialized for user,
check user, pwd and environment attribute values</returnCode>
</jdeResponse>
Nov 12 '05 #1
2 2724
One of the ways is -

XmlDocument doc = new XmlDocument ();

doc.LoadXml

(

@"

<jdeResponse type='callmethod' user='JWRIGHT' pwd='JWRIGHT' environment='DEV' session=''>

<returnCode code='12'>

Environment 'DEV' could not be initialized for user, check user, pwd

and environment attribute values

</returnCode>

</jdeResponse>"

);

Console.WriteLine (doc.DocumentElement.FirstChild.Attributes [0].Value);

In case you are using XmlReader:

XmlDocument doc
"AlBruAn" <al*****@hotmail.com.(donotspam)> wrote in message news:8A**********************************@microsof t.com...
An application I'm helping develop transmits XML to an ERP and receives an
XML statement showing the result of the transmittal to the ERP. I've pasted
a copy of one of the response XML statements. I have no trouble retrieving
the statement "Environment 'DEV' could not be initialized for user; check
user, pwd and environment attribute values", which we're storing in our SQL
Server. However, I also need to retrieve the value for the code attribute,
which is 12 in this case, to pass back up to the user; retrieving that value
is the sticking point. How do I go about accomplishing that?

<?xml version='1.0'?>
<jdeResponse type='callmethod' user='JWRIGHT' pwd='JWRIGHT'
environment='DEV' session=''>
<returnCode code='12'>Environment 'DEV' could not be initialized for user,
check user, pwd and environment attribute values</returnCode>
</jdeResponse>

Nov 12 '05 #2
Thanks, that's the answer...I'd tried nearly everything BUT that!

"Mujtaba Syed" wrote:
One of the ways is -

XmlDocument doc = new XmlDocument ();

doc.LoadXml

(

@"

<jdeResponse type='callmethod' user='JWRIGHT' pwd='JWRIGHT' environment='DEV' session=''>

<returnCode code='12'>

Environment 'DEV' could not be initialized for user, check user, pwd

and environment attribute values

</returnCode>

</jdeResponse>"

);

Console.WriteLine (doc.DocumentElement.FirstChild.Attributes [0].Value);

In case you are using XmlReader:

XmlDocument doc
"AlBruAn" <al*****@hotmail.com.(donotspam)> wrote in message news:8A**********************************@microsof t.com...
An application I'm helping develop transmits XML to an ERP and receives an
XML statement showing the result of the transmittal to the ERP. I've pasted
a copy of one of the response XML statements. I have no trouble retrieving
the statement "Environment 'DEV' could not be initialized for user; check
user, pwd and environment attribute values", which we're storing in our SQL
Server. However, I also need to retrieve the value for the code attribute,
which is 12 in this case, to pass back up to the user; retrieving that value
is the sticking point. How do I go about accomplishing that?

<?xml version='1.0'?>
<jdeResponse type='callmethod' user='JWRIGHT' pwd='JWRIGHT'
environment='DEV' session=''>
<returnCode code='12'>Environment 'DEV' could not be initialized for user,
check user, pwd and environment attribute values</returnCode>
</jdeResponse>

Nov 12 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Prasad Karunakaran | last post: by
1 post views Thread by David C. allen | last post: by
2 posts views Thread by Jay Bienvenu | last post: by
2 posts views Thread by epigram | last post: by
reply views Thread by NPC403 | last post: by
1 post views Thread by UniDue | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.