Mmcolli00 Mom wrote: > Hi > > I don't understand how to output the exact data that I need from my xml > document. I only need to get 2 data elements per xml segment, however I > am getting the whole xml segment. Will you show me how to do this? > > <AnimalXML> > - <FID="28"> > <Field FieldId="0" Field1="" Path="/Docs/Animal/Cat" Attribute="Fur" > /> > <Field FieldId="10" Field1="ACC" Path="/Docs/Animail/Dog" > Attribute="Fur" /> > <Field FieldId="11" Field1="ACC_DATE" Path="/Docs/Animal/Bird" > Attribute="Feather" /> > > > I am getting this: > <Field FieldId="11" Field1="ACC_DATE" Path="/Docs/Animal/Bird" > ... > > This is what I need the output to look like: > Cat Fur > Dog Fur > Bird Feather > > #****************************************** > require 'rexml/document' > include REXML > f = File.new("AnimalXML.xml") > doc = Document.new(f) > > #below ex. outputs the whole xml segment > fields = XPath.match(doc, "//Field FieldId") > puts fields > > #below ex. does same as above, shows whole xml segment > doc.elements.each("*/Field FieldId") { |element| puts > element.attribute['Path']} > Call me suspicious, but are you trying to get us to do your homework for you? ======================================================================= This email, including any attachments, is only for the intended addressee. It is subject to copyright, is confidential and may be the subject of legal or other privilege, none of which is waived or lost by reason of this transmission. If the receiver is not the intended addressee, please accept our apologies, notify us by return, delete all copies and perform no other act on the email. Unfortunately, we cannot warrant that the email has not been altered or corrupted during transmission. =======================================================================