In the following XML:
<?xml version="1.0" encoding="utf-8" ?>
<Plcy service="ILiability" boId ="LifePolicy, 1">
<Prem service="IPremium" boId ="RegularPremium, 1"></Prem>
<L1 service="ILifeMain" type = "Life1">
<FirstName>Sheila</FirstName>
<Age>65</Age>
<Relation>spouse</Relation>
</L1>
<L2 service="ILife" type = "Life2">
<FirstName>Bruce</FirstName>
<Age>70</Age>
</L2>
</Plcy>
I would like to select Nodes with boId attribute which are empty. I am
using an XPath expression:
"//*[@boId and not(text())]"
but MS VS XPathNavigator's Select() returns both Plcy and Prem. It
also sets IsEmpty field of Prem node to false.
Whose fault is it - mine or MS?
Yours,
Valery the Newbie 5 3660
"Valery" <va*****@gmail.comwrote in message
news:11**********************@k79g2000hse.googlegr oups.com...
In the following XML:
<?xml version="1.0" encoding="utf-8" ?>
<Plcy service="ILiability" boId ="LifePolicy, 1">
<Prem service="IPremium" boId ="RegularPremium, 1"></Prem>
<L1 service="ILifeMain" type = "Life1">
<FirstName>Sheila</FirstName>
<Age>65</Age>
<Relation>spouse</Relation>
</L1>
<L2 service="ILife" type = "Life2">
<FirstName>Bruce</FirstName>
<Age>70</Age>
</L2>
</Plcy>
I would like to select Nodes with boId attribute which are empty. I am
using an XPath expression:
"//*[@boId and not(text())]"
but MS VS XPathNavigator's Select() returns both Plcy and Prem. It
also sets IsEmpty field of Prem node to false.
Whose fault is it - mine or MS?
Yours,
Valery the Newbie
Maybe a whitespace issue. Try:
//*[@boId and not(normalize-space())]
--
Joe Fawcett (MVP - XML) http://joe.fawcett.name
Valery wrote:
In the following XML:
<?xml version="1.0" encoding="utf-8" ?>
<Plcy service="ILiability" boId ="LifePolicy, 1">
<Prem service="IPremium" boId ="RegularPremium, 1"></Prem>
<L1 service="ILifeMain" type = "Life1">
<FirstName>Sheila</FirstName>
<Age>65</Age>
<Relation>spouse</Relation>
</L1>
<L2 service="ILife" type = "Life2">
<FirstName>Bruce</FirstName>
<Age>70</Age>
</L2>
</Plcy>
I would like to select Nodes with boId attribute which are empty. I am
using an XPath expression:
"//*[@boId and not(text())]"
IN English that means "all elements having attribute bold and not having
at least one child text node". Plcy and Prem both satisfy this condition.
Try wider - select nodes that have no child nodes of any type at all:
"//*[@boId and not(node())]"
--
Oleg Tkachenko [XML MVP, MCPD] http://www.tkachenko.com/blog | http://www.XmlLab.Net
"Oleg Tkachenko [MVP]" <so**@body.comwrote in message
news:ea**************@TK2MSFTNGP04.phx.gbl...
Valery wrote:
>In the following XML:
<?xml version="1.0" encoding="utf-8" ?> <Plcy service="ILiability" boId ="LifePolicy, 1"> <Prem service="IPremium" boId ="RegularPremium, 1"></Prem> <L1 service="ILifeMain" type = "Life1"> <FirstName>Sheila</FirstName> <Age>65</Age> <Relation>spouse</Relation> </L1> <L2 service="ILife" type = "Life2"> <FirstName>Bruce</FirstName> <Age>70</Age> </L2> </Plcy>
I would like to select Nodes with boId attribute which are empty. I am using an XPath expression:
"//*[@boId and not(text())]"
IN English that means "all elements having attribute bold and not having
at least one child text node". Plcy and Prem both satisfy this condition.
Try wider - select nodes that have no child nodes of any type at all:
"//*[@boId and not(node())]"
--
Oleg Tkachenko [XML MVP, MCPD] http://www.tkachenko.com/blog | http://www.XmlLab.Net
Prem appears to have no content.
--
Joe Fawcett (MVP - XML) http://joe.fawcett.name
Joe Fawcett wrote:
"Oleg Tkachenko [MVP]" <so**@body.comwrote in message
news:ea**************@TK2MSFTNGP04.phx.gbl...
>Valery wrote:
>>In the following XML:
<?xml version="1.0" encoding="utf-8" ?> <Plcy service="ILiability" boId ="LifePolicy, 1"> <Prem service="IPremium" boId ="RegularPremium, 1"></Prem> <L1 service="ILifeMain" type = "Life1"> <FirstName>Sheila</FirstName> <Age>65</Age> <Relation>spouse</Relation> </L1> <L2 service="ILife" type = "Life2"> <FirstName>Bruce</FirstName> <Age>70</Age> </L2> </Plcy>
I would like to select Nodes with boId attribute which are empty. I am using an XPath expression:
"//*[@boId and not(text())]"
IN English that means "all elements having attribute bold and not having at least one child text node". Plcy and Prem both satisfy this condition. Try wider - select nodes that have no child nodes of any type at all:
"//*[@boId and not(node())]"
-- Oleg Tkachenko [XML MVP, MCPD] http://www.tkachenko.com/blog | http://www.XmlLab.Net
Prem appears to have no content.
Yes, but it has end tag, so in XmlReader/XPathNavigator terms isn't
empty element:
XPathNavigator.IsEmptyElement Property
When overridden in a derived class, gets a value indicating whether the
current node is an empty element without an end element tag. http://msdn2.microsoft.com/en-us/lib...tyelement.aspx
--
oleg
On Oct 31, 6:49 am, Oleg Tkachenko <f...@dummy.comwrote:
Joe Fawcett wrote:
"Oleg Tkachenko [MVP]" <s...@body.comwrote in message
news:ea**************@TK2MSFTNGP04.phx.gbl...
Valery wrote: In the following XML:
><?xml version="1.0" encoding="utf-8" ?> <Plcy service="ILiability" boId ="LifePolicy, 1"> <Prem service="IPremium" boId ="RegularPremium, 1"></Prem> <L1 service="ILifeMain" type = "Life1"> <FirstName>Sheila</FirstName> <Age>65</Age> <Relation>spouse</Relation> </L1> <L2 service="ILife" type = "Life2"> <FirstName>Bruce</FirstName> <Age>70</Age> </L2> </Plcy>
>I would like to select Nodes with boId attribute which are empty. I am using an XPath expression:
> "//*[@boId and not(text())]"
IN English that means "all elements having attribute bold and not having
at least one child text node". Plcy and Prem both satisfy this condition.
Try wider - select nodes that have no child nodes of any type at all:
"//*[@boId and not(node())]"
--
Oleg Tkachenko [XML MVP, MCPD] http://www.tkachenko.com/blog|http://www.XmlLab.Net
Prem appears to have no content.
Yes, but it has end tag, so in XmlReader/XPathNavigator terms isn't
empty element:
XPathNavigator.IsEmptyElement Property
When overridden in a derived class, gets a value indicating whether the
current node is an empty element without an end element tag.
http://msdn2.microsoft.com/en-us/lib...th.xpathnaviga...
--
oleg- Hide quoted text -
- Show quoted text -
Wow (surprised) and thanks. It works indeed.
V. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Derek Basch |
last post by:
Hello All,
I ran into a problem while dynamically constructing XHTML documents using
minidom. If you create a script tag such as:
...
|
by: Mikko Ohtamaa |
last post by:
From XML specification:
The
representation of an empty element is either a start-tag immediately
followed by an end-tag, or an empty-element...
|
by: vega |
last post by:
How do I detect empty tags if I have the DOM document?
For example: <br /> and <br></br>
I tried org.w3c.dom.Node.getFirstChild(), it returns...
|
by: Neal |
last post by:
According to the specs
(http://www.w3.org/TR/html401/struct/links.html#h-12.2), the <a> element
requires an end tag. And so, when we use <A...
|
by: Lukas |
last post by:
title:
xml to xml mapping: empty elements output although input element is not
empty
Why is is that when mapping from a XML schema to another...
|
by: Andreas Palm |
last post by:
I have a dataset that has DBNull in certain columns, now when I write
out this one to XML, I only get the columns as elements that do have
data in...
|
by: tMan |
last post by:
whats the xpath to get all the empty nodes in a document. in the xml below i want to get the nodes <empty> and <t>
all other nodes either have a...
|
by: wolf_y |
last post by:
My question is simply: under what conditions will empty tags of the
form <MOM></MOM> pass schema validation? Of course, the mirror
question is:...
|
by: kumar.senthil |
last post by:
Hi,
I'm using XmlSerializer to create an object from the XML string. I
would like to know whether I can get a null value for an empty XML
element....
|
by: Valery |
last post by:
In the following XML:
<?xml version="1.0" encoding="utf-8" ?>
<Plcy service="ILiability" boId ="LifePolicy, 1">
<Prem service="IPremium" boId...
|
by: concettolabs |
last post by:
In today's business world, businesses are increasingly turning to PowerApps to develop custom business applications. PowerApps is a powerful tool...
|
by: teenabhardwaj |
last post by:
How would one discover a valid source for learning news, comfort, and help for engineering designs? Covering through piles of books takes a lot of...
|
by: Kemmylinns12 |
last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
|
by: CD Tom |
last post by:
This only shows up in access runtime. When a user select a report from my report menu when they close the report they get a menu I've called Add-ins...
|
by: jalbright99669 |
last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
|
by: antdb |
last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine
In the overall architecture, a new "hyper-convergence" concept was...
|
by: Matthew3360 |
last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
|
by: WisdomUfot |
last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific...
|
by: Matthew3360 |
last post by:
Hi,
I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web...
| |