473,776 Members | 1,557 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

extracting a XML segment (element)

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
9 4348
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.ne t.py> wrote in message
news:%2******** **********@TK2M SFTNGP11.phx.gb l...
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
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.selectSingl eNode(pstrXPath ).xml

or ...

'Return the properties element wherever it may be (first instance).
Dim pstrXML, pstrXPath
pstrXPath = "//Properties[1]"
pstrXML = DOM.selectSingl eNode(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.ne t.py> wrote in message
news:%2******** ********@TK2MSF TNGP12.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.ne t.py> wrote in message
news:%2******** **********@TK2M SFTNGP11.phx.gb l...
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
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.NOS PAM> wrote in message
news:eJ******** ******@TK2MSFTN GP10.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.selectSingl eNode(pstrXPath ).xml

or ...

'Return the properties element wherever it may be (first instance).
Dim pstrXML, pstrXPath
pstrXPath = "//Properties[1]"
pstrXML = DOM.selectSingl eNode(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.ne t.py> wrote in message
news:%2******** ********@TK2MSF TNGP12.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.ne t.py> wrote in message
news:%2******** **********@TK2M SFTNGP11.phx.gb l...
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
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.ne t.py> wrote in message
news:O$******** ******@TK2MSFTN GP10.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.NOS PAM> wrote in message
news:eJ******** ******@TK2MSFTN GP10.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.selectSingl eNode(pstrXPath ).xml

or ...

'Return the properties element wherever it may be (first instance).
Dim pstrXML, pstrXPath
pstrXPath = "//Properties[1]"
pstrXML = DOM.selectSingl eNode(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.ne t.py> wrote in message
news:%2******** ********@TK2MSF TNGP12.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.ne t.py> wrote in message
news:%2******** **********@TK2M SFTNGP11.phx.gb l...
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
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.NOS PAM> wrote in message
news:eu******** ******@TK2MSFTN GP09.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.ne t.py> wrote in message
news:O$******** ******@TK2MSFTN GP10.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.NOS PAM> wrote in message
news:eJ******** ******@TK2MSFTN GP10.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.selectSingl eNode(pstrXPath ).xml

or ...

'Return the properties element wherever it may be (first instance).
Dim pstrXML, pstrXPath
pstrXPath = "//Properties[1]"
pstrXML = DOM.selectSingl eNode(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.ne t.py> wrote in message
news:%2******** ********@TK2MSF TNGP12.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.ne t.py> wrote in message
news:%2******** **********@TK2M SFTNGP11.phx.gb l...
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
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******@infin ityinfo.com> wrote in message
news:%2******** ********@tk2msf tngp13.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.NOS PAM> wrote in message
news:eu******** ******@TK2MSFTN GP09.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.ne t.py> wrote in message
news:O$******** ******@TK2MSFTN GP10.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.NOS PAM> wrote in message
news:eJ******** ******@TK2MSFTN GP10.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.selectSingl eNode(pstrXPath ).xml

or ...

'Return the properties element wherever it may be (first instance).
Dim pstrXML, pstrXPath
pstrXPath = "//Properties[1]"
pstrXML = DOM.selectSingl eNode(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.ne t.py> wrote in message
news:%2******** ********@TK2MSF TNGP12.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.ne t.py> wrote in message
news:%2******** **********@TK2M SFTNGP11.phx.gb l...
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
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.NOS PAM> wrote in message
news:%2******** ********@TK2MSF TNGP09.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******@infin ityinfo.com> wrote in message
news:%2******** ********@tk2msf tngp13.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.NOS PAM> wrote in message
news:eu******** ******@TK2MSFTN GP09.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.ne t.py> wrote in message
news:O$******** ******@TK2MSFTN GP10.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.NOS PAM> wrote in message
news:eJ******** ******@TK2MSFTN GP10.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.selectSingl eNode(pstrXPath ).xml

or ...

'Return the properties element wherever it may be (first instance).
Dim pstrXML, pstrXPath
pstrXPath = "//Properties[1]"
pstrXML = DOM.selectSingl eNode(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.ne t.py> wrote in message
news:%2******** ********@TK2MSF TNGP12.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.ne t.py> wrote in message
news:%2******** **********@TK2M SFTNGP11.phx.gb l...
> 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
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******@infin ityinfo.com> wrote in message
news:uj******** ******@TK2MSFTN GP09.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.NOS PAM> wrote in message
news:%2******** ********@TK2MSF TNGP09.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******@infin ityinfo.com> wrote in message
news:%2******** ********@tk2msf tngp13.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.NOS PAM> wrote in message
news:eu******** ******@TK2MSFTN GP09.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.ne t.py> wrote in message
news:O$******** ******@TK2MSFTN GP10.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.NOS PAM> wrote in message
news:eJ******** ******@TK2MSFTN GP10.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.selectSingl eNode(pstrXPath ).xml

or ...

'Return the properties element wherever it may be (first instance).
Dim pstrXML, pstrXPath
pstrXPath = "//Properties[1]"
pstrXML = DOM.selectSingl eNode(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.ne t.py> wrote in message
news:%2******** ********@TK2MSF TNGP12.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.ne t.py> wrote in message
news:%2******** **********@TK2M SFTNGP11.phx.gb l...
> 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
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(t ypeof(publisher s));

XPathDocument doc = new XPathDocument(" pubs.xml"));
XPathNavigator nav = doc.CreateNavig ator();
// Select all publishers
XPathNodeIterat or it = nav.Select("/dsPubs/publishers");
while (it.MoveNext())
{
XPathNavigatorR eader reader = new XPathNavigatorR eader(it.Curren t);
object pub = ser.Deserialize (reader);
Console.Write(p ub);
}

You can perform any complex XPath query and deserialize later using the
XPathNavigatorR eader. 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.ne t.py> wrote in message
news:#u******** ******@TK2MSFTN GP12.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.ne t.py> wrote in message
news:%2******** **********@TK2M SFTNGP11.phx.gb l...
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
1602
by: Porthos | last post by:
Hi All, I've been working on mining data from a schema file (all attribute data so far) and have come to the point where I need to get information that is contained in tags. For instance, <tag>My Data Here</tag>. I've tried using the <xsl:value-of select="tag"/> element, but it does not appear to work in schema files. Is this correct? Is there another way to get at this data? -James
13
15981
by: Kosio | last post by:
Hello, I know of a way to extract digits from a number using the %10 and divide by 10. But I am wondering if there is an algorithm out there that does not use a divide by 10 feature. The reason I ask is that I am programming on a RISC system where division is quite expensive, and I want to be able to extract the digits from an integer (the integer will be from 1 to 6 digits long, and I know how many digits are in the number).
14
3768
by: Adnan Siddiqi | last post by:
Hi Suppose I have following URLs comming from an HTML document <a href="http://mydomain1.com">Domain1</a> <a href="http://subdomain.domain.com/myfile.anyext">http://subdomain.domain.com/myfile.anyext</a> <a href="http://subdomain.domain2.com/myfile.anyext">Domain2</a>
2
4014
by: chris_j_adams | last post by:
Hi, I'm slowly discovering the world of JavaScript, so I'm not sure I'm attacking this problem in the right manner, thus if I'm in the wrong newsgroup, my apologies. What I'm trying to do is extract some news items from a web site. To do this, I'm using Microsoft Word VBA and using the following bit of script:
5
11360
by: druberego | last post by:
I read google and tried to find the solution myself. YES I do know that you can get undefined references if you: a) forget to implement the code for a prototype/header file item, or b) you forget to pass all the necessary object files to the linker. Neither of those are my problem. Please bear with me as the question I ask is rather long and I think it's beyond a CS101 level of linker stupidity. If it is a stupid CS101 mistake I'm making...
4
3940
by: dexter48 | last post by:
Hi I'm searching for a string occurance in a text file. I find the string ok and write the results to a log file. But on the line above is also some information I need. How can i get that. The string occurs a number of times, but not an exact match for the string above. Can you help please: see code #!C:\\Perl\\bin use File::Copy; use Archive::Zip qw( :ERROR_CODES :CONSTANTS ); ...
1
1224
by: mr t | last post by:
The DataTable xml written out, produces the following xml. can anyone show me how to extract that schema and put it in external file? the reason for this, is that I want to apply that structure to multiple different xml files and don't want to change the structure in each file. thanks. I guess it would involve to putting the content from <xs:schema to </xs:schemainto xsd file and referencing it somehow? don't know how to do that. ...
13
1386
by: biplab | last post by:
for(i=0;i<256;i++) { hist=0; } for(i=0;i<height;i++) { for(j=0;j<width;j++) { k=(long int)rgb1; hist=hist+1;
3
2155
by: madshov | last post by:
Hi, I have the following: <start> <segment Id="AAA"> <element Id="id">1</element> <element Id="seq">122</element> <element Id="seq2" Composite="yes">
0
9628
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10289
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10061
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9923
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8952
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7471
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6722
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5493
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2860
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.