XPath queries with Namespaces

I am having trouble writing an XPath query that deals with namespaces.  I've
see the documentation that says that I have to use a XmlNamespaceManager and
qualify my queries such that they match up with the definitions added to the
XmlNamespacemanager, but I want to write a query that pulls all of the
elements from my document that would otherwise match the
expression--regardless of their namespace.  Does anyone know how to do this?

Thanks,
Wells


0
11/25/2003 10:21:03 PM
dotnet.xml 7266 articles. 0 followers. Follow

2 Replies
182 Views

Similar Articles

[PageSpeed] 29

* Wells Caughey wrote in microsoft.public.dotnet.xml:
>I am having trouble writing an XPath query that deals with namespaces.  I've
>see the documentation that says that I have to use a XmlNamespaceManager and
>qualify my queries such that they match up with the definitions added to the
>XmlNamespacemanager, but I want to write a query that pulls all of the
>elements from my document that would otherwise match the
>expression--regardless of their namespace.  Does anyone know how to do this?

*[local-name() = "name"]

Selects all element children of the context node with a local-name
"name" regardless of their namespace.
0
bjoern1 (135)
11/25/2003 11:25:55 PM
Thank you so much, that is exactly what I need!

Wells

"Bjoern Hoehrmann" <bjoern@hoehrmann.de> wrote in message
news:3fd5e4b7.681314578@news.bjoern.hoehrmann.de...
> * Wells Caughey wrote in microsoft.public.dotnet.xml:
> >I am having trouble writing an XPath query that deals with namespaces.
I've
> >see the documentation that says that I have to use a XmlNamespaceManager
and
> >qualify my queries such that they match up with the definitions added to
the
> >XmlNamespacemanager, but I want to write a query that pulls all of the
> >elements from my document that would otherwise match the
> >expression--regardless of their namespace.  Does anyone know how to do
this?
>
> *[local-name() = "name"]
>
> Selects all element children of the context node with a local-name
> "name" regardless of their namespace.


0
11/26/2003 5:07:09 PM
Reply:

Similar Artilces:

Newbie question
Hello, I am a newbie to xml and xpath. I have a question that I hope someone can help me with. I need to parse an xml file (generated by a Sharepoint list file) in the format below. For example, I need to select all the nodes where the ows_Parent = '6;#miCommunities'. (Is there a LIKE operator in xpath (e.g, ows_Parent LIKE '%miCommunities'))? I'm not able to do even the simplest query on this xml file. I keep getting the error message: "Namespace, Manager or xsltContext needed. This query has a prefix, variable or user defined function." Any help y...

911! 911! MakeTable Queries Won't Work/Error 3001
This morning my database (A2000 format, running within Access XP on Windows 2000 Pro) worked fine. Then IT showed up, gave me a new computer, and upgraded me toWindows XP Pro/Office XP Pro. Now every one of my maketable queries throws an "Error 3001 -- invalid argument" error. I get the normal "You are about to run..." and "Old table will be deleted..." warnings, then the error. No references flagged as missing. Any ideas? This is a major disaster! Hi Larry, No specific ideas but from what I've read this usually seems to be related to corruption...

XPath #6
Dear Ng, after I have loaded am XmlDataDocument file, I try to extract a single node via XmlElement myElem = (XmlElement)this.XmlDataDocument.SelectSingleNode("/Document/Headerdata/myElem"); this.myProperty = myElem.InnerText; But the myElem object stays undefined. The XPath is definitly correct, if I extract the node via XmlNodeList list = this.XmlDataDocument.GetElementsByTagName("myElem"); XmlElement valueElement = (XmlElement)list.Item(0); this.myProperty = valueElement.InnerText; Then it works. The weard thing is, that the exception just occurs, if I've l...

Outlook XP and Outlook Express query
What's the best way to search for older news in the newsgroups ? Can I do that in Outlook Express ? Or should I use Google Groups search for that ? Also, can I read news in Outlook XP ? Is there a plug-in or something that will allow me to do it ? Wahat's the easiest way to backup my account info in OUTLOOK XP ? Thanks --- Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.716 / Virus Database: 472 - Release Date: 5/07/2004 Hi! MAPILab NNTP for Outlook: http://www.mapilab.com/outlook/nntp/ You can also find two other add-ins at http://www.SlipStick.com ...

Error: This Web query returned no data
Hi all. I'm having problems importing data from my own ASP.NET web site into Excel. I create a new Web Query and enter the URL, and my data page shows OK. I select the table in which I am interested from the window below, but when I click Import, I get the error message: "This Web Query returned no data. To modify the query, click OK, click the name of the external data range in the name box on the formula bar, and then click Edit Query on the External Data toolbar." Agh! What is wrong here? How come it can see the data in the dialog box, but when I come to actually...

Query Question?
I've posted an example of the Query results I would like returned from my Data Source. Basically, I want to have one row for each item, then have columns for the Months and show the Qty for that Item under the given Month. I know I can get my desired results using VBA, but was wondering if it could be done with straight SQL. Thank you. Data Source: Item Month Qty --------- --------- ------ 12345 1 50 12345 2 65 12345 3 42 67890 1 15 67890 2 11 67890 3 26 Query Results: Item Qt...

XML validation and namespace strangeness...
I've been having a play with XML validation against schemas in C# and been looking at the bookstore sample (See "Validation using the XmlSchemaSet" -> http://msdn.microsoft.com/en-us/library/as3tta56.aspx) So, I run the sample and the xml fails validation (as it should). I now change the xml to be valid and run the sample again, the xml now passes validation. I now change the namespace of the root node in the xml and run the sample again and again the sample passes validation..... Why? I have a schema with a namespace defined and am using that to validate my xml, so w...

Sum of Descriptions Query
Hi: I have a Query that has a WorkID and a Work Description: ID: Description: 1 Go to work 2 Come home 3 Eat Dinner I want to compile the Descriptions into a single description: Go to work, Come Home, Eat Dinner Can I do this & if so how? Thanks! Hi, can you tell us a bit more - what happens after you put 'Go to work, Come Home, Eat Dinner' together? Do you have a table with lots of entries like this that you need to concatenate in the same way? Jeanette Cunningham "Jazflux" <Jazflux@discussions.microsoft.com> wrote in message news:A8A57FEC-802D-4B54-BFD7-9...

Conditional formatting based on matching record in separate query
I would like to conditionally format a patient's name (e.g., Bold) in a report, based on whether it finds that name in a separate query of New Admissions. How can I make my condition look for matching data in the query? The table name is Today'sList, and the query name is Admissions. The matching field name containing the patient's name is "Field1". Do I need to construct an expression using IIf (I'm assuming)? My question is, somehow I need my conditional expression to say "If Field1 matches any record's Field1 in this other query (Admissions),...

Maximum size of Union Query?
I have been using a Union Query to combine multiple tables with identical fields. In a visual sense, I have "stacked" many tables on top of each other. However, I got to a certain point where I had apparently added too many SELECT statements to my query and recieved an error about my query being "too complex". Is there a limit to the number of SELECT statements that can be used? Is there a limit to the total number of fields added (each of my SELECT statements calls 4 fields)? Is there a limit to the numbers of results that this Union Query can produce (maximum ...

Query ask for parameter value?
Hi, I biult a query from another one. When I run the query, Access keep ask the value of M and F. When I click OK I get the result that I want. Is there a way to tell Access not to display dialog asking for value of M and F? SELECT NumberOfCitizenSpeakingByQuarter.Quaters, Sum(NumberOfCitizenSpeakingByQuarter.[Meeting Observed]) AS [Meeting Observed], Sum(NumberOfCitizenSpeakingByQuarter.Male) AS M, Sum(NumberOfCitizenSpeakingByQuarter.Female) AS F, [M]/[Meeting Observed] AS [Avg Male], [F]/[Meeting Observed] AS [Avg Female] FROM NumberOfCitizenSpeakingByQuarter GROUP BY Nu...

Using Two Different queries in a Report??
I am trying to create a report that has data from two different queries that is associated by a primary key (both queries have the primary key information in them). What I am trying to accomplish is that I have the main report (approx 102 records) but want to associate data from another query to be displayed on the same page as the primary data if there is an association to that particular primary key. When I tried to combine these queries into one, I only get the data that corresponds to the primary data, in which it is removing all of the other primary data that has no association. ...

Excel printing query
How do you print an excel worksheet with row numbers? <File> <PageSetUp> <Sheet> tab, And *check* "Row & Column Headings". -- HTH, RD --------------------------------------------------------------------------- Please keep all correspondence within the NewsGroup, so all may benefit ! --------------------------------------------------------------------------- "Linda" <Linda@discussions.microsoft.com> wrote in message news:808D8884-3E22-4018-90EC-932C90EC8570@microsoft.com... > How do you print an excel worksheet with row numbers? File | ...

Parse sub elements with namespace
How can I parse the component elements per partList in the following xml file? If I remove the namespace section of the xml my code works. I am not sure why the namespace section impacts my code? Of course when I remove the namespace I section I change the selectnode reference accordingly. <?xml version="1.0"?> <workOrderReleased xmlns="http://www.qad.com/qdoc" xmlns:enc="http://www.w3.org/2002/12/soap-encoding" xmlns:qcom="http://www.qad.com/qdoc/common" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi...

Help Needed on Complicated Query
Hi- I have a database that has a number of projects and suppliers for these projects. Each project has several contracts being supplied by several suppliers. I have a suppliers form with a contracts subform. What I want to do is create a subform inside the contracts subform where i will be able to add and edit invoices that have been billed against that contract. The matching data is: Same project, supplier, contract Here is the relationship diagram: http://myaccount.dropsend.com/storage/download?file_ids[]=1623882 I need help forming the SQL statement. I'm so...

Reference field in Distribution Query
Hi there, I am using GP10.0. While using Distribution Query, i have selected "Refrence" (8) as one of column. I expecting "Distribution Refrence" from General Ledger Entry should be populated. But i am not getting it. (It is showing Blank values in Excel. I am sure we are having Distribution Refrence in GL entries) Can you pls. let me know, Is my understanding correct? And also in Distribution Query how we can bring Distribution Refrence from G/L entries? Thanks, Loganathan S Logu, Distributioin reference field is available in GL10001 (GL_TRX_LINE...

Searching for specific word in query
Greeting, I am working with a large database and need to sort things out. My name table "All Accounts" has a field with different enteries (Active, Inactive, ETC). What I need to do is to build a query to have it look in one specific column "Account Status". Than, I want the query to produce (2) different results. Lets say I want it to search through the "Account Status" column and all the records that show "ACTIVE" to be produced in one result/table and the other that show "INACTIVE" to be procuded in a seperate table. Any ...

Query from three tables, problem when adding a record
I'm using Access 2002/2003. I have three tables, A, B and C. A has a primary key, which is linked to corresponding foreign keys in B and C. In each table the key values are unique. I have a query Q showing all rows from A linked to the corresponding rows from B and C. Calling Q, I can add a new row to A. I can also add a new row to B and a new row to C at the same time. But in case I add a new row only to A and then close the query, opening the query again does not allow me to add the corresponding new rows to B and C. Acces refuses to store these new rows. Can I modify the query to...

XPath Query problem with Namespace
I am triing to query the following xml document. I am loading the xml into a XML Document and then using XPath to get the EntityDataSet Node Here is my code XMLDoc = new System.Xml.XmlDocument(); if (this.m_FileLocation != null && this.m_FileLocation.Length > 0) XMLDoc.Load(this.m_FileLocation); else { throw new System.IO.FileNotFoundException("File can not be found", this.m_FileLocation); } //Locate Root System.Xml.XmlNodeList rootList = XMLDoc.SelectNodes("//EntityDataSet"); //This returns nothing If I remvoe the xmlns attribute of EntityTree...

Data Query
Hi there, I have an excel file with multiple sheets. When I open the file, a prompt is displayed asking whether to enable or disable refresh of query. As there should be no queries in this workbook, I would like to locate the query, and delete it. Any ideas ? I know I could simply re-create the workbook, but i dont want to do this. Look for a named range in each of the spreadsheet pages which begins Query.... If you delete this named range, this should disable the refresh data message -- Gary Brown ------------------------------------------------------------------------ Gary Brow...

Query results shown on form
Hi, I have a form that has a few criteria to be passed to my query "qry_EditMVCF". My goal is to allow the user to type in criteria to the fields into the form header - click a button and have the query result displayed in the detail of the form. The reason for displaying the records in a form is that I need to be able to track who makes what changes to the table and if I have the users entering data in a form I can append their userID to any records that they modify. The fields of my query are [Source] [Node] [EffDate] [RecType] [Amount] [UserID] I have filters on the form header l...

Criteria sent to multiple query's
I do not know if this is possible but I would like to have user entered criteria sent to multiple Query's at the same time. What I have is several Query's that look for something specific on what was purchased in different catagories. They need all that info in one report, the common criteria between them all (which the user will enter) is Customer number and dates. Any idea's? Thanks JS You could create a form where the user would enter the details required then press a button which runs the querys / report. Just enter int he criteria for each query the reference to the form...

XSLT, XPath, and XSL Formatting Objects (XSLFO)
does dot net support apis for XSLFO in addition to XSLT? Thanks In data Tue, 13 Jul 2004 11:47:40 -0500, David Laub ha scritto: > does dot net support apis for XSLFO in addition to XSLT? AFAIK no, you have to use nfop: http://nfop.sourceforge.net/ -- Lawrence "In IE we trust" Lawrence Oluyede wrote: >>does dot net support apis for XSLFO in addition to XSLT? > > > AFAIK no, you have to use nfop: > http://nfop.sourceforge.net/ You can, but you don't have to. There are plenty of production quality XSL-FO formatters supporting .NET. Most of them ar...

Group by query question
I have a query which is supposed to (and does) return the earliest record from a table that might have multiple records per "person" (famno). "dis is a calculated field in a pervious query that calculate how many days until a certain event (so a person could have 2 or more records, each with a different value for dis). It works properly: SELECT yahr_dist_from_today_greg.FAMNO, Min(yahr_dist_from_today_greg.dis) AS MinOfdis, Min(Date()+[dis]) AS NextYZ FROM yahr_dist_from_today_greg GROUP BY yahr_dist_from_today_greg.FAMNO; I have another field in the query, Rel...

Elapsed Time returned from query
I am using excel to query DB2. The field in DB2 Elapsed_Time has been calculated from a End_Date_Time Start Date Time. The Problem is that excel treats this value 00:00:00 as mm/dd/yyyy 00:00:00 AM/PM and there is nothing I can do to change the format once it is in Excel. Right now I have reverted to querying the Start/End Date Time and performing the calculation in excel and formating as an elapsed time. I am using the Microsoft Query Wizard from excel. Unfortunately that will not work for some of the data as CPU Elapsed Time is calculated and there is no CPU Start/Stop D...