|
Your XPath is still looking for elements from the empty namespace, since you cannot associate a namespace with the empty string as prefix. Unfortunately XPath has no mechanism like declaring a default namespace. You have to associate your namespace with an explicit prefix and use this to qualify all element names in your XPath expression.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
No xpath is working fine but getting validation errors like
couldn't fine the lasers element and etc
thanks
praveenkumar palla
praveenkumar palla
|
|
|
|
|
Ok I see, but the problem is quite similar. You get the validation errprs since your XML document isn't valid according to the schema. The schema expects the elements to be in the "urn:myNamespace" namespace but all of the elements in your document are in the empty namespace (that's why the XPath is working). Either you prefix the elements in your document with the prefix to which you have associated the namespace (using the "xmlns:ns="urn:myNamespace") or much easier you declare your namespace to be the default namespace ("xmlns="urn:myNamespace" on the root element).
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
I tried this but xpath is not working
thanks
praveenkumar palla
praveenkumar palla
|
|
|
|
|
praveenkumar palla wrote: I tried this but xpath is not working
I know and I told you why in my first posting. Maybe you do a bit research on XML namespaces, since you're obviously not getting the concept. You could start with the W3C Recommendation Namespaces in XML 1.0 (Second Edition)[^], which in contrast to other W3C documents is quite comprehensible.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
I've answered this twice, and you've posted it six times. Did you ever consider taking the advice you'v been given ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
You need to tell politely, As new users in intention to get immediate reply might do it !! So as a senior member of this site you need to give proper advice
Regards,
Jaiprakash M Bankolli
jaiprakash.bankolli@gmail.com
http://jaiprakash.blog.com/
|
|
|
|
|
Proper advice ? I've told him exactly what is wrong, twice. I've told him several times to stop asking again and again, and that he should try to do what has been advised to him, or at least ask a question that indicates he tried what he's been told ( at least three times, two from me ), to do.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Actually, Christian is perfectly entitled to his frustration and anger. If you take the trouble to look through the posting history of the OP, you will see that he has asked the same question again and again. He has been given advice on what he needs to do many times, and Christian is one of the people who has told him what he needs to do. It is insulting to the people who have tried to help him for the OP to repost the question.
If you follow the threads, you will see that he is given advice on what he needs to do, but the poster does not seem to want to actually do the work. He wants somebody else to actually do his thinking for him. This is not the intention of this site. It is about people freely volunteering their time to help others, and help very rarely involves actually doing the thinking for somebody else. If somebody presents you with a complete solution to a problem then what do you learn? Only that somebody else knows how to troubleshoot/problem solve, and that is not helping you in any way.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Ok, No problem at all... I agree with what you say as far as learning is concerned !!!
Regards,
Jaiprakash M Bankolli
jaiprakash.bankolli@gmail.com
http://jaiprakash.blog.com/
|
|
|
|
|
Mental no. Ignorant Yes.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Yeah, so it would seem. I mean, does he not want to solve the problem ? One has to assume he's achieved nothing at work for several days, while he waits for the laws of computing to change, so that a different answer suddenly solves his issues.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Christian Graus wrote: One has to assume he's achieved nothing at work for several days, while he waits for the laws of computing to change, so that a different answer suddenly solves his issues.
It's this attitude that really bugs me. With several of the consultancies churning out "developers", this is the end result. Give them a problem to solve, or a chance to learn and they flounder hopelessly out of their depth.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Initially XML file is like this
<lasers>
<laser lasername="Laser1" modelname="Nufern v1.0" serialno="1" manufacturername="Nufern v1.0" maximumpower="200w">
<properties">
CW-Waveform.jpg
<wavetypes>
<wavetype name="CW Ramp" url="ramp.html" isavailable="true">
<wavetype name="CW Analog" url="analog.html" isavailable="true">
<tabular>
<property id="228" name="BRM" currval="0" prgbar="true" selected="true" min="0" max="100" pwd="true" units="C" gauge="false" thresholdval="10">
<property id="200" name="Output power" currval="0" prgbar="true" selected="true" min="0" max="100" pwd="false" units="C" gauge="true" thresholdval="10">
then
>>>>>>>>>>>>>>>>>>>>namespace is EncryptDecrypt
XmlDocument xmldoc = new XmlDocument();
xmldoc.Load(Application.StartupPath + @"\laserProp.xml");
XmlNamespaceManager mgr = new XmlNamespaceManager(xmldoc.NameTable);
mgr.AddNamespace(string.Empty, "urn:MyNamespace");
XmlNodeList xmlnodelist;
XmlElement ele = xmldoc.DocumentElement;
xmlnodelist= ele.SelectNodes("//lasers//laser//properties//tabular//property",mgr);
Is working fine but, to validate xml with xsd i made changes to the xml as
<lasers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" <u="">xmlns:ns="urn:MyNamespace" xsi:schemaLocation="urn:MyNamespace laserProp.xsd">
<laser lasername="Laser1" modelname="Nufern v1.0" serialno="1" manufacturername="Nufern v1.0" maximumpower="200w" <u="">xmlns:ns="urn:MyNamespace">
<properties <u="">xmlns:ns="urn:MyNamespace">
CW-Waveform.jpg
<wavetypes>
<wavetype name="CW Ramp" url="ramp.html" isavailable="true">
<wavetype name="CW Analog" url="analog.html" isavailable="true">
<tabular>
<property id="228" name="BRM" currval="0" prgbar="true" selected="true" min="0" max="100" pwd="true" units="C" gauge="false" thresholdval="10">
<property id="200" name="Output power" currval="0" prgbar="true" selected="true" min="0" max="100" pwd="false" units="C" gauge="true" thresholdval="10">
Now the same xpath is working fine but getting validation errors
my xml scheema file(xsd file) is
<xs:schema attributeformdefault="unqualified" elementformdefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema" targetnamespace="urn:MyNamespace">
<xs:element name="lasers">
<xs:complextype>
<xs:sequence>
<xs:element name="laser">
<xs:complextype>
<xs:sequence>
<xs:element name="properties">
<xs:complextype>
<xs:sequence>
<xs:element name="image" type="xs:string">
<xs:element name="WaveTypes">
<xs:complextype>
<xs:sequence>
<xs:element maxoccurs="unbounded" name="WaveType">
<xs:complextype>
<xs:attribute name="Name" type="xs:string" use="required">
<xs:attribute name="url" type="xs:string" use="required">
<xs:attribute name="isavailable" type="xs:boolean" use="required">
<xs:element name="tabular">
<xs:complextype>
<xs:sequence>
<xs:element maxoccurs="unbounded" name="property">
<xs:complextype>
<xs:attribute name="id" type="xs:integer" use="required">
<xs:attribute name="name" type="xs:string" use="required">
<xs:attribute name="currval" type="xs:integer" use="required">
<xs:attribute name="prgbar" type="xs:boolean" use="required">
<xs:attribute name="selected" type="xs:boolean" use="required">
<xs:attribute name="min" type="xs:integer" use="required">
<xs:attribute name="max" type="xs:integer" use="required">
<xs:attribute name="pwd" type="xs:boolean" use="required">
<xs:attribute name="units" type="xs:string" use="required">
<xs:attribute name="gauge" type="xs:boolean" use="required">
<xs:attribute name="thresholdval" type="xs:integer" use="required">
<xs:attribute name="LaserName" type="xs:string" use="required">
<xs:attribute name="ModelName" type="xs:string" use="required">
<xs:attribute name="SerialNo" type="xs:integer" use="required">
<xs:attribute name="ManufacturerName" type="xs:string" use="required">
<xs:attribute name="Maximumpower" type="xs:string" use="required">
please help me on this
thanks in advance
praveenkumar palla
|
|
|
|
|
Will you please, please, please stop spamming this board. You have had the answer many times, but you seem incapable of doing any research on your own. Will you get it through your head? People aren't here to write your code for you - they're here to help.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
hi all,
How can i create a tree which allow me to drag the tree childs and drop it in to the textbox.Is it possible? can any one help me to do this?
ayyp
|
|
|
|
|
You should ask in the ASP.NET forum. It can be done, it involves a lot of javascript, and no real C# code.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hi all,
I am having a problem with my report. i have a dataset which gets fill while it is in run mode. I wanna create a report out of this. plz help me.
Regards
Ruwandi
rkherath
|
|
|
|
|
You question is too vague to give a meaningful answer.
What problems in particular are you having with creating a report? Have you looked at Crystal Reports or any of the many reporting SDKs on the web?
|
|
|
|
|
Hi... I'm writing my own panel class which of cause inherited from Panel. And the code here works just fine BUT if I make a property where the return type to fx int, it fails. And the exception I get is useless. Is this something with TypeConverters?
public class TestCell
{
public static readonly DependencyProperty WidthProperty = DependencyProperty.RegisterAttached(
"Width",
typeof(double),
typeof(TestCell),
new FrameworkPropertyMetadata(
0d,
FrameworkPropertyMetadataOptions.None));
public static void SetWidth(UIElement element, double value)
{
element.SetValue(WidthProperty, value);
}
public static double GetWidth(UIElement element)
{
return (double)element.GetValue(WidthProperty);
}
}
public class TestPanel : Panel
{
protected override Size MeasureOverride(Size availableSize)
{
Size childSize = availableSize;
foreach (UIElement child in InternalChildren)
{
child.Measure(childSize);
}
return availableSize;
}
protected override Size ArrangeOverride(Size finalSize)
{
foreach (UIElement child in InternalChildren)
{
double x = TestCell.GetWidth(child);
double y = 50;
child.Arrange(new Rect(new Point(x, y), child.DesiredSize));
}
return finalSize;
}
}
<Window x:Class="WPFApplication1.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="clr-namespace:MyAssembly;assembly=MyAssembly"
Title="Window1" Height="300" Width="300">
<mc:TestPanel>
<Button Width="100" Height="100"/>
</mc:TestPanel>
</Window>
-- modified at 8:59 Monday 16th April, 2007
Best regards
Lasse Espeholt
|
|
|
|
|
I am boring with instantly going inside Add/Remove Program, selecting my uncomplete program and removing. When making Setup file, I can't find any item mentioning Uninstall in Program Files .
Someone help me solving my problem. How should I do ?
Thanks in advance
It seem to be a solution or an answer.
|
|
|
|
|
There are installers that create an uninstall exe, but msi's do not, AFAIK.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
What are some installers you mentioned ? Thanks
It seem to be a solution or an answer.
|
|
|
|
|
Try to change the current version of your exe. Then you can set the option "remove previous versions" to true.
The system will automatically replace your previous application
My small attempt...
|
|
|
|
|
How do I change my current version of exe ?
It seem to be a solution or an answer.
|
|
|
|