In the following XML:
<?xml version="1.0" encoding="utf-8" ?>
<Plcy service="ILiabi lity" boId ="LifePolicy , 1">
<Prem service="IPremi um" boId ="RegularPremiu m, 1"></Prem>
<L1 service="ILifeM ain" type = "Life1">
<FirstName>Shei la</FirstName>
<Age>65</Age>
<Relation>spous e</Relation>
</L1>
<L2 service="ILife" type = "Life2">
<FirstName>Bruc e</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 3791
"Valery" <va*****@gmail. comwrote in message
news:11******** **************@ k79g2000hse.goo glegroups.com.. .
In the following XML:
<?xml version="1.0" encoding="utf-8" ?>
<Plcy service="ILiabi lity" boId ="LifePolicy , 1">
<Prem service="IPremi um" boId ="RegularPremiu m, 1"></Prem>
<L1 service="ILifeM ain" type = "Life1">
<FirstName>Shei la</FirstName>
<Age>65</Age>
<Relation>spous e</Relation>
</L1>
<L2 service="ILife" type = "Life2">
<FirstName>Bruc e</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="ILiabi lity" boId ="LifePolicy , 1">
<Prem service="IPremi um" boId ="RegularPremiu m, 1"></Prem>
<L1 service="ILifeM ain" type = "Life1">
<FirstName>Shei la</FirstName>
<Age>65</Age>
<Relation>spous e</Relation>
</L1>
<L2 service="ILife" type = "Life2">
<FirstName>Bruc e</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.comw rote in message
news:ea******** ******@TK2MSFTN GP04.phx.gbl...
Valery wrote:
>In the following XML:
<?xml version="1.0" encoding="utf-8" ?> <Plcy service="ILiabi lity" boId ="LifePolicy , 1"> <Prem service="IPremi um" boId ="RegularPremiu m, 1"></Prem> <L1 service="ILifeM ain" type = "Life1"> <FirstName>Shei la</FirstName> <Age>65</Age> <Relation>spous e</Relation> </L1> <L2 service="ILife" type = "Life2"> <FirstName>Bruc e</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.comw rote in message
news:ea******** ******@TK2MSFTN GP04.phx.gbl...
>Valery wrote:
>>In the following XML:
<?xml version="1.0" encoding="utf-8" ?> <Plcy service="ILiabi lity" boId ="LifePolicy , 1"> <Prem service="IPremi um" boId ="RegularPremiu m, 1"></Prem> <L1 service="ILifeM ain" type = "Life1"> <FirstName>Shei la</FirstName> <Age>65</Age> <Relation>spous e</Relation> </L1> <L2 service="ILife" type = "Life2"> <FirstName>Bruc e</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.com wrote:
Joe Fawcett wrote:
"Oleg Tkachenko [MVP]" <s...@body.comw rote in message
news:ea******** ******@TK2MSFTN GP04.phx.gbl...
Valery wrote: In the following XML:
><?xml version="1.0" encoding="utf-8" ?> <Plcy service="ILiabi lity" boId ="LifePolicy , 1"> <Prem service="IPremi um" boId ="RegularPremiu m, 1"></Prem> <L1 service="ILifeM ain" type = "Life1"> <FirstName>Shei la</FirstName> <Age>65</Age> <Relation>spous e</Relation> </L1> <L2 service="ILife" type = "Life2"> <FirstName>Bruc e</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.c om/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:
script_node_0 = self.doc.createElement("script")
script_node_0.setAttribute("type", "text/javascript")
script_node_0.setAttribute("src", "../test.js")
minidom renders it 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 tag.
(This means that <foo></foo> is equal to <foo/>)
From XHTML specification:
|
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 null for both <br
/> and <br></br>
I also tried getNodeValue(), they both returns null also.
I know <br /> and <br></br> are the same from the xml spec. Is there
any way to tell the different syntax using DOM parser?
|
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 NAME="foo"> in HTML 2.0 to
4.01, it won't validate, it'll want to find the </A> tag.
However, when I write a document containing, say, <a name="foo" /> it
validates in XHTML 1.0.
I'm obviously missing something here, as this confuses me somewhat. Does
the magical / make the empty a element valid?...
|
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 XML schema,
when drawing a default connection like this:
>| |> >| |>
>| super-source-element |>---------->| super-target-element |>
| |
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 it. However I do need also the empty colums as empty elements
in the XML. How to do that ?
I don't understand why there is no simple option to specify the output
format, or did I miss something ?
regards
andreas
|
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 child node or text in them
<root>
<test>
<se>
<li>test</li>
</se>
</test>
<bs>
|
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: under what conditions will empty tags fail validation?
The former seems to be an easier question to answer.
XML files will arrive from around the world and must be schema
validated before further processing and loading into a database, so I'm
trying to foresee the various layouts that might be...
|
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.
Actually the XmlSerializer assigns "" (empty string) for a string
if the corresponding element is missing in the XML.
Input XML:
<DemoClass><A>some value</A><B></B><DemoClass>
|
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 ="RegularPremium, 1"></Prem>
<L1 service="ILifeMain" type = "Life1">
<FirstName>Sheila</FirstName>
<Age>65</Age>
<Relation>spouse</Relation>
</L1>
|
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...
| |
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
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,...
|
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...
|
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();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
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...
| |