473,386 Members | 1,830 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

beginning xml question

MR
i apologize in advance for what i know is a simple question, but i am being
exposed to the first time to xml.
considering the following string that i receive:

<BusinessEntity xsi:type="DynamicEntity" Name="contact"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://schemas.microsoft.com/crm/2006/WebServices">
<Properties>
<Property xsi:type="KeyProperty" Name="contactid">
<Value>{80FB716B-B189-DA11-84BD-0003FFC6732A}</Value>
</Property>
<Property xsi:type="StringProperty" Name="new_duplicateid">
<Value>8e0c0022-2078-4017-9630-6453e80695c0</Value>
</Property>
</Properties>
</BusinessEntity

How do i parse the values of contactid and new_duplicateid?

thanks for you help
Jan 22 '06 #1
2 1027
MR wrote:
i apologize in advance for what i know is a simple question, but i am being
exposed to the first time to xml.
considering the following string that i receive:

<BusinessEntity xsi:type="DynamicEntity" Name="contact"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://schemas.microsoft.com/crm/2006/WebServices">
<Properties>
<Property xsi:type="KeyProperty" Name="contactid">
<Value>{80FB716B-B189-DA11-84BD-0003FFC6732A}</Value>
</Property>
<Property xsi:type="StringProperty" Name="new_duplicateid">
<Value>8e0c0022-2078-4017-9630-6453e80695c0</Value>
</Property>
</Properties>
</BusinessEntity

How do i parse the values of contactid and new_duplicateid?


Parsing the document is done by a parser, either standalone or embedded
in your XML software, and on its own it won't achieve anything other
than to confirm that the document is or isn't well-formed or valid.
When connected to processing software, a parser passes the document
structure and content in memory to the application to do whatever it's
written to do.

I'm assuming that you actually mean you want to retrieve the value of
the Name attribute of the Property elements. Correct me if I'm wrong.

(Parsing an attribute *value* may be outside the scope of XML, although
it can often be configured in the Schema or DTD.)

In XSLT, the most common XML transformation language, the value of an
attribute can be retrieved in several ways depending on what you want to
do with it. For example to see in the above example if the two values
of Name were the same of different, you might use

<xsl:template match="Properties">
<xsl:choose>
<xsl:when test="Property[1]/@Name=Property[2]/@Name">
...do something when they are the same...
</xsl:when>
<xsl:otherwise>
...do something when they are different...
</xsl:otherwise>
</xsl:choose>
</xsl:templates>

But YMMV and a lot will depend on what you want to do, and the
environment you want to do it in (eg .NET).

///Peter
--
XML FAQ: http://xml.silmaril.ie/
Jan 22 '06 #2
MR
thanks for your quick response
yes i would like to retrieve the values of name and property. i will be
doing it in .NET (v1.1)
thanks for your help
"Peter Flynn" <pe********@m.silmaril.ie> wrote in message
news:43*************@individual.net...
MR wrote:
i apologize in advance for what i know is a simple question, but i am
being exposed to the first time to xml.
considering the following string that i receive:

<BusinessEntity xsi:type="DynamicEntity" Name="contact"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://schemas.microsoft.com/crm/2006/WebServices">
<Properties>
<Property xsi:type="KeyProperty" Name="contactid">
<Value>{80FB716B-B189-DA11-84BD-0003FFC6732A}</Value>
</Property>
<Property xsi:type="StringProperty" Name="new_duplicateid">
<Value>8e0c0022-2078-4017-9630-6453e80695c0</Value>
</Property>
</Properties>
</BusinessEntity

How do i parse the values of contactid and new_duplicateid?


Parsing the document is done by a parser, either standalone or embedded in
your XML software, and on its own it won't achieve anything other than to
confirm that the document is or isn't well-formed or valid.
When connected to processing software, a parser passes the document
structure and content in memory to the application to do whatever it's
written to do.

I'm assuming that you actually mean you want to retrieve the value of
the Name attribute of the Property elements. Correct me if I'm wrong.

(Parsing an attribute *value* may be outside the scope of XML, although it
can often be configured in the Schema or DTD.)

In XSLT, the most common XML transformation language, the value of an
attribute can be retrieved in several ways depending on what you want to
do with it. For example to see in the above example if the two values
of Name were the same of different, you might use

<xsl:template match="Properties">
<xsl:choose>
<xsl:when test="Property[1]/@Name=Property[2]/@Name">
...do something when they are the same...
</xsl:when>
<xsl:otherwise>
...do something when they are different...
</xsl:otherwise>
</xsl:choose>
</xsl:templates>

But YMMV and a lot will depend on what you want to do, and the
environment you want to do it in (eg .NET).

///Peter
--
XML FAQ: http://xml.silmaril.ie/

Jan 23 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Matt | last post by:
My ASP page allows the user select the date, and it will display the report during that week of that date. My question is when the program query database, I need to know the beginning date and...
4
by: Thierry Lam | last post by:
Let's say I already wrote a file and have the following: testing testing testing testing testing testing Is there an easy way to write something of variable length at the top of the file? ...
5
by: anas.hashmi | last post by:
I am trying to write to the beginning of a file. The reason: I want to make a form where board webmasters can use it to insert in updates to a webpage without having to go directly into the web...
36
by: invni | last post by:
I have a nested while. How do I go from the inner while to the beginning of the outer while? Can this be done without using goto? while_1() { some codes here while_2() { if true go to the...
4
by: AHP | last post by:
Hi, I'm using Visual Studio 2005. I am developing a web application that uses the FileUpload control to upload text files to a directory on a webserver. This works fine. However, for me to be...
3
by: Rajorshi Biswas | last post by:
Hi all, I'm aware that this might not be a "C-specific" question, if so, please let me know which group is the most appropriate for this kind of question. This is a question on unix...
4
by: libadmin | last post by:
I have a large database (for me) containing about 23,000 records and I need to add a single digit (the number 8) to all data currently in a specific field.. This field contains numbers already that...
16
by: btopenworld | last post by:
Hi - question from a relative asp novice I have written to text files in the past, but always appending new data to the end of the text file. I now want to add the new data to the beginning of...
1
by: breckj | last post by:
Beginning question about selecting software to set up my work environment. I have undertaken a website revision project after not programming for about 6 years. I am beginning to set up a work...
4
by: maria | last post by:
I only use C++ with Visual Studio 6.0 for string manipulations in thousands of HTML pages on my website. Many times, the output files of many of my C++ programs contain a spanish question mark (¿)...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.