how to determine all namespaces used in a document

I an writing some code which validates xml documents against the appropriate XML schemas. The problem is that I don't
always know which schemas are used for any particular document. Is there an XPATH query I can use to select all 
nodes with namespace declarations throughout the document? Sometimes the declarations are buried deep in the
document, so //namespace::* doesn't get everything. 

Any other method that I have overlooked of determining all of the namespaces would also be helpful.

Cheers
Monty
0
8/7/2007 2:13:28 AM
dotnet.xml 7266 articles. 0 followers. Follow

1 Replies
736 Views

Similar Articles

[PageSpeed] 6

davidsmontgomery wrote:
> I an writing some code which validates xml documents against the appropriate XML schemas. The problem is that I don't
> always know which schemas are used for any particular document. Is there an XPATH query I can use to select all 
> nodes with namespace declarations throughout the document? Sometimes the declarations are buried deep in the
> document, so //namespace::* doesn't get everything. 

Why not? // selects nodes at any level so even deeply buried 
declarations should be covered by that XPath.

The only issue with //namespace::* is that it contains all in scope 
namespace nodes so you will get a lot of duplicates. You can avoid that 
by using
   //namespace::*[not(. = ../../namespace::*)]


-- 

	Martin Honnen --- MVP XML
	http://JavaScript.FAQTs.com/
0
mahotrash (1778)
8/7/2007 12:34:30 PM
Reply:

Similar Artilces:

Using Min to Calculate across a table
I am attempting to massage data so I can see what the maximum number of pieces I can produce based off of various components. My query to figure out how many of each component is available per unit is complete and the output is: Part_Number, MaxComponent1, MaxComponent2,MaxComponent3, MaxComponent4 Does anyone have any suggestions as to how I could find the MIN of the components and group by part number? Cheers See the MinOfList() function here: http://allenbrowne.com/func-09.html A better solution would be to create a related table with many records for the combinations that are va...

determine mail flow problem!!!!!!!!
Help! :-( Our mailflow from 2 backend 2003 exchange servers keeps queuing up in the outbound queue (which is set to always run delivery). Messages stay in there from 10 to 120 minutes before being sent to our gateway MTA and then sent off site (to hotmail.com for example). However when I telnet from a backend server to the gateway over port 25 and send a test message it goes right away. I can't for the life of me figure out why. One example when viewed in message tracking history says: 10:16am - smtp: store driver, message submitted from store 10:16am - smtp: message submitted to ...

GetSaveAsFilename
When a user closes a workbook I want my macro to retrieve the username logged in to the machine and use that as the filename. Is this possible? ------------------------------------------------ ~~ Message posted from http://www.ExcelTip.com/ ~~ View and post usenet messages directly from http://www.ExcelForum.com/ In a general module: Option Explicit Private Declare Function apiGetUserName Lib "advapi32.dll" Alias _ "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long Function fOSUserName() As String ' Returns the network login name Dim lngLen As L...

Using VBA to time protect ranges
Hi hope you can help. Is it possible to use VBA to protect cells based on the current date. I am wanting to stop information from being changed that would belong to a past event ie I worked on Monday when I didn't Regards Don This is probably not the most elequent way to go about this but it does do what you are looking for. Sub Check_Date() Dim Today, check Today = Now ' Assign current system date and time. check = Range("D4:D4").Value 'Selects cells to check for date criteria If check < Today Then 'Verify if date is older Range("D4:...

Using it internationally
How adaptable would Money be to use in Sweden? How much functionality would I lose when I move? (Compared to Quicken. I am moving to Sweden and can't decide which of the two would be best when living there...the one that is most adoptable to international situations. Both allow currency changes but neither import from Swedish banks, but I'm curious about any other differences that would make Money better for my situation.) Thanks! Hi Dan, I'm using Money (US edition) in Spain, since I moved back home, and it works well. Obviously, I can't import from Spanish banks, but...

XslTransform not excluding default namespace despite exclude-result-prefixes attribute?
I'm writing an xslt in vs.net 2003 and in order to get intellisense on the html content I added the default namespace declaration xmlns="http://schemas.microsoft.com/intellisense/ie5". However, even though I also have exclude-result-prefixes="#default" declared the default namespace is still outputted on the resulting document. <?xml version="1.0" encoding="UTF-8" ?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://schemas.microsoft.com/intellisense/ie5" xmlns:...

Using fields within string functions?
First, let me explain what I am trying to do. I have a field, a1:a1000, of email address usernames (e.g. the par before the "@" symbol). I have another field, b1:b100, which is lis of profanities, racial slurs, and all other kinds of bad words. What need to do is flag each username that contains any of the bad words. The flags can be placed in column C or whatever. The SEARCH function works great if I'm only comparing two cells. But I need to compare one cell with a field of cells. COUNTIF will compare one cell to a field of cells, but it has to be a exact match. It will ...

Determine columns used
I have 100+ spreadsheets which i have to edit into a certain format. The spreadsheets currently have 100 columns (from 1-100). From there i have to reduce the number of columns set to 8 columns. E.g: 1 2 3 4 5 6 7 8 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 (from column 9 onwards, it goes to the 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 next rows' column 1) 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 How do i do that without altering the order of the value of the cell? Let me make sure we understand the question. You have ...

Internet Explorer (Browser) Crashes when using CRM Menu Bar
Problem: A user clicks on a menu bar item within CRM and Internet Explorer crashes. The user is asked if they wish to send the error report to Microsoft and closes out the current IE window. (Obviously this is very annoying when attempting to click on "Tools" > "Advance Find..."). This behavior appears to happen on the client machines that have been tested. When trying to duplicate this issue, I have found that on the initial start-up of CRM the menu system works fine. However, after navigating around in CRM (e.g. moving from the initial start-up screen to W...

Using HitTesting CListView
Hi, I have a CListCtrl which I have used to emulate a grid. I have several columns and rows but I need to be able to click on any particular row and column and find out which row and column I have selected. I have tried to use the following but doesn't seem to work void CListViewView::OnDblclkList(NMHDR* pNMHDR, LRESULT* pResult) { // TODO: Add your control notification handler code here DWORD dwPos = ::GetMessagePos (); CPoint point ((int) LOWORD (dwPos), (int) HIWORD (dwPos)); m_List.ScreenToClient(&point); int nIndex; if ((nIndex = m_List.HitTest(point)) != -1)...

Can i use Microsoft Money without internet access ?
I am thinking of installing money on my old pc, which I dont use to connect to the internet. I can download ofx files from my bank and update my accounts. Is there anyway I can startup money without all this live id business ? I trial installed it on a machine that I do use to connect to the internet and it never lets me get past the "sign in with live id" page. Thanks Anita In microsoft.public.money, anita1766@yahoo.com wrote: >I am thinking of installing money on my old pc, which I dont use to >connect to the internet. >I can download ofx files from my bank and update ...

Using Exchange as a POP Server
Can Exchange 5.5 be used as a POP server so that when our staff is out of the office they can check their company e-mail with a client such as Outlook Express? If so, can someone tell me how this is done? Would they log in with their NT name and password? Any help would be much appreciated. Thanks, Tim Rogers "Tim Rogers" <tim<remove this>@soundcare.com> wrote: >Can Exchange 5.5 be used as a POP server so that when our staff is out of >the office they can check their company e-mail with a client such as Outlook >Express? Yes. >If so, can someone t...

Dynamically determining when a month ends
Hello all, Ok, I have a simple excel spreadsheet, where I keep track of my spending on one tab, my income in another and my summary in a thrid. My problem happens when I try to dynamically calc. avg's for months in the summary page. For instance, if I want to see how much money I spent on average per month, or even per day, I draw from the data entered into the spending page. Now, the spending page is set up with the following columns: Date:: Description:: Amount The problem with this is that I can't predefine a max row # for each month, since I might have 80 entries in spending...

Message sorting after using the find feature.
When Outlook is sorted by received (up) so that the newest messages appear at the bottom of the screen -&- you search using the find toolbar -then view your results -then click the X to close the find toolbar, the view will revert to and highlight the oldest message rather than the newest that was highlighted prior to the find function. This is not the way that Word97 worked and was curious if anyone else had noticed this and/or found a solution. Thanks. ...

Organizing workbooks using file folders
Hi I need some some help with organizing workbooks. If anyone can give me an idea about how to organize workbooks through file folders, I would appreciate it Hi ~X Could you be a bit more specific please? What is that you need to do -- Message posted from http://www.ExcelForum.com ...

how do I set up outlook for home use?
How do I set up my microsoft outlook e-mail for home use? Contact your ISP for your mail account settings (or import them from Outlook Express if you have it setup there.) Install your profile and account settings and you are good to go. --� Milly Staples [MVP - Outlook] Post all replies to the group to keep the discussion intact. All unsolicited mail sent to my personal account will be deleted without reading. After furious head scratching, dauexghouse asked: | How do I set up my microsoft outlook e-mail for home use? ...

How make a favorite for all users in Ex2007/OWA/Documents area?
I am playing around with OWA in 2007 and exploring the "documents" feature of OWA that allows users to view Windows file shares by UNC. There is the individual "add to favories" option, but does anyone know of a way to administratively specify a favorite for all users? The alternative seems to be logon as each user to setup the same favorite--surely that is not the only way? Thanks for any help! Evan ...

Using a COUNTIF statement with an AND operator
I'm using Excel 2003 so I hope I'm not limited here. We are performing a space usage survey and I need to compile the data results. Each location has 70 entries over the course of 10 days. I have a column for "group work" where the value is either 1 or 0. I have another column for # of people observed in a particular office. What I'm trying to do is the following: Get a count of instances where "# of people" = 1 and "group work" = 0 I'm doing a lot of countif statements, but I don't see how to do a countif with an and operato...

Use the propertyInfo to setValues
Hello. I am using the propertyInfo type. dim pi as propertyInfo pi = myClass.getType().getProperty("myPropertyName", BindingFlags.Public Or BindingFlags.Instance) myPropertyName may be any property, such as borderLevel, etc. I want to set myPropertyName to a specific value, as propertyGrid does (I mean - by sending it a string). I see there are methods : getGetMethod, and getSetMethod - Are those method the property editors ? Can I use those method to solve the problem ? How can I do that ? Thanks :) On 21/06/2010 13:45, Mr. X. wrote: > I am using...

wmpnetwk.exe using 100% of CPU
The process wmpnetwk.exe is continually using all of my CPU. I am using Windows 7 and I want to share media to my D-Link DSM-750. Is there any way to temporarily turn this off and then turn in back on when I need to share files? ...

closing a form that uses a Dlookup
I have a form I use to enter new production requirements in to a table. On that form I have a the following controls Code Qty Needed Date Needed Plan Date The Code control has the following VBA on the On Exit event: Private Sub fldcode_Exit(Cancel As Integer) Dim varrtgno As String Dim vardays As Double Dim varfstop As Date Dim varplandate As Date varrtgno = DLookup("[rtg_no]", "dbo_imitmidx_sql", "[item_no]='" & [Forms]![frm enter fillroom requirements]![fldcode] & "'") 'Me!rtgno = varrtgno Select Case varrtgno ' some cas...

One use unabel to access Outlook webmail
I have a costumer that are running small biss 2003 with exchange. all are abole to read there mail throw outlook webmail except for one. we have tried changing her password, she is inn all the same groups as the others and she has outlook web enaboled as the other users. Any suggestion? What happens when she attempts to logon? Are there corresponding entries in the event logs? Nue "hans jacobsen" <hansjacobsen@discussions.microsoft.com> wrote in message news:73BF4D97-67B6-4C45-9BE6-6D3DFB2AE7B6@microsoft.com... >I have a costumer that are running small biss 2003 with e...

Animated GIF
Is there a way to insert an Animated GIF to XL? -- Regards, Marvin Hlavac Toronto, Canada Hi I have not found a way to put an animated gif directly into an excel worksheet, at least up to excel 97. As for newer versions, I don't know if any of them support animated gifs. Animated gifs can be used in an excel vba user form using the free gif89 control. HTH Ken "Marvin Hlavac" <hlavac@rogersSPAM.com> wrote in message news:%23Uuz87MlDHA.424@TK2MSFTNGP10.phx.gbl... > Is there a way to insert an Animated GIF to XL? > > -- > Regards, > Ma...

Request/Response XML to a remote server without using IIS
I have a need to take an xml file generated from a mainframe and post it to a remote server (ex: http//xml.company.com/order.cgi) which, in turn, will return an xml response. I have no idea how to do this without using IIS (the application is written in C#). Can someone point me in the right direction (samples, framework classes, etc.)? Look at HttpWebRequest. I used that in an app to upload an XML file and get a response XML file: HttpWebRequest req = (HttpWebRequest)WebRequest.Create(requrl); T "William" <nfr@nospam.com> wrote in message news:uZfnFeQsGHA.1304@...

how to determine the size of the sheet
Hi I had a collegue who told me once a way to dtermine the number of the rows in a sheet of the workbook I am working at. It is known that when you open a new workbook each sheet has maybe 65365 or something like that rows. MY QUESTION IS: HOW TO MAKE THE SHEET 1000 ROWS OR WHATEVER NUMBERS OF ROWS I ONLY NEED? Thanks in Advance, Ahmed Hi Ahmed The number of rows and columns are fixed. Your workaround would be to hide the ones you consider unneeded. HTH. Best wishes Harald "Ahmed SHEBL" <ahmad.shebl@hotmail.com> skrev i melding news:%231uFO3IcHHA.4720@TK2MSFTNGP0...