Hi,
I want to select all "result" nodes from the following xml-document:
----
<results xmlns="http://schemas.microso ft.com/sharepoint/soap/">
<list id="{678737D9-2BF3-4FF7-A60E-5AA68595C8FB}"/>
<versioning enabled="1"/>
<settings
url="http://racoon/TestDokumente/_layouts/1033/LstSetng.aspx?L ist={678737D9-
2BF3-4FF7-A60E-5AA68595C8FB}"/>
<result comments="Eine neue Version mit weniger Text" created="2/7/2005
9:19 AM" createdBy="EMEA \baandr" size="24064"
url="http://racoon/TestDokumente/TestDocLibrary/VersioniertesDo kument.doc"
version="@6"/>
<result comments="" created="2/7/2005 9:09 AM" createdBy="EMEA \baandr"
size="29184"
url="http://racoon/TestDokumente/_vti_history/1/TestDocLibrary/Versioniertes
Dokument.doc" version="1" />
<result comments="" created="2/7/2005 9:16 AM" createdBy="EMEA \baandr"
size="31744"
url="http://racoon/TestDokumente/_vti_history/2/TestDocLibrary/Versioniertes
Dokument.doc" version="2"/>
<result comments="Eine neue Version" created="2/7/2005 9:18 AM"
createdBy="EMEA \baandr" size="31744"
url="http://racoon/TestDokumente/_vti_history/3/TestDocLibrary/Versioniertes
Dokument.doc" version="3"/>
<result comments="" created="2/7/2005 9:18 AM" createdBy="EMEA \baandr"
size="19968"
url="http://racoon/TestDokumente/_vti_history/4/TestDocLibrary/Versioniertes
Dokument.doc" version="4"/>
<result comments="eine neue version mit mehr Text" created="2/7/2005 9:19
AM" createdBy="EMEA \baandr" size="25088"
url="http://racoon/TestDokumente/_vti_history/5/TestDocLibrary/Versioniertes
Dokument.doc" version="5"/>
</results>
----
The XPath expression "//result" oder "/results/result" does not make the
selection. The only selection while playing
around with xpath I could make was "//@url" or similar (which is not what I
want).
Does someone can give me a hint on what's going wrong here?
regards,
Andreas 4 3954
Tempore 09:52:53, die Tuesday 08 February 2005 AD, hinc in foro {comp.text.xml} scripsit Andreas Baier <an***********@ web.de>: I want to select all "result" nodes from the following xml-document:
---- <results xmlns="http://schemas.microso ft.com/sharepoint/soap/"> <list id="{678737D9-2BF3-4FF7-A60E-5AA68595C8FB}"/> <versioning enabled="1"/> <settings url="http://racoon/TestDokumente/_layouts/1033/LstSetng.aspx?L ist={678737D9- 2BF3-4FF7-A60E-5AA68595C8FB}"/> <result comments="Eine neue Version mit weniger Text" created="2/7/2005 9:19 AM" createdBy="EMEA \baandr" size="24064" url="http://racoon/TestDokumente/TestDocLibrary/VersioniertesDo kument.doc" version="@6"/>
.... </results> ----
Hi,
the 'result' elements in this xml document have a namespace, viz 'http://schemas.microso ft.com/sharepoint/soap/', so in orther to match them properly, you have to declare that namespace within your XSL.
e.g.
<xsl:styleshe et
xmlns:xsl="http ://www.w3.org/1999/XSL/Transform"
version="1.0"
xmlns:soap="htt p://schemas.microso ft.com/sharepoint/soap/"
exclude-result-prefixes="soap" >
<xsl:output method="xml" indent="yes"/>
<xsl:template match="/">
<xsl:copy-of select="/soap:results/soap:result"/>
or
<xsl:copy-of select="//soap:result"/>
</xsl:template>
</xsl:stylesheet>
(note that you're not bound to the prefix 'soap', you can name it anything)
regards,
--
Joris Gillis ( http://www.ticalc.org/cgi-bin/acct-v...i?userid=38041)
Gaudiam omnibus traderat W3C, nec vana fides
"Joris Gillis" <ro**@pandora.b e> wrote the 'result' elements in this xml document have a namespace, viz
'http://schemas.microso ft.com/sharepoint/soap/', so in orther to match them properly, you have to declare that namespace
within your XSL.
Thank you for your help. I do not use Xpath in a transformation, but in
Visual Basic (using constructs like IXmlDomNodes). I'm wondering if there is
a way to select the nodes in xpath only (because I cannot
assign a namespace to my selection)
regards,
Andreas
Andreas Baier wrote: "Joris Gillis" <ro**@pandora.b e> wrote
the 'result' elements in this xml document have a namespace, viz
'http://schemas.microso ft.com/sharepoint/soap/',
so in orther to match them properly, you have to declare that namespace
within your XSL.
Thank you for your help. I do not use Xpath in a transformation, but in Visual Basic (using constructs like IXmlDomNodes). I'm wondering if there is a way to select the nodes in xpath only (because I cannot assign a namespace to my selection)
If you are using MSXML from MS then you should use
XmlDocument.set Property("Selec tionLanguage", "XPath")
XmlDocument.set Property("Selec tionNamespaces" ,
"xmlns:soap='ht tp://schemas.microso ft.com/sharepoint/soap/')
XmlDocument.sel ectNodes("//soap:result")
that is before you call selectNodes you bind a prefix to the namespace
you need to match. That is the proper way to work with namespaces and
MSXML and its selectNodes/selectSingleNod e methods.
Besides that you could try
XmlDocument.sel ectNodes("//*[local-name() = 'result' and
namespaceURI() = 'http://schemas.microso ft.com/sharepoint/soap/']")
but that is cumbersome and inefficient.
--
Martin Honnen http://JavaScript.FAQTs.com/
"Martin Honnen" wrote If you are using MSXML from MS then you should use XmlDocument.set Property("Selec tionLanguage", "XPath") XmlDocument.set Property("Selec tionNamespaces" , "xmlns:soap='ht tp://schemas.microso ft.com/sharepoint/soap/') XmlDocument.sel ectNodes("//soap:result")
Thank you very much - that was the missing hint :-) My other approach
would have been using XSLT (assigning a prefix for the namespace) and
converting it back to IXMLDOM...
But your approach is much more better :-)
regards,
Andreas This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: inquirydog |
last post by:
Hi-
One frusterating thing for me with xsl is that I don't know
how to make xslt throw some sort of exception when a value-of path
does not exist. For instance, suppose I have the following line in
xslt
<xsl:value-of select="/blah/q" />
and my xml document does not have a node /blah/q. The output would
|
by: gimme_this_gimme_that |
last post by:
I once downloaded a shareware program that allowed you
to open an xml file, click on a text or an attribute,
an then see the xpath expression that would fetch
that data.
The program didn't require that you enter the xpath
expression.
It may have been something that worked from opening
a page in IE. That would be OK. It could have been
|
by: steve bull |
last post by:
I have the following code snippet to read the colorRange attributes for the colorRangeSwatch in the xml file listed
below.
string expr = "/swatches/colorRangeSwatch/colorRange";
XmlElement crsElement = (XmlElement)m_colorRangeSwatchDoc.SelectSingleNode(expr);
bool fr = bool.Parse(crsElement.GetAttribute("fixed").ToString());
The element returned is always the 1st, All Blue Colors, why doesn't the expression...
|
by: ree32 |
last post by:
When I import an xml document in Visual studio and Genereate as schema
from it, and create a dataset from it, it adds this line into to the
root element of my xml file -
"xmlns="http://tempuri.org/nameOfRoot.xsd"
I have no idea what its pointing to & what is tempuri.org?
So when this tag is in my xml tag my xpath query never works.
But when I delete it work fine.
|
by: laks |
last post by:
Hi
I have the following xsl stmt.
<xsl:for-each select="JOB_POSTINGS/JOB_POSTING
\">
<xsl:sort select="JOB_TITLE" order="ascending"/>
This works fine when I use it.
But when using multiple values in the where clause as below
| |
by: David Thielen |
last post by:
Hi;
I set up my xml as follows:
XmlDocument xml = new XmlDocument();
xml.Load(File.Open("data.xml", FileMode.Open, FileAccess.Read));
XmlNamespaceManager context = new XmlNamespaceManager(xml.NameTable);
context.AddNamespace("", "http://www.test.org");
context.AddNamespace("sns", "http://www.test.org/sub");
XmlNode node = xml.SelectSingleNode("/root", context);
|
by: Chua Wen Ching |
last post by:
Hi there,
I had this xml file with me (not yet consider implementing xml namespaces yet).
<?xml version='1.0'?>
<Object>
<Windows>
<EID>1</EID>
<EDesc>Error 1</EDesc>
</Windows>
|
by: syed.akhlaq |
last post by:
Hi,
Does anyone know how can I validate XPath expressions using xsd
schema?
Thanks
|
by: arunairs |
last post by:
Hi,
Is there a way of validating and XPath? In this case , I am
accepting an XPath from the user and I need to validate the XPath
syntax. Is there a regular expression available that anyone can
direct me to, to validate a XPath?
thanks,
Arun
|
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: 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...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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: 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...
|
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
| |