Regards
Arthur
dchambon wrote:
> Hello,
>
> I'm new to PBDOM object and can't figure out how to read the
> value of an attribute inside an xml files.
>
> here is my code
>
> string ls_MsgBox, ls_FileName,ls_txt_fic
> ,ls_baliseXML,ls_no_ord
> integer li_Counter, li_Files,li_num_fic, li_FileNum
> //
> PBDOM_BUILDER dom_builder
> PBDOM_DOCUMENT dom_doc
> PBDOM_OBJECT dom_obj[]
> PBDOM_ELEMENT dom_element
> PBDOM_ATTRIBUTE dom_attribute[]
> //
> ls_FileName = Space( 255 )
> li_Files = DragQueryFile( handle, -1, ls_FileName, 255 )
> FOR li_Counter = 1 TO li_Files
> ls_FileName = Space( 255 )
> DragQueryFile( handle, li_Counter - 1, ls_FileName, 255)
> //li_FileNum = FileCopy (ls_FileName , "C:\jazz.gif",
> FALSE)
> NEXT
> //
> dom_builder = CREATE PBDOM_BUILDER
> TRY
> // Import File and generate XML Document
> dom_doc = dom_Builder.BuildFromFile(ls_FileName)
> dom_doc.getcontent(dom_obj)
> CATCH (PBDOM_Exception lpbdom_Except)
> MessageBox( "PBDOM_Exception",
> lpbdom_Except.GetExceptionCode())
> RETURN
> END TRY
> ls_no_ord =
> dom_doc.GetRootElement().GetAttribute("no_ord").GetText()
>
>
> Thanks for your help
>
> the xml is attached
>
> Best regards,
> Didier.
in fact I started from your article to write my code but as
am new to PBDOM I must have missed something :-(
Can you tell me what's wrong in my code ?
Regards,
Didier.
I'm using GetAttributeValue ( ls_Attribute ). You can find the
functions in the HTML Books Chapter 14, PBDOM node objects.
Arthur
I still don't figure out how to read attribute :-(
For example I need the value of the attribute "no_ord"
helppppp
regards
Didier
Arthur
//one option is:
dom_doc.getcontent(dom_obj)
// -> Returns an array of two XML elements (XML and ECO_1702_003272004)
dom_obj[2].getcontent(dom_obj)
// Returns one element (ECO_1702_003272004_row)
dom_obj[1].getcontent(dom_obj)
// Returns your elements (no_ord, .. )
ls_no_ord = dom_obj[1].GetText()
// or you do
dom_element =
dom_doc.GetRootElement().GetChildElement("ECO_1702_003272004_row" )
ls_no_ord = dom_element.GetChildElement("no_ord" ).GetText()
Merci beaucoup !!!
Best regards,
Didier.