PB 11.5.1 - get value of an attribute from an xml file

This is a multi-part message in MIME format.

---=_forums-1-dub4abce420
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 7bit

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.

---=_forums-1-dub4abce420
Content-Type: application/xml; name="ECO_1702_003272004.XML"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="ECO_1702_003272004.XML"

PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxv
bmU9Im5vIj8+Cgo8RUNPXzE3MDJfMDAzMjcyMDA0PjxFQ09fMTcwMl8wMDMy
NzIwMDRfcm93Pjxub19vcmQ+MzI3Mjwvbm9fb3JkPjx4dGluc19saWduZV9u
b19saWc+NDwveHRpbnNfbGlnbmVfbm9fbGlnPjx4dGluc19saWduZV9saWd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ZHY+IDwvYWdhZHY+PGhhdXRl
dXI+MjE5MDwvaGF1dGV1cj48bGFyZ2V1cj4xNDMwPC9sYXJnZXVyPjxuYmNv
bD4zPC9uYmNvbD48cmVmX21lZGlhPlBsYW4gbWVkaWEgOiA1MjE3LTQ8L3Jl
Zl9tZWRpYT48eHRhbGNfcGxhbl9hbGxvY2F0aW9uX2xpYmFubj5JTlZFU1Qg
TUFDRURPTklBPC94dGFsY19wbGFuX2FsbG9jYXRpb25fbGliYW5uPjx4dGFs
Y19wbGFuX2FsbG9jYXRpb25fbGlicHJkPklOVkVTVCBNQUNFRE9OSUE8L3h0
YWxjX3BsYW5fYWxsb2NhdGlvbl9saWJwcmQ+PC9FQ09fMTcwMl8wMDMyNzIw
MDRfcm93PjwvRUNPXzE3MDJfMDAzMjcyMDA0Pgo=

---=_forums-1-dub4abce420--
0
dchambon
9/25/2009 3:39:12 PM
sybase.powerbuilder.xml 546 articles. 0 followers. Follow

6 Replies
1061 Views

Similar Articles

[PageSpeed] 48

Check out my article in PBDJ: "Taking PowerBuilder's PBDOM Out for a
Spin" at http://pbdj.sys-con.com/node/107057.

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.

0
Arthur
9/25/2009 6:15:02 PM
Hi arthur,

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.
0
dchambon
9/25/2009 9:36:05 PM
Didier

I'm using GetAttributeValue ( ls_Attribute ). You can find the
functions in the HTML Books Chapter 14, PBDOM node objects.

Arthur
dchambon wrote:

> Hi arthur,
> 
> 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.

0
Arthur
9/26/2009 6:37:02 AM
Hello,

I still don't figure out how to read attribute :-(

For example I need the value of the attribute "no_ord"

helppppp

regards
Didier
0
dchambon
9/29/2009 5:34:27 PM
I gave a look at your XML. You're actually want to read the value of
the element "no_ord" and not an attribute. You have the following
options, where you might make your code more generic.

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()


dchambon wrote:

> Hello,
> 
> I still don't figure out how to read attribute :-(
> 
> For example I need the value of the attribute "no_ord"
> 
> helppppp
> 
> regards
> Didier

0
Arthur
9/30/2009 4:06:26 AM
Arthur,

Merci beaucoup !!!

Best regards,
Didier.
0
dchambon
9/30/2009 12:14:48 PM
Reply:

Similar Artilces:

XML Transform to 1 XML file to another XML File
Hello All  I am a novice programmer. I want to transform 1 xml file to another xml file. I am looking for a example code where user will select source xml file and create another xml file in different file with different fields with some default validation of parsing date and default values.  Can anyone help me or let me know any available source code in C#/ASP.Net?  Ms Disha I am assuming you know xslt, if not, you would have to go look at that.  But if you do, then this document will help you out http://www.csharpfriends.com/Articles/getArticle.aspx?articleID=...

Replace a node from 1 xml file with a node from another xml file
Hi,  suppose i have these 2 xml files: File 1: <resultset morerecords="0" paging-cookie="1">accountid last="{D14D44AD-36D0-DC11-AA32-0003FF33509E}" first="{D14D44AD-36D0-DC11-AA32-0003FF33509E}" /></cookie>"> <result> ... <donotpostalmail name="Allow">0</donotpostalmail> <name>Adventure Works</name> <primarycontactid name="Abhijit Thakur" dsc="0" yomi="Abhijit Thakur">{0820590A-37D0-DC11-AA32-0003FF33509E}</primarycontactid>...

Pulling data from one xml file based on values in a second XML file
Alright, I'm programming using vb within asp.net, but I'm a little bit of a newbie when it comes to xml. What I'm trying to do is display particular information from an XML file (parts.xml) based on information in another XML file (orders.xml). Ideally, I'd like to display the info using the xml control within asp.net and an xsl stylesheet. The setup of the files is that within parts.xml, each part has an id attribute. I'd like to grab the part id from the orders.xml file, and use it to extract only information on specific parts from parts.xml. Is there an easy way to do this? Any help...

Saving datawindow from PB 11.5.1 into PB 11.1 format (syntax)?
Hello, Is there any possible way to save a datawindow created & written in PB 11.5.1 in the exact datawindow format/sytnax of previous version(s), namely 11.1? Reason being is that we have an application that is still not migrated from 11.1 to 11.5.1, and we have to write a custom report for it urgently. Out application can import the exported SRD datawindow report and store its syntax in the table & run it from there. Unfortunately, it complains about incorrect release number (11.5, rather than 11.1, and I have already tried just to change the version number - more...

Problem with upgrade from 11.5.1 to 12.5.2
I am upgrading an 11.5.1 server to 12.5.2. I ran the sqlupgrade utility in non-upgrade mode and fixed up the issues it threw up. There is one remaining issue which I cannot fix. The sqlupgrade utility say that I must set the "esp execution stacksize" server parameter value to a min of 50000. However when I attempt to change this on my 11.5.1 server I get the following error message. ------------------------------------------------------------------------------- 1> sp_configure "esp execution stacksize", 50000 2> go Msg 5846, Level 16, State 1: S...

Need to parse XML file based on tag values and after matching inital attributes and values
 If I have the following XML File<AccountRequest StaffID="1234">    <KeyValue>1367932986</KeyValue>    <RequestorName>sam1</RequestorName>    <LoginName>Sam</LoginName>    <Extension>Sam</Extension>    <MailStop>Sam</MailStop>    <Date>Sam</Date>    <JobTitleTextBox>Sam</JobTitleTextBox>    <EmploymentType>    </EmploymentType>    <DeptNo>Sam</DeptNo>    &l...

pb datadirect oem 4.1 xml and 5.1 not working properly on my machine
Hi All, I have PB 10.5.1 build 6565 and PB 9.0.2. 7534 installed on my Win XP machine I have the pb datadirect oem 4.1 XML driver and the pb datadirect oem 5.1 XML driver installed but not functioning properly.... whenever I click on ADD, no popup window appears... How can I get and install the pb datadirect oem 4.2 xml driver ? (Since I saw it functionning on other machines) Any hint on how to fix the driver that I have? Thanks and Regards Rabih ...

XML in, XML out
Hi All (and a happy holiday to those that will get a break), I am trying to read in an XML file of addresses. I need to remove all the address data from the file where code =~ /^000/ (there are none in the example data below). I need to reproduce that data 'as is', so I need to honour the tag structure, although the order of the tags doesn't need to be honoured. I have been trying to use XML::Simple and I had a go with XML::Smart but I haven't been able to get the results I want. My best effort is below (with XML::Simple). There are a couple of differences ...

Read an attribute value from an XML file
I have to read a single value from this XML file. I simply have a currency value and I need to read the rate value. I try to use xpathnavigator with no result. Anyone can indicate the right commands to use?   Thanks Lorenzo It's easy to do with XmlDocument. 'Using DKK as sample        Dim currencyToLookFor As String = "DKK"        Dim doc As New XmlDocument        doc.Load("http://www.ecb.int/stats/eurofxref/eurofxref-daily.xml")         D...

Create an XML file from another XML file
I am using VS 2005 with C#.  I would like to create/generate an xml file from another XML with a differnt structure.  Basically, I want to create the actual xml file for my users whenever they raise my web service method. This is the actual structure of my xml i would like to create the following <Education>  <mydata>    <year>1988 - 1995</year>    <reward>High School Diploma</reward>    <school>Miami Secondary</school>  </mydata>  ...</Education> The original ...

How can i add a xml file to an other xml file?
such as i have a xml file : <item1> <item2> <item3>aaa</item3> <item4>bbb</item4> </item2> <item1> an other one is: <item2> <item3>ccc</item3> <item4>ddd</item4> <item2> i wanted is: <item1> <item2> <item3>aaa</item3> <item4>bbb</item4> </item2> <item2> <item3>ccc</item3> <item4>ddd</item4> <item2> <item1> thanks. You ca...

After download a xml file, why my xml file has been changed?
Protected Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button2.Click        Dim fileName As String = Server.MapPath("~/Products.xml")        Response.Clear()         Response.ContentType = "text/xml"        Response.AddHeader("Content-Disposition", "attachment; filename=" & fileName)                Response.WriteFile(fileName)  ...

Load XMl file and read xml file
How do I load and read nodes from the xml file in c#.??? ThankYou Sample code: http://www.kirupa.com/net/reading_xml_directly_pg1.htmJack Yang.NET Developer Here is how you read xml file and loop and display nodesXmlDocument xDoc = new XmlDocument();xDoc.Load(xmlPath); foreach(XmlNode node in xDoc.SelectNodes("//nodeName you want to display")){Response.Write("name: " + node.Attributes["name"].InnerText + " value: " + node.Attributes["value"].InnerText);}...

Splitting XML file to different XML files
hi,I have xml file that represent a table , one of the element(column) of the xml represent category..I want to split the xml file to different xml files base on the categories (each xml file will represent different category).The question is , if it posible to split the original xml using one xslt file, or i must create different xslt file for each category?thanks in advance one xslt for each output.You can also do this with XmlDocument and save it to two seaprate paths.HTHRegards,Rob...

XMl to XML
Hello,   I retrieved an XML from the dataset which retrieves data from the table in the database. I need to present the data  in a different structure. Is XSLT the way or are there any other options. please let me know. Thanks!! Yes XSLT is a good choice to convert xml file to other forms. You can take a look at XSLT Tutorial.Sincerely,Young Fang...

Web resources about - PB 11.5.1 - get value of an attribute from an xml file - sybase.powerbuilder.xml

Attribute - Wikipedia, the free encyclopedia
Text is available under the Creative Commons Attribution-ShareAlike License ;additional terms may apply. By using this site, you agree to the ...

Template:Attributes of God - Wikipedia, the free encyclopedia
Language: English Română Home Random Template:Attributes of God Part of a series on the Attributes of God Aseity Eternity Graciousness Holiness ...

Six Attributes Of The Perfect Facebook Page Administrator
So, here’s the thing: In many ways, hiring a Facebook page administrator is akin to hiring a poster child for your brand. This trusted manager ...

PANDA: Pose Aligned Networks for Deep Attribute Modeling - Facebook
We propose a method for inferring human attributes (such as gender, hair style, clothes style, expression, action) from images of people under ...

Facebook announces data partnerships to help advertisers target users by offline purchases and attributes ...
... will anonymously match data from consumer loyalty programs with user profiles in order to target ads by offline purchase habits and other attributes. ...

New Study Attributes Rapid Ageing Mainly To Environment Factors
New study explains why some people age faster than others.

Should I use the nofollow attribute on internal links? - YouTube
Regarding "nofollow" on internal links: Does it hurt? Does it help? I read different comments from Matt on this matter over time. What's the ...

Justin Trudeau attributes abortion stance to father's example
Liberal Leader Justin Trudeau says he is following an example set by his famous father when it comes to his position on election candidates and ...

Obama attributes western U.S. wildfires to climate change
... that has burned nearly 400 square miles in the north-central part of Washington state, along with blazes in other Western areas, can be attributed ...

Fifty Shades Of Grey Baby Births: Windsor Hospital Sees Spike In Births, Attribute Book
A significant spike in baby births at a hospital in Windsor, Ontario, has been attributed to the book Fifty Shades of Grey, which has become ...

Resources last updated: 12/10/2015 9:03:59 AM