OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   RE: [xml-dev] Nasty XPath expressions

[ Lists Home | Date Index | Thread Index ]

Hmm, do you mean XPath expressions with functions, such as concat()? I
guess I was purely assumping about what the behavior of .valueOf is.
However, the code example I gave works fine for getting the value of
attributes or elements in test XML documents.  I tested it before I sent
it.  So for example, if I have XML that says:

<?xml version="1.0"?>
<blah>
 <person name="Joshua" age="27" />
</blah>

Then I can do

int age =
(int)doc.SelectSingleNode("//person[@name='Joshua']/@age").InnerXml

As for the second part of your question, I wasn't imagining anything so
sophisticated.  I was talking about manually loading the XSD into SOM
and then walking the SOM to try to correlate what datatype you would
have to cast.  Having PSVI available would be even better, but I don't
think that's happening in the first release of .NET FX.



> -----Original Message-----
> From: Dare Obasanjo [mailto:kpako@yahoo.com]
> Sent: Friday, December 14, 2001 5:27 PM
> To: Joshua Allen; francis@redrice.com; Christian Nentwich
> Cc: xml-dev
> Subject: Re: [xml-dev] Nasty XPath expressions
> 
> SelectSingleNode and SelectSingleNodes threw a
> 
>     Unhandled Exception: System.Xml.XPath.XPathException:
>         The expression passed to this method should result in a
NodeSet.
> 
> everytime I tried to perform a query that didn't return a NodeSet.
Thus I
> don't think there's a .NET alternative to Oracle's node.valueOf(<Xpath
> expression>);
> 
> Secondly, as at Beta 2 of .NET there is no way to attach a schema to a
> document and access the PSVI via the SOM, so are you stating that this
> functionality will exist when .NET finally ships?
> 
> --
> THINGS TO DO IF I BECOME AN EVIL OVERLORD #159
> If I burst into rebel headquarters and find it deserted except for an
odd,
> blinking device, I will not walk up and investigate; I'll run like
hell.
> 
> ----- Original Message -----
> From: "Joshua Allen" <joshuaa@microsoft.com>
> To: <francis@redrice.com>; "Christian Nentwich"
<c.nentwich@cs.ucl.ac.uk>
> Cc: "xml-dev" <xml-dev@lists.xml.org>
> Sent: Friday, December 14, 2001 11:08 AM
> Subject: RE: [xml-dev] Nasty XPath expressions
> 
> 
> I'm not sure how closely this mirrors the behavior of .valueOf, but I
> often use:
> 
> node.SelectSingleNode(strXPath).InnerXml
> 
> This works with the native MSXML and managed .NET classes, and gives
you
> whatever the value of the selected element or attribute is.  You have
to
> cast it to the appropriate type if you want something other than a
> string; you could probably get the type from the SOM if there is an
XSD
> associated, but I never bothered.
> 
> > -----Original Message-----
> > From: Francis Norton [mailto:francis@redrice.com]
> > Sent: Friday, December 14, 2001 10:13 AM
> > To: Christian Nentwich
> > Cc: xml-dev
> > Subject: Re: [xml-dev] Nasty XPath expressions
> >
> >
> >
> > Christian Nentwich wrote:
> >
> > > On Fri, 2001-12-14 at 14:42, Steve Muench wrote:
> > >
> > >>Oracle's XML Parser also provides an XPath engine that's
> > >>woven into our DOM implementation. Using it is as easy as:
> > >>   yourNode.selectNodes("Your/Favorite[XPath=Here]");
> > >>   yourNode.selectSingleNode("Your/Favorite[XPath=Here]");
> > >>   yourNode.valueOf("Your/Favorite[XPath=Here]");
> > >>
> > >>
> > >
> > > You say your users haven't asked for more, but if I was to become
> your
> > > user, I would. .net offers these methods as well,
> >
> >
> > How does .Net support .valueOf(<XPathExpression>)? I'm interested
> > because the fact that MSXML 3 only supports XPath expressions that
> > return node-lists is a bit of a frustration, and I couldn't find any
> > improvement on this in .Net beta 2.
> >
> > Francis.
> >
> >
> > -----------------------------------------------------------------
> > The xml-dev list is sponsored by XML.org <http://www.xml.org>, an
> > initiative of OASIS <http://www.oasis-open.org>
> >
> > The list archives are at http://lists.xml.org/archives/xml-dev/
> >
> > To subscribe or unsubscribe from this list use the subscription
> > manager: <http://lists.xml.org/ob/adm.pl>
> 
> 
> -----------------------------------------------------------------
> The xml-dev list is sponsored by XML.org <http://www.xml.org>, an
> initiative of OASIS <http://www.oasis-open.org>
> 
> The list archives are at http://lists.xml.org/archives/xml-dev/
> 
> To subscribe or unsubscribe from this list use the subscription
> manager: <http://lists.xml.org/ob/adm.pl>
> 
> 
> 
> _________________________________________________________
> 
> Do You Yahoo!?
> 
> Get your free @yahoo.com address at http://mail.yahoo.com
> 
> 





 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS