473,474 Members | 1,312 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

XML issue

Hi Group,

I have a problem with XML! I have an xml file which starts like this:

<Plaftorm PlatformName="empty" PlatformID="1" StyleUsage="URL"
xmlns="http://www.domain.com" PatformProgrammer="mynamehere"
DateTime="09/12/2003 6:00:54 PM">
.......
......
</Plaform>

When I changed it to something like below, the XPath search works fine.

<Plaftorm >
.......
.....
</Plaform>

Any idea?

Thx
Nov 15 '05 #1
8 1316
Hard to say, because:

- You've given us XML that isn't well-formed (although it looks like a
typo, you've done it twice).
- You haven't said what the problem is. Everybody has problems with XML.
However, the solution depends on exactly which particular problem you're
having ;)

--
Mickey Williams
Author, "Microsoft Visual C# .NET Core Reference", MS Press
www.servergeek.com
"C# newbie" <rs****@otxresearch.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Hi Group,

I have a problem with XML! I have an xml file which starts like this:

<Plaftorm PlatformName="empty" PlatformID="1" StyleUsage="URL"
xmlns="http://www.domain.com" PatformProgrammer="mynamehere"
DateTime="09/12/2003 6:00:54 PM">
......
.....
</Plaform>

When I changed it to something like below, the XPath search works fine.

<Plaftorm >
......
....
</Plaform>

Any idea?

Thx

Nov 15 '05 #2
Mickey,

It's not my xml. I've been told to do some process on it and when
I removed some part of header it worked just fine!
Again The problem is that when the XML starts with <Platfom> my XPath
function works good but in its native form no!
It ignores some of my queries!

Let me know if you need more info.

Thanks in advance

"Mickey Williams" <my first name at servergeek.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
Hard to say, because:

- You've given us XML that isn't well-formed (although it looks like a
typo, you've done it twice).
- You haven't said what the problem is. Everybody has problems with XML.
However, the solution depends on exactly which particular problem you're
having ;)

--
Mickey Williams
Author, "Microsoft Visual C# .NET Core Reference", MS Press
www.servergeek.com
"C# newbie" <rs****@otxresearch.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Hi Group,

I have a problem with XML! I have an xml file which starts like this:

<Plaftorm PlatformName="empty" PlatformID="1" StyleUsage="URL"
xmlns="http://www.domain.com" PatformProgrammer="mynamehere"
DateTime="09/12/2003 6:00:54 PM">
......
.....
</Plaform>

When I changed it to something like below, the XPath search works fine.

<Plaftorm >
......
....
</Plaform>

Any idea?

Thx


Nov 15 '05 #3
When you change from

<Plaftorm xmlns="http://www.domain.com"

to

<Platform ...

you change the default namespace. An XPath expression has to match the
namespace as well as the element name, so in the first example XPath like
select="/Platform" won't work because it does not specify the namespace that
the Platform element is in.

"C# newbie" <rs****@otxresearch.com> wrote in message
news:uM**************@TK2MSFTNGP12.phx.gbl...
Mickey,

It's not my xml. I've been told to do some process on it and when I removed some part of header it worked just fine!
Again The problem is that when the XML starts with <Platfom> my XPath
function works good but in its native form no!
It ignores some of my queries!

Let me know if you need more info.

Thanks in advance

"Mickey Williams" <my first name at servergeek.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
Hard to say, because:

- You've given us XML that isn't well-formed (although it looks like a
typo, you've done it twice).
- You haven't said what the problem is. Everybody has problems with XML. However, the solution depends on exactly which particular problem you're
having ;)

--
Mickey Williams
Author, "Microsoft Visual C# .NET Core Reference", MS Press
www.servergeek.com
"C# newbie" <rs****@otxresearch.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Hi Group,

I have a problem with XML! I have an xml file which starts like this:

<Plaftorm PlatformName="empty" PlatformID="1" StyleUsage="URL"
xmlns="http://www.domain.com" PatformProgrammer="mynamehere"
DateTime="09/12/2003 6:00:54 PM">
......
.....
</Plaform>

When I changed it to something like below, the XPath search works fine.
<Plaftorm >
......
....
</Plaform>

Any idea?

Thx



Nov 15 '05 #4
Ash
Just agreeing with the namespace issue.

I had this problem when first using XML and referred to this document:

http://msdn.microsoft.com/library/de...ml05202002.asp

Taking your example, making one spelling correction for the closing root element, adding the necessary additions to support the namespace, and an extra element to test it I get this:

System.Xml.XmlDocument xd = new XmlDocument();

xd.InnerXml = "<Plaftorm PlatformName=\"empty\" PlatformID=\"1\" StyleUsage=\"URL\" xmlns:xslt=\"http://www.domain.com\" PatformProgrammer=\"mynamehere\" DateTime=\"09/12/2003 6:00:54 PM\"><xslt:a>datafora</xslt:a></Plaftorm>";
XmlNamespaceManager nsMgr = new XmlNamespaceManager(xd.NameTable);
nsMgr.AddNamespace("xslt","http://www.domain.com");
XmlNodeList nodes = xd.SelectNodes("//xslt:a", nsMgr);
Console.WriteLine(nodes.Count);

Another option would be to remove the namespace from the xml completely:

xd.InnerXml = "<Plaftorm PlatformName=\"empty\" PlatformID=\"1\" StyleUsage=\"URL\" PatformProgrammer=\"mynamehere\" DateTime=\"09/12/2003 6:00:54 PM\"><a>datafora</a></Plaftorm>";
XmlNodeList nodes = xd.SelectNodes("//a");
Console.WriteLine(nodes.Count);

hope this helps.

On Thu, 19 Feb 2004 19:21:29 -0800, "C# newbie" <rs****@otxresearch.com> wrote:
Mickey,

It's not my xml. I've been told to do some process on it and when
I removed some part of header it worked just fine!
Again The problem is that when the XML starts with <Platfom> my XPath
function works good but in its native form no!
It ignores some of my queries!

Let me know if you need more info.

Thanks in advance

"Mickey Williams" <my first name at servergeek.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
Hard to say, because:

- You've given us XML that isn't well-formed (although it looks like a
typo, you've done it twice).
- You haven't said what the problem is. Everybody has problems with XML.
However, the solution depends on exactly which particular problem you're
having ;)

--
Mickey Williams
Author, "Microsoft Visual C# .NET Core Reference", MS Press
www.servergeek.com
"C# newbie" <rs****@otxresearch.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
> Hi Group,
>
> I have a problem with XML! I have an xml file which starts like this:
>
> <Plaftorm PlatformName="empty" PlatformID="1" StyleUsage="URL"
> xmlns="http://www.domain.com" PatformProgrammer="mynamehere"
> DateTime="09/12/2003 6:00:54 PM">
> ......
> .....
> </Plaform>
>
> When I changed it to something like below, the XPath search works fine.
>
> <Plaftorm >
> ......
> ....
> </Plaform>
>
> Any idea?
>
> Thx
>
>



--
Ash
Nov 15 '05 #5
Ash,

Thanks for your detailed answer really thanks. However, i have a
question about "a" ! what does "a" do in "//xslt:a"?

nsMgr.AddNamespace("xslt","http://www.domain.com");
XmlNodeList nodes = xd.SelectNodes("//xslt:a", nsMgr);

Sorry since i'm new i'm not that fast on this!

thx
"Ash" <ho**@simonashton.com> wrote in message
news:4s********************************@4ax.com...
Just agreeing with the namespace issue.

I had this problem when first using XML and referred to this document:

http://msdn.microsoft.com/library/de...ml05202002.asp
Taking your example, making one spelling correction for the closing root element, adding the necessary additions to support the namespace, and an
extra element to test it I get this:
System.Xml.XmlDocument xd = new XmlDocument();

xd.InnerXml = "<Plaftorm PlatformName=\"empty\" PlatformID=\"1\" StyleUsage=\"URL\" xmlns:xslt=\"http://www.domain.com\"
PatformProgrammer=\"mynamehere\" DateTime=\"09/12/2003 6:00:54
PM\"><xslt:a>datafora</xslt:a></Plaftorm>"; XmlNamespaceManager nsMgr = new XmlNamespaceManager(xd.NameTable);
nsMgr.AddNamespace("xslt","http://www.domain.com");
XmlNodeList nodes = xd.SelectNodes("//xslt:a", nsMgr);
Console.WriteLine(nodes.Count);

Another option would be to remove the namespace from the xml completely:

xd.InnerXml = "<Plaftorm PlatformName=\"empty\" PlatformID=\"1\" StyleUsage=\"URL\" PatformProgrammer=\"mynamehere\" DateTime=\"09/12/2003
6:00:54 PM\"><a>datafora</a></Plaftorm>"; XmlNodeList nodes = xd.SelectNodes("//a");
Console.WriteLine(nodes.Count);

hope this helps.

On Thu, 19 Feb 2004 19:21:29 -0800, "C# newbie" <rs****@otxresearch.com> wrote:
Mickey,

It's not my xml. I've been told to do some process on it and whenI removed some part of header it worked just fine!
Again The problem is that when the XML starts with <Platfom> my XPath
function works good but in its native form no!
It ignores some of my queries!

Let me know if you need more info.

Thanks in advance

"Mickey Williams" <my first name at servergeek.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
Hard to say, because:

- You've given us XML that isn't well-formed (although it looks like a
typo, you've done it twice).
- You haven't said what the problem is. Everybody has problems with XML. However, the solution depends on exactly which particular problem you're having ;)

--
Mickey Williams
Author, "Microsoft Visual C# .NET Core Reference", MS Press
www.servergeek.com
"C# newbie" <rs****@otxresearch.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
> Hi Group,
>
> I have a problem with XML! I have an xml file which starts like this: >
> <Plaftorm PlatformName="empty" PlatformID="1" StyleUsage="URL"
> xmlns="http://www.domain.com" PatformProgrammer="mynamehere"
> DateTime="09/12/2003 6:00:54 PM">
> ......
> .....
> </Plaform>
>
> When I changed it to something like below, the XPath search works fine. >
> <Plaftorm >
> ......
> ....
> </Plaform>
>
> Any idea?
>
> Thx
>
>


--
Ash

Nov 15 '05 #6
Ash,

Thanks for your detailed answer really thanks. However, i have a
question about "a" ! what does "a" do in "//xslt:a"?

nsMgr.AddNamespace("xslt","http://www.domain.com");
XmlNodeList nodes = xd.SelectNodes("//xslt:a", nsMgr);

Sorry since i'm new i'm not that fast on this!

thx
"Ash" <ho**@simonashton.com> wrote in message
news:4s********************************@4ax.com...
Just agreeing with the namespace issue.

I had this problem when first using XML and referred to this document:

http://msdn.microsoft.com/library/de...ml05202002.asp
Taking your example, making one spelling correction for the closing root element, adding the necessary additions to support the namespace, and an
extra element to test it I get this:
System.Xml.XmlDocument xd = new XmlDocument();

xd.InnerXml = "<Plaftorm PlatformName=\"empty\" PlatformID=\"1\" StyleUsage=\"URL\" xmlns:xslt=\"http://www.domain.com\"
PatformProgrammer=\"mynamehere\" DateTime=\"09/12/2003 6:00:54
PM\"><xslt:a>datafora</xslt:a></Plaftorm>"; XmlNamespaceManager nsMgr = new XmlNamespaceManager(xd.NameTable);
nsMgr.AddNamespace("xslt","http://www.domain.com");
XmlNodeList nodes = xd.SelectNodes("//xslt:a", nsMgr);
Console.WriteLine(nodes.Count);

Another option would be to remove the namespace from the xml completely:

xd.InnerXml = "<Plaftorm PlatformName=\"empty\" PlatformID=\"1\" StyleUsage=\"URL\" PatformProgrammer=\"mynamehere\" DateTime=\"09/12/2003
6:00:54 PM\"><a>datafora</a></Plaftorm>"; XmlNodeList nodes = xd.SelectNodes("//a");
Console.WriteLine(nodes.Count);

hope this helps.

On Thu, 19 Feb 2004 19:21:29 -0800, "C# newbie" <rs****@otxresearch.com> wrote:
Mickey,

It's not my xml. I've been told to do some process on it and whenI removed some part of header it worked just fine!
Again The problem is that when the XML starts with <Platfom> my XPath
function works good but in its native form no!
It ignores some of my queries!

Let me know if you need more info.

Thanks in advance

"Mickey Williams" <my first name at servergeek.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
Hard to say, because:

- You've given us XML that isn't well-formed (although it looks like a
typo, you've done it twice).
- You haven't said what the problem is. Everybody has problems with XML. However, the solution depends on exactly which particular problem you're having ;)

--
Mickey Williams
Author, "Microsoft Visual C# .NET Core Reference", MS Press
www.servergeek.com
"C# newbie" <rs****@otxresearch.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
> Hi Group,
>
> I have a problem with XML! I have an xml file which starts like this: >
> <Plaftorm PlatformName="empty" PlatformID="1" StyleUsage="URL"
> xmlns="http://www.domain.com" PatformProgrammer="mynamehere"
> DateTime="09/12/2003 6:00:54 PM">
> ......
> .....
> </Plaform>
>
> When I changed it to something like below, the XPath search works fine. >
> <Plaftorm >
> ......
> ....
> </Plaform>
>
> Any idea?
>
> Thx
>
>


--
Ash

Nov 15 '05 #7
Thanks for reply. So, what do you suggest me to do to fix it. Since it's not
my Xml. I have to fix that up just need some lights on it. Thanks in advance

newbie

"john farrow" <vi*******@xtra.co.nz> wrote in message
news:ek****************@TK2MSFTNGP11.phx.gbl...
When you change from

<Plaftorm xmlns="http://www.domain.com"

to

<Platform ...

you change the default namespace. An XPath expression has to match the
namespace as well as the element name, so in the first example XPath like
select="/Platform" won't work because it does not specify the namespace that the Platform element is in.

"C# newbie" <rs****@otxresearch.com> wrote in message
news:uM**************@TK2MSFTNGP12.phx.gbl...
Mickey,

It's not my xml. I've been told to do some process on it and

when
I removed some part of header it worked just fine!
Again The problem is that when the XML starts with <Platfom> my XPath
function works good but in its native form no!
It ignores some of my queries!

Let me know if you need more info.

Thanks in advance

"Mickey Williams" <my first name at servergeek.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
Hard to say, because:

- You've given us XML that isn't well-formed (although it looks like a typo, you've done it twice).
- You haven't said what the problem is. Everybody has problems with XML. However, the solution depends on exactly which particular problem you're having ;)

--
Mickey Williams
Author, "Microsoft Visual C# .NET Core Reference", MS Press
www.servergeek.com
"C# newbie" <rs****@otxresearch.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
> Hi Group,
>
> I have a problem with XML! I have an xml file which starts like this: >
> <Plaftorm PlatformName="empty" PlatformID="1" StyleUsage="URL"
> xmlns="http://www.domain.com" PatformProgrammer="mynamehere"
> DateTime="09/12/2003 6:00:54 PM">
> ......
> .....
> </Plaform>
>
> When I changed it to something like below, the XPath search works fine. >
> <Plaftorm >
> ......
> ....
> </Plaform>
>
> Any idea?
>
> Thx
>
>



Nov 15 '05 #8
Thanks for reply. So, what do you suggest me to do to fix it. Since it's not
my Xml. I have to fix that up just need some lights on it. Thanks in advance

newbie

"john farrow" <vi*******@xtra.co.nz> wrote in message
news:ek****************@TK2MSFTNGP11.phx.gbl...
When you change from

<Plaftorm xmlns="http://www.domain.com"

to

<Platform ...

you change the default namespace. An XPath expression has to match the
namespace as well as the element name, so in the first example XPath like
select="/Platform" won't work because it does not specify the namespace that the Platform element is in.

"C# newbie" <rs****@otxresearch.com> wrote in message
news:uM**************@TK2MSFTNGP12.phx.gbl...
Mickey,

It's not my xml. I've been told to do some process on it and

when
I removed some part of header it worked just fine!
Again The problem is that when the XML starts with <Platfom> my XPath
function works good but in its native form no!
It ignores some of my queries!

Let me know if you need more info.

Thanks in advance

"Mickey Williams" <my first name at servergeek.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
Hard to say, because:

- You've given us XML that isn't well-formed (although it looks like a typo, you've done it twice).
- You haven't said what the problem is. Everybody has problems with XML. However, the solution depends on exactly which particular problem you're having ;)

--
Mickey Williams
Author, "Microsoft Visual C# .NET Core Reference", MS Press
www.servergeek.com
"C# newbie" <rs****@otxresearch.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
> Hi Group,
>
> I have a problem with XML! I have an xml file which starts like this: >
> <Plaftorm PlatformName="empty" PlatformID="1" StyleUsage="URL"
> xmlns="http://www.domain.com" PatformProgrammer="mynamehere"
> DateTime="09/12/2003 6:00:54 PM">
> ......
> .....
> </Plaform>
>
> When I changed it to something like below, the XPath search works fine. >
> <Plaftorm >
> ......
> ....
> </Plaform>
>
> Any idea?
>
> Thx
>
>



Nov 15 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Paul Mateer | last post by:
Hi, I have been running some queries against a table in a my database and have noted an odd (at least it seems odd to me) performance issue. The table has approximately 5 million rows and...
7
by: George Hester | last post by:
Please take a look at this google artcle: http://groups.google.com/groups?hl=en&lr=&frame=right&th=55d6f4b50f5f9382&seekm=411f370d%241%40olaf.komtel.net#link9 The op was having trouble with...
2
by: Anthony Cuttitta Jr. | last post by:
We have an application that outputs several different graphs from data downloaded from our AS400. The application has worked without (this) issue for several months now, but just recently, the...
0
by: Kevin Spencer | last post by:
Hi all, I am working on a service that uploads METAR weather information to the National Weather Service FTP site. The service I'm authoring is hosted on a Windows 200 server, and the NWS FTP...
2
by: Ben Rush | last post by:
Hello World, Okay, I have spent the day browsing the newsgroups and reading up on article after article concerning ViewState corruption and so forth, and I have a couple questions. We...
5
by: Robert | last post by:
I have a series of web applications (configured as separate applications) on a server. There is a main application at the root and then several virtual directories that are independant...
0
by: Charles Leonard | last post by:
I am having yet another issue with Windows Server 2003. This time, the web service (a file import web service) appears to run except for one odd message: "ActiveX component can't create object". ...
4
by: Paul | last post by:
Hi, I've been struggling with this today, I'm developing a DotNet2.0 website in C# that needs to call a long running data query. Obviously this is a good candidate for an Asynchronous call, so...
1
by: AlekseyUS | last post by:
Hi, I'm a little stuck, I basically need to copy all the information within a specific file in Temp and append it to a file in another location. I'm not having any problems with smaller size...
13
by: SAL | last post by:
Hello, I'm trying to include a popup in the ItemTemplate of a gridview row. The ItemTemplate for the field contains a textbox and when the user clicks in the textbox I want a popup panel to show...
0
marktang
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,...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
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...
0
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
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 ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.