mathewrond Posted October 17, 2006 Share Posted October 17, 2006 Hi,I am trying to get "subAcctName" attribute of <SummaryInfo> tag and I have tried all these ways..//Letter/LetterReport/SummaryInfo/@SubAcctName//SummaryInfo/@SubAcctName//LetterReport/SummaryInfo/@SubAcctName//LetterReport/SummaryInfo/Manager[ancestor::SummaryInfo/@SubAcctName]But all the above queries are not returning me any value. Can you please help me out with the correct query?Here is my XML Structure<?xml version="1.0" encoding="UTF-8"?><Letter> <LOGO>logo.gif</LOGO> <Header> <Header_Line>ABC Corp</Header_Line> </Header> <LetterReport> <AInfo> <PID>596908</PID> <TCode>104051474</TCode> </AInfo> <PInfo> <SDate>10/12/06</SDate> <TCode>104051650</TCode> </PInfo> <TData> <PID>596908</PID> <TCode>104052594</TCode> </TData> <SummaryInfo subAcctName="FTT2"> <Manager name="Andrew"> <item> <PID>596902</PID> </item> </Manager> </SummaryInfo> </LetterReport> <ContactInfo> <Address> <Name>ABC Corp</Name> </Address> </ContactInfo> <Footer> <Footer_Line>Done</Footer_Line> </Footer></Letter>Regards,Mathew Link to comment Share on other sites More sharing options...
aalbetski Posted October 17, 2006 Share Posted October 17, 2006 using XMLDOM, both of these work: document.write(xmlSource.selectSingleNode("//LetterReport/SummaryInfo").getAttributeNode("subAcctName").text); document.write(xmlSource.selectSingleNode("//LetterReport/SummaryInfo/@subAcctName").value); Link to comment Share on other sites More sharing options...
boen_robot Posted October 17, 2006 Share Posted October 17, 2006 If everything in the environment (XML DOM, XSLT, PHP, whatever) is correct, this should work: /Letter/LetterReport/SummaryInfo/@subAcctName All of what you have suggested should work as well.What code are you using to perform the XPath statement? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now