By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,078 Members | 2,159 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,078 IT Pros & Developers. It's quick & easy.

extracting a XML segment (element)

P: n/a
AA
Hello, I need to extract an element from a xml document something like this

<myXml>
<Header>
<Name/>
<LastName/>
<Age/>
</Head>
<Body>
<Properties>
<Address/>
<Location/>
<Country>
</Properties>
</Body>
</myXml>
I need to extract from my Stream the <Properties> element (and sub elements)
located inside the Body element.

How can I do that?

Thanks a lot again!

AA
Nov 12 '05 #1
Share this Question
Share on Google+
9 Replies


P: n/a
AA
I forgot to mention that the element <Properties> could vary, could come
<Profesion> instead of <Properties> could come any element, but always
something come in that place. I need to extract the element (whatever be)
and convert into Object (deserializing the xml)

Thanks a lot
"AA" <aa@personal.net.py> wrote in message
news:%2******************@TK2MSFTNGP11.phx.gbl...
Hello, I need to extract an element from a xml document something like this
<myXml>
<Header>
<Name/>
<LastName/>
<Age/>
</Head>
<Body>
<Properties>
<Address/>
<Location/>
<Country>
</Properties>
</Body>
</myXml>
I need to extract from my Stream the <Properties> element (and sub elements) located inside the Body element.

How can I do that?

Thanks a lot again!

AA

Nov 12 '05 #2

P: n/a
Load the XML into a DOM and then do:

'Return the first child of the body element.
Dim pstrXML, pstrXPath
pstrXPath = "/myXml/Body/*[1]"
pstrXML = DOM.selectSingleNode(pstrXPath).xml

or ...

'Return the properties element wherever it may be (first instance).
Dim pstrXML, pstrXPath
pstrXPath = "//Properties[1]"
pstrXML = DOM.selectSingleNode(pstrXPath).xml

** Beware, the Xpath is case sensitive.

You can then use this XML and load it into another DOM if you want to work
with it as a document / apply XSLT to it etc.

Chris.

"AA" <aa@personal.net.py> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
I forgot to mention that the element <Properties> could vary, could come
<Profesion> instead of <Properties> could come any element, but always
something come in that place. I need to extract the element (whatever be)
and convert into Object (deserializing the xml)

Thanks a lot
"AA" <aa@personal.net.py> wrote in message
news:%2******************@TK2MSFTNGP11.phx.gbl...
Hello, I need to extract an element from a xml document something like this
<myXml>
<Header>
<Name/>
<LastName/>
<Age/>
</Head>
<Body>
<Properties>
<Address/>
<Location/>
<Country>
</Properties>
</Body>
</myXml>
I need to extract from my Stream the <Properties> element (and sub elements) located inside the Body element.

How can I do that?

Thanks a lot again!

AA


Nov 12 '05 #3

P: n/a
AA
Thanks Chris!

But DOM is not too heavy? is really necesary? is the only way?

:)

Thanks anyway

AA
"Chris Barber" <ch***@blue-canoe.co.uk.NOSPAM> wrote in message
news:eJ**************@TK2MSFTNGP10.phx.gbl...
Load the XML into a DOM and then do:

'Return the first child of the body element.
Dim pstrXML, pstrXPath
pstrXPath = "/myXml/Body/*[1]"
pstrXML = DOM.selectSingleNode(pstrXPath).xml

or ...

'Return the properties element wherever it may be (first instance).
Dim pstrXML, pstrXPath
pstrXPath = "//Properties[1]"
pstrXML = DOM.selectSingleNode(pstrXPath).xml

** Beware, the Xpath is case sensitive.

You can then use this XML and load it into another DOM if you want to work
with it as a document / apply XSLT to it etc.

Chris.

"AA" <aa@personal.net.py> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
I forgot to mention that the element <Properties> could vary, could come
<Profesion> instead of <Properties> could come any element, but always
something come in that place. I need to extract the element (whatever be)
and convert into Object (deserializing the xml)

Thanks a lot
"AA" <aa@personal.net.py> wrote in message
news:%2******************@TK2MSFTNGP11.phx.gbl...
Hello, I need to extract an element from a xml document something like

this

<myXml>
<Header>
<Name/>
<LastName/>
<Age/>
</Head>
<Body>
<Properties>
<Address/>
<Location/>
<Country>
</Properties>
</Body>
</myXml>
I need to extract from my Stream the <Properties> element (and sub

elements)
located inside the Body element.

How can I do that?

Thanks a lot again!

AA


Nov 12 '05 #4

P: n/a
If you are working with XML and XSLT then you will undoubtedly use an XMLDOM
in almost every scenario - that's what it's for. If you don't then you are
back to the Stone Age using string parsing techniques and regular
expressions.
If you can then try and use the latest version of MSXML by detecting and
using version specific ProgIDs 0 MSXML v4.0 is a lot faster than v3.0.
Saying that, they are both quick, *very* powerful, and relatively
lightweight as far as COM objects go.

Chris.
"AA" <aa@personal.net.py> wrote in message
news:O$**************@TK2MSFTNGP10.phx.gbl...
Thanks Chris!

But DOM is not too heavy? is really necesary? is the only way?

:)

Thanks anyway

AA
"Chris Barber" <ch***@blue-canoe.co.uk.NOSPAM> wrote in message
news:eJ**************@TK2MSFTNGP10.phx.gbl...
Load the XML into a DOM and then do:

'Return the first child of the body element.
Dim pstrXML, pstrXPath
pstrXPath = "/myXml/Body/*[1]"
pstrXML = DOM.selectSingleNode(pstrXPath).xml

or ...

'Return the properties element wherever it may be (first instance).
Dim pstrXML, pstrXPath
pstrXPath = "//Properties[1]"
pstrXML = DOM.selectSingleNode(pstrXPath).xml

** Beware, the Xpath is case sensitive.

You can then use this XML and load it into another DOM if you want to work
with it as a document / apply XSLT to it etc.

Chris.

"AA" <aa@personal.net.py> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
I forgot to mention that the element <Properties> could vary, could come
<Profesion> instead of <Properties> could come any element, but always
something come in that place. I need to extract the element (whatever be)
and convert into Object (deserializing the xml)

Thanks a lot
"AA" <aa@personal.net.py> wrote in message
news:%2******************@TK2MSFTNGP11.phx.gbl...
Hello, I need to extract an element from a xml document something like

this

<myXml>
<Header>
<Name/>
<LastName/>
<Age/>
</Head>
<Body>
<Properties>
<Address/>
<Location/>
<Country>
</Properties>
</Body>
</myXml>
I need to extract from my Stream the <Properties> element (and sub

elements)
located inside the Body element.

How can I do that?

Thanks a lot again!

AA



Nov 12 '05 #5

P: n/a
I've actually heard that DOM is old and needs to retire for most uses.
DOM is heavy and using XmlReader is lighter and faster, so I've heard :)

In practice though, if your source xml is small, I'd say use XmlDocument if
processing a stream or a large document, use XmlReader.

"Chris Barber" <ch***@blue-canoe.co.uk.NOSPAM> wrote in message
news:eu**************@TK2MSFTNGP09.phx.gbl...
If you are working with XML and XSLT then you will undoubtedly use an XMLDOM in almost every scenario - that's what it's for. If you don't then you are
back to the Stone Age using string parsing techniques and regular
expressions.
If you can then try and use the latest version of MSXML by detecting and
using version specific ProgIDs 0 MSXML v4.0 is a lot faster than v3.0.
Saying that, they are both quick, *very* powerful, and relatively
lightweight as far as COM objects go.

Chris.
"AA" <aa@personal.net.py> wrote in message
news:O$**************@TK2MSFTNGP10.phx.gbl...
Thanks Chris!

But DOM is not too heavy? is really necesary? is the only way?

:)

Thanks anyway

AA
"Chris Barber" <ch***@blue-canoe.co.uk.NOSPAM> wrote in message
news:eJ**************@TK2MSFTNGP10.phx.gbl...
Load the XML into a DOM and then do:

'Return the first child of the body element.
Dim pstrXML, pstrXPath
pstrXPath = "/myXml/Body/*[1]"
pstrXML = DOM.selectSingleNode(pstrXPath).xml

or ...

'Return the properties element wherever it may be (first instance).
Dim pstrXML, pstrXPath
pstrXPath = "//Properties[1]"
pstrXML = DOM.selectSingleNode(pstrXPath).xml

** Beware, the Xpath is case sensitive.

You can then use this XML and load it into another DOM if you want to work with it as a document / apply XSLT to it etc.

Chris.

"AA" <aa@personal.net.py> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
I forgot to mention that the element <Properties> could vary, could come
<Profesion> instead of <Properties> could come any element, but always
something come in that place. I need to extract the element (whatever be) and convert into Object (deserializing the xml)

Thanks a lot
"AA" <aa@personal.net.py> wrote in message
news:%2******************@TK2MSFTNGP11.phx.gbl...
Hello, I need to extract an element from a xml document something like

this

<myXml>
<Header>
<Name/>
<LastName/>
<Age/>
</Head>
<Body>
<Properties>
<Address/>
<Location/>
<Country>
</Properties>
</Body>
</myXml>
I need to extract from my Stream the <Properties> element (and sub

elements)
located inside the Body element.

How can I do that?

Thanks a lot again!

AA



Nov 12 '05 #6

P: n/a
Well if your talking .NET then I can't say - I have no current experience
with XML in .NET (yet).

Still, I have Xselerator and the timings for even the most complex of XSLT
transforms are pretty damned quick. Certainly quick enough for me to believe
that using an XMLDOM is not going to seriously damage the speed of my apps /
web stuff. At the end of the day, it's still just another COM component.

I'd like to know where you got 'DOM is old and needs to retire for most
uses' from. I've never heard that in all the last three years of working
with XML so I'm intrigued as to who may have said it. There are ways of
making anything run slow but a little understanding of how the parser works
can go a long way. As far as I am aware, MSXML v4.0 is pretty near the top
in terms of speed for both DOM and XSLT.

MSXML performance:
http://msdn.microsoft.com/library/de...ml02212000.asp

Chris.

"Jiho Han" <ji******@infinityinfo.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
I've actually heard that DOM is old and needs to retire for most uses.
DOM is heavy and using XmlReader is lighter and faster, so I've heard :)

In practice though, if your source xml is small, I'd say use XmlDocument if
processing a stream or a large document, use XmlReader.

"Chris Barber" <ch***@blue-canoe.co.uk.NOSPAM> wrote in message
news:eu**************@TK2MSFTNGP09.phx.gbl...
If you are working with XML and XSLT then you will undoubtedly use an XMLDOM in almost every scenario - that's what it's for. If you don't then you are
back to the Stone Age using string parsing techniques and regular
expressions.
If you can then try and use the latest version of MSXML by detecting and
using version specific ProgIDs 0 MSXML v4.0 is a lot faster than v3.0.
Saying that, they are both quick, *very* powerful, and relatively
lightweight as far as COM objects go.

Chris.
"AA" <aa@personal.net.py> wrote in message
news:O$**************@TK2MSFTNGP10.phx.gbl...
Thanks Chris!

But DOM is not too heavy? is really necesary? is the only way?

:)

Thanks anyway

AA
"Chris Barber" <ch***@blue-canoe.co.uk.NOSPAM> wrote in message
news:eJ**************@TK2MSFTNGP10.phx.gbl...
Load the XML into a DOM and then do:

'Return the first child of the body element.
Dim pstrXML, pstrXPath
pstrXPath = "/myXml/Body/*[1]"
pstrXML = DOM.selectSingleNode(pstrXPath).xml

or ...

'Return the properties element wherever it may be (first instance).
Dim pstrXML, pstrXPath
pstrXPath = "//Properties[1]"
pstrXML = DOM.selectSingleNode(pstrXPath).xml

** Beware, the Xpath is case sensitive.

You can then use this XML and load it into another DOM if you want to work with it as a document / apply XSLT to it etc.

Chris.

"AA" <aa@personal.net.py> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
I forgot to mention that the element <Properties> could vary, could come
<Profesion> instead of <Properties> could come any element, but always
something come in that place. I need to extract the element (whatever be) and convert into Object (deserializing the xml)

Thanks a lot
"AA" <aa@personal.net.py> wrote in message
news:%2******************@TK2MSFTNGP11.phx.gbl...
Hello, I need to extract an element from a xml document something like

this

<myXml>
<Header>
<Name/>
<LastName/>
<Age/>
</Head>
<Body>
<Properties>
<Address/>
<Location/>
<Country>
</Properties>
</Body>
</myXml>
I need to extract from my Stream the <Properties> element (and sub

elements)
located inside the Body element.

How can I do that?

Thanks a lot again!

AA




Nov 12 '05 #7

P: n/a
Chris,

You're right. MSXML 4.0 is pretty darn fast and even faster than .NET 1.1's
implementation. I read that it was due to the timing of the .NET 1.1 launch
more than anything and .NET 2.0 implementation is supposed to be doubled or
4 times in average XSLT processing.

Here's the link to the improvements in 2.0 release:
http://msdn.microsoft.com/xml/defaul...SysXMLVS05.asp

The article also spends some time on DOM API versus .NET's pull model(#3).
Maybe I'm blindly taking one guy's opinion as gospel but it's hard not to
when the person is the lead program manager for "Microsoft's WebData team,
which develops Microsoft's data access technologies including the components
within the System.Xml and System.Data namespaces of the .NET Framework,
Microsoft XML Core Services (MSXML) and Microsoft Data Access Components
(MDAC). "

Apparently many people in this newsgroup believe that's true as well - that
XPathDocument/XmlReader is preferred over XmlDocument(DOM).

According to him though, DOM isn't going away and I don't think I meant to
say that it is going away any time soon. I still use it myself.
I can't find the other article where the author more or less said "DOM is
old...". I am sure that he meant it jokingly as one proponent of the
XPathDocument might say.
I am very excited about XML 2.0 and can't wait for it to be released myself.

As for your lack of experience in System.Xml, why not?! It's great stuff!
I am no expert in Xml technology and I am getting so much done so easily
even though there are some hurdles in v1.1.

Cheers,
Jiho

"Chris Barber" <ch***@blue-canoe.co.uk.NOSPAM> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Well if your talking .NET then I can't say - I have no current experience
with XML in .NET (yet).

Still, I have Xselerator and the timings for even the most complex of XSLT
transforms are pretty damned quick. Certainly quick enough for me to believe that using an XMLDOM is not going to seriously damage the speed of my apps / web stuff. At the end of the day, it's still just another COM component.

I'd like to know where you got 'DOM is old and needs to retire for most
uses' from. I've never heard that in all the last three years of working
with XML so I'm intrigued as to who may have said it. There are ways of
making anything run slow but a little understanding of how the parser works can go a long way. As far as I am aware, MSXML v4.0 is pretty near the top
in terms of speed for both DOM and XSLT.

MSXML performance:
http://msdn.microsoft.com/library/de...ml02212000.asp
Chris.

"Jiho Han" <ji******@infinityinfo.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
I've actually heard that DOM is old and needs to retire for most uses.
DOM is heavy and using XmlReader is lighter and faster, so I've heard :)

In practice though, if your source xml is small, I'd say use XmlDocument if processing a stream or a large document, use XmlReader.

"Chris Barber" <ch***@blue-canoe.co.uk.NOSPAM> wrote in message
news:eu**************@TK2MSFTNGP09.phx.gbl...
If you are working with XML and XSLT then you will undoubtedly use an

XMLDOM
in almost every scenario - that's what it's for. If you don't then you are
back to the Stone Age using string parsing techniques and regular
expressions.
If you can then try and use the latest version of MSXML by detecting and
using version specific ProgIDs 0 MSXML v4.0 is a lot faster than v3.0.
Saying that, they are both quick, *very* powerful, and relatively
lightweight as far as COM objects go.

Chris.
"AA" <aa@personal.net.py> wrote in message
news:O$**************@TK2MSFTNGP10.phx.gbl...
Thanks Chris!

But DOM is not too heavy? is really necesary? is the only way?

:)

Thanks anyway

AA
"Chris Barber" <ch***@blue-canoe.co.uk.NOSPAM> wrote in message
news:eJ**************@TK2MSFTNGP10.phx.gbl...
Load the XML into a DOM and then do:

'Return the first child of the body element.
Dim pstrXML, pstrXPath
pstrXPath = "/myXml/Body/*[1]"
pstrXML = DOM.selectSingleNode(pstrXPath).xml

or ...

'Return the properties element wherever it may be (first instance).
Dim pstrXML, pstrXPath
pstrXPath = "//Properties[1]"
pstrXML = DOM.selectSingleNode(pstrXPath).xml

** Beware, the Xpath is case sensitive.

You can then use this XML and load it into another DOM if you want to

work with it as a document / apply XSLT to it etc.

Chris.

"AA" <aa@personal.net.py> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
I forgot to mention that the element <Properties> could vary, could come <Profesion> instead of <Properties> could come any element, but always
something come in that place. I need to extract the element (whatever be) and convert into Object (deserializing the xml)

Thanks a lot
"AA" <aa@personal.net.py> wrote in message
news:%2******************@TK2MSFTNGP11.phx.gbl...
> Hello, I need to extract an element from a xml document something like this
>
> <myXml>
> <Header>
> <Name/>
> <LastName/>
> <Age/>
> </Head>
> <Body>
> <Properties>
> <Address/>
> <Location/>
> <Country>
> </Properties>
> </Body>
> </myXml>
>
>
> I need to extract from my Stream the <Properties> element (and sub
elements)
> located inside the Body element.
>
> How can I do that?
>
> Thanks a lot again!
>
> AA
>
>



Nov 12 '05 #8

P: n/a
My lack of .NET stuff is mainly that I'm still completing development of a
web based GIS application using VB 6.0 COM components and although I would
love to move to .NET it's just not feasible for me at present apart from on
my own time.

I like the prospective speed increase for .NET 2.0 as opposed to .NET 1.1
but as they said, DOM isn't going to go away and for smaller documents <
250Kb it's a perfect easy to use implementation. For XSLT it's still about
50 times faster and a lot less work than the equivalent ASP code. I know, I
produced 20 reports in a day from XSLT and about 4 different XML documents
that would probably have taken me at least a week to even start debugging in
generic ASP and VBScript. XSLT is amazing (as we both probably know).

Cheers for the insight into .NET 2.0.

Chris.

"Jiho Han" <ji******@infinityinfo.com> wrote in message
news:uj**************@TK2MSFTNGP09.phx.gbl...
Chris,

You're right. MSXML 4.0 is pretty darn fast and even faster than .NET 1.1's
implementation. I read that it was due to the timing of the .NET 1.1 launch
more than anything and .NET 2.0 implementation is supposed to be doubled or
4 times in average XSLT processing.

Here's the link to the improvements in 2.0 release:
http://msdn.microsoft.com/xml/defaul...SysXMLVS05.asp

The article also spends some time on DOM API versus .NET's pull model(#3).
Maybe I'm blindly taking one guy's opinion as gospel but it's hard not to
when the person is the lead program manager for "Microsoft's WebData team,
which develops Microsoft's data access technologies including the components
within the System.Xml and System.Data namespaces of the .NET Framework,
Microsoft XML Core Services (MSXML) and Microsoft Data Access Components
(MDAC). "

Apparently many people in this newsgroup believe that's true as well - that
XPathDocument/XmlReader is preferred over XmlDocument(DOM).

According to him though, DOM isn't going away and I don't think I meant to
say that it is going away any time soon. I still use it myself.
I can't find the other article where the author more or less said "DOM is
old...". I am sure that he meant it jokingly as one proponent of the
XPathDocument might say.
I am very excited about XML 2.0 and can't wait for it to be released myself.

As for your lack of experience in System.Xml, why not?! It's great stuff!
I am no expert in Xml technology and I am getting so much done so easily
even though there are some hurdles in v1.1.

Cheers,
Jiho

"Chris Barber" <ch***@blue-canoe.co.uk.NOSPAM> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Well if your talking .NET then I can't say - I have no current experience
with XML in .NET (yet).

Still, I have Xselerator and the timings for even the most complex of XSLT
transforms are pretty damned quick. Certainly quick enough for me to believe that using an XMLDOM is not going to seriously damage the speed of my apps / web stuff. At the end of the day, it's still just another COM component.

I'd like to know where you got 'DOM is old and needs to retire for most
uses' from. I've never heard that in all the last three years of working
with XML so I'm intrigued as to who may have said it. There are ways of
making anything run slow but a little understanding of how the parser works can go a long way. As far as I am aware, MSXML v4.0 is pretty near the top
in terms of speed for both DOM and XSLT.

MSXML performance:
http://msdn.microsoft.com/library/de...ml02212000.asp
Chris.

"Jiho Han" <ji******@infinityinfo.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
I've actually heard that DOM is old and needs to retire for most uses.
DOM is heavy and using XmlReader is lighter and faster, so I've heard :)

In practice though, if your source xml is small, I'd say use XmlDocument if processing a stream or a large document, use XmlReader.

"Chris Barber" <ch***@blue-canoe.co.uk.NOSPAM> wrote in message
news:eu**************@TK2MSFTNGP09.phx.gbl...
If you are working with XML and XSLT then you will undoubtedly use an

XMLDOM
in almost every scenario - that's what it's for. If you don't then you are
back to the Stone Age using string parsing techniques and regular
expressions.
If you can then try and use the latest version of MSXML by detecting and
using version specific ProgIDs 0 MSXML v4.0 is a lot faster than v3.0.
Saying that, they are both quick, *very* powerful, and relatively
lightweight as far as COM objects go.

Chris.
"AA" <aa@personal.net.py> wrote in message
news:O$**************@TK2MSFTNGP10.phx.gbl...
Thanks Chris!

But DOM is not too heavy? is really necesary? is the only way?

:)

Thanks anyway

AA
"Chris Barber" <ch***@blue-canoe.co.uk.NOSPAM> wrote in message
news:eJ**************@TK2MSFTNGP10.phx.gbl...
Load the XML into a DOM and then do:

'Return the first child of the body element.
Dim pstrXML, pstrXPath
pstrXPath = "/myXml/Body/*[1]"
pstrXML = DOM.selectSingleNode(pstrXPath).xml

or ...

'Return the properties element wherever it may be (first instance).
Dim pstrXML, pstrXPath
pstrXPath = "//Properties[1]"
pstrXML = DOM.selectSingleNode(pstrXPath).xml

** Beware, the Xpath is case sensitive.

You can then use this XML and load it into another DOM if you want to

work with it as a document / apply XSLT to it etc.

Chris.

"AA" <aa@personal.net.py> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
I forgot to mention that the element <Properties> could vary, could come <Profesion> instead of <Properties> could come any element, but always
something come in that place. I need to extract the element (whatever be) and convert into Object (deserializing the xml)

Thanks a lot
"AA" <aa@personal.net.py> wrote in message
news:%2******************@TK2MSFTNGP11.phx.gbl...
> Hello, I need to extract an element from a xml document something like this
>
> <myXml>
> <Header>
> <Name/>
> <LastName/>
> <Age/>
> </Head>
> <Body>
> <Properties>
> <Address/>
> <Location/>
> <Country>
> </Properties>
> </Body>
> </myXml>
>
>
> I need to extract from my Stream the <Properties> element (and sub
elements)
> located inside the Body element.
>
> How can I do that?
>
> Thanks a lot again!
>
> AA
>
>




Nov 12 '05 #9

P: n/a
A better API than the DOM is the XPathDocument/XPathNavigator. It will be
the preferred API in .NET v2.0 also.
If you need to deserialize objects from the XML by performing an XPath
query, you can use the following:

XmlSerializer ser = new XmlSerializer(typeof(publishers));

XPathDocument doc = new XPathDocument("pubs.xml"));
XPathNavigator nav = doc.CreateNavigator();
// Select all publishers
XPathNodeIterator it = nav.Select("/dsPubs/publishers");
while (it.MoveNext())
{
XPathNavigatorReader reader = new XPathNavigatorReader(it.Current);
object pub = ser.Deserialize(reader);
Console.Write(pub);
}

You can perform any complex XPath query and deserialize later using the
XPathNavigatorReader. You can read about this class in
http://weblogs.asp.net/cazzu/archive...19/115966.aspx
NOTE: this class is part of the opensource Mvp.Xml project, which is being
developed by MVPs in XML worldwide. Download the project source from
SourceForge at
http://prdownloads.sourceforge.net/m...l.zip?download

HTH,
/kzu
"AA" <aa@personal.net.py> wrote in message
news:#u**************@TK2MSFTNGP12.phx.gbl...
I forgot to mention that the element <Properties> could vary, could come
<Profesion> instead of <Properties> could come any element, but always
something come in that place. I need to extract the element (whatever be)
and convert into Object (deserializing the xml)

Thanks a lot
"AA" <aa@personal.net.py> wrote in message
news:%2******************@TK2MSFTNGP11.phx.gbl...
Hello, I need to extract an element from a xml document something like

this

<myXml>
<Header>
<Name/>
<LastName/>
<Age/>
</Head>
<Body>
<Properties>
<Address/>
<Location/>
<Country>
</Properties>
</Body>
</myXml>
I need to extract from my Stream the <Properties> element (and sub

elements)
located inside the Body element.

How can I do that?

Thanks a lot again!

AA


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.655 / Virus Database: 420 - Release Date: 09/04/2004
Nov 12 '05 #10

This discussion thread is closed

Replies have been disabled for this discussion.