|
Your post might be too broad. Go to the C# forum and read the post at the top of the list "How to get an answer to your question".
led mike
|
|
|
|
|
Hi, i try to make a new asp.net web service project in ms visual studio .net 2003, but in solution explorer window, the .vsdisco file doesn't come up. I want to try xml web service locally.Can u help me and give some advise?
Thanks
|
|
|
|
|
dear hariharan,
if you have an idea to find the text in xmldocument.
Then if it is an attribute name then
xmlDoc.selectsingleNode("//ParentNode/Node[@id='" & txtbox1.text &"']")
If its a element name then
xmlDoc.selectsingleNode("//ParentNode")
All The Best
Sathesh Pandian
|
|
|
|
|
Hi!
I am using C#, i want to search a node in XML file having a given Attribute. the structure of XML file is not known, i.e. we dont know that how many nodes are there and each node conatins how many child nodes.
following is a sample of the structure of XML file. I want to traverse all nodes of file and return the "Name" attribute of the node if it matches with the user defined string.
<ROOT>
<Group Name="A" ID="1">
<Group Name="C" ID="3">
<Group Name="D" ID="4" />
</Group>
<Group Name="E" ID="5">
<Group Name="F" ID="6">
<Group Name="G" ID="7" />
</Group>
</Group>
</Group>
<Group Name="B" ID="2" />
</ROOT>
I tried to do it with recursion but could not handle it. Please tell me how to do it.
Thanks in advance..
Regards,
Affan Ahmad Toor
|
|
|
|
|
Affan Toor wrote: could not handle it
What does that mean? Show us the code you got so far.
"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 am trying to write a dataset upon login and write certain information retrieved from an Access db (I hate Access but right now the SQL box isn't available so I'm hitting the Access db as little as possible). When I populate the DataSet and use DataSet.WriteXML it's giving weird results. Also, when I login in a 2nd time (with a different user, the only part that works is searching the XML for the user I'm logging in with if it exists then dont rewrite it) I want it to append it to the existing XML document and even this isn't working right, the .WriteXML is giving a result like
<newdataset>
<Table>
<_x0027_u_name_x0027_>rlmccutchen<_x0027_u_name_x0027_>
<_x0027_u_pwd_x0027_>*********<_x0027_u_pwd_x0027_>
<_x0027_f_name_x0027_>Richard<_x0027_f_name_x0027_>
<_x0027_l_name_x0027_>McCutchen<_x0027_l_name_x0027_>
<_x0027_email_x0027_>richard@psychocoder.net<_x0027_email_x0027_>
<_x0027_is_admin_x0027_>1<_x0027_is_admin_x0027_>
<_x0027_total_posts_x0027_>0<_x0027_total_posts_x0027_>
<_x0027_client_id_x0027_>1<_x0027_client_id_x0027_>
<_x0027_user_id_x0027_>1<_x0027_user_id_x0027_>
<_x0027_site_name_x0027_>RamEngine<_x0027_site_name_x0027_>
</Table>
</newdataset>
<newdataset>
<Table>
<_x0027_u_name_x0027_>jbunton<_x0027_u_name_x0027_>
<_x0027_u_pwd_x0027_>*********<_x0027_u_pwd_x0027_>
<_x0027_f_name_x0027_>Jack<_x0027_f_name_x0027_>
<_x0027_l_name_x0027_>Bunton<_x0027_l_name_x0027_>
<_x0027_email_x0027_>ramremfg@aol.com<_x0027_email_x0027_>
<_x0027_is_admin_x0027_>0<_x0027_is_admin_x0027_>
<_x0027_total_posts_x0027_>0<_x0027_total_posts_x0027_>
<_x0027_client_id_x0027_>1<_x0027_client_id_x0027_>
< _x0027_user_id_x0027_>2<_x0027_user_id_x0027_>
<_x0027_site_name_x0027_>RamEngine<_x0027_site_name_x0027_>
</Table>
</newdataset>
I've been raking my head for days now trying to solve this so I canh move on to a new piece. Can someone please help.
" In the next millennium there are two kinds of business, those on the Internet and those out of business"
Bill Gates
"Be nice to nerds. Chances are you'll end up working for one."
Bill Gates
"Let's face it, the average computer user has the brain of a Spider Monkey."
Bill Gates
|
|
|
|
|
Leoapa wrote: What should I do?
Show us the XPath expression and relevant parts of your XML file.
"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
|
|
|
|
|
how to parse an xml file using c code. pls help me
Arise Awake Stop Not Till ur Goal is Reached.
|
|
|
|
|
|
ok but i have to write c code in linux. i cant use any downloaded code
Arise Awake Stop Not Till ur Goal is Reached.
|
|
|
|
|
deeps_cute wrote: ok but i have to write c code in linux. i cant use any downloaded code
The second hit from google states that "Libxml2 is known to be very portable, the library should build and work without serious troubles on a variety of systems (Linux, Unix, Windows, CygWin, MacOS, MacOS X, RISC Os, OS/2, VMS, QNX, MVS, ...)" The XML C parser and toolkit of Gnome - libxml[^]
If you mean that you want to write your own XML parser that will be a very challenging task and most probably no one here can give you complete code for this. Your best bet would be to take a look at the sources of the available parsers to see how they tackle the problem.
"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
|
|
|
|
|
Stefan Troschuetz wrote: If you mean that you want to write your own XML parser that will be a very challenging task and most probably no one here can give you complete code for this.
If memory serves well there are some articles... At least one XML parser in C++ - probably portable to linux.
"Throughout human history, we have been dependent on machines to survive. Fate, it seems, is not without a sense of irony. " - Morpheus
"Real men use mspaint for writing code and notepad for designing graphics." - Anna-Jayne Metcalfe
|
|
|
|
|
Hi,
I want to create a XSD schema to use for validating XML files like the following:
top>
top>
top>
top>
/top>
link> link> mid>
mid>
/top>
top>
bottom>
/top>
/top>
A "top" element can contain any number of "top" elements or any number of "link" elements or any number of "mid" elements. A "top" element can contain only one "bottom" element and no other element if it contains a "bottom" element. A "link" or "mid" or "bottom" element cannot contain any elements.
Any advice, please help?
-- modified at 2:51 Wednesday 2nd May, 2007
|
|
|
|
|
Not tested, but should be at least a good starting point:
<?xml version="1.0" encoding="utf-8" ?>
<xs:schema targetNamespace="http://tempuri.org/XMLSchema.xsd"
elementFormDefault="qualified"
xmlns="http://tempuri.org/XMLSchema.xsd"
xmlns:mstns="http://tempuri.org/XMLSchema.xsd"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="link">
<xs:complexType></xs:complexType>
</xs:element>
<xs:element name="mid">
<xs:complexType></xs:complexType>
</xs:element>
<xs:element name="bottom">
<xs:complexType></xs:complexType>
</xs:element>
<xs:element name="top">
<xs:complexType>
<xs:choice>
<xs:sequence>
<xs:element ref="mstns:bottom"></xs:element>
</xs:sequence>
<xs:sequence>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element ref="mstns:top"></xs:element>
<xs:element ref="mstns:link"></xs:element>
<xs:element ref="mstns:mid"></xs:element>
</xs:choice>
</xs:sequence>
</xs:choice>
</xs:complexType>
</xs:element>
</xs:sche
"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
|
|
|
|
|
Or even simpler...
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
<xs:complexType name="top">
<xs:sequence>
<xs:element name="top" type="xs:string" minOccurs="0" maxOccurs="unbounded" />
<xs:element name="link" type="xs:string" minOccurs="0" maxOccurs="unbounded" />
<xs:element name="mid" type="xs:string" minOccurs="0" maxOccurs="unbounded" />
<xs:element name="bottom" type="xs:string" minOccurs="0" maxOccurs="unbounded" />
</xs:sequence>
</xs:complexType>
<xs:element name="top" type="top" />
</xs:schema>
|
|
|
|
|
This doesn't cover the requirements that a "top" element can contain only one "bottom" element and no other element if it contains a "bottom" 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
|
|
|
|
|
True, didn't realize that was a requirement. I guess choice is the only valid approach.
|
|
|
|
|
i need to add node values in a xml file like
<country>
<india>
<states>1</states>
<states>2</states>
</india>
<America>
<value>xxx</value>
<value>xxx</value>
<value>xxx</value>
</America>
<Canada>
i need to add an xml node from other xml file ....
</Canada>
</country>
i need to add xmlnode value in Canada. it can be a nested node values
and the source for canada is from other xmlfile
i tryed with ImportRow method, but it appends in Root, (ie from <country>
i want to append data to <canada>
.....</canada>
Pls suggest
|
|
|
|
|
ImportRow is a DataTable method. If you are talking about XmlDocument, you can use the ImportNode method:
using namespace System;
using namespace System::Xml;
int main(array<System::String ^> ^args)
{
String^ srcXml =
L"<country>"
L"<canada>"
L"<lakes>yyyy</lakes>"
L"</canada>"
L"</country>";
XmlDocument^ srcDoc = gcnew XmlDocument();
srcDoc->LoadXml(srcXml);
XmlNode^ srcNode = srcDoc->SelectSingleNode(
L"/country/canada/lakes");
if (srcNode == nullptr)
{
Console::WriteLine(L"'lakes' node not found!");
return -1;
}
String^ destXml =
L"<country>"
L"<india>"
L"<states>1</states>"
L"<states>2</states>"
L"</india>"
L"<america>"
L"<value>xxx</value>"
L"<value>xxx</value>"
L"<value>xxx</value>"
L"</america>"
L"<canada/>"
L"</country>";
XmlDocument^ destDoc = gcnew XmlDocument();
destDoc->LoadXml(destXml);
XmlNode^ importedNode = destDoc->ImportNode(srcNode, true);
XmlNode^ destNode = destDoc->SelectSingleNode(
L"/country/canada");
if (srcNode == nullptr)
{
Console::WriteLine(L"'canada' node not found!");
return -1;
}
destNode->AppendChild(importedNode);
Console::WriteLine(destDoc->OuterXml);
return 0;
}
"We make a living by what we get, we make a life by what we give." --Winston Churchill
|
|
|
|
|
|
Hello,
I'm writing a web service that reads an XML from the web but this XML has some special characters that messes the reading method of the XmlReader and i can't find a way to resolve it.
here is the XML example im trying to parse to a datatable
<br />
<?xml version="1.0" ?><br />
<gsmrs_teams last_generated="20070428013954"><br />
<team team_id="2015" team_logo="true"><br />
<type>Club</type><br />
<br />
ETC.
the error looks like that:'>' is an unexpected token. The expected token is '"' or '''. Line 2, position 29.
My other Q is how can i read the output stream of the browser. Meaning how can i get the text equivalent to copy paste that i would do inside the browser text, but with asp.net methods (only text with no tags).
I want to Read text inside HTML tags.
Thanks,
Leo
|
|
|
|
|
i have the xml declaraion in 2 files but one file is able open properly in the browser on double clicking but other giving me the below error
Switch from current encoding to specified encoding not supported. Error processing resource 'file:///C:/Documents and Setti...
Can any body tell me where could be the problem
thanx in advance.
-- modified at 4:57 Monday 30th April, 2007
|
|
|
|
|
|
kalaveer wrote: Error processing resource 'file:///C:/Documents and Setti...
The browser cannot file the document with that pathname. If you are accessing the file locally, then make sure this is the correct pathname. If you are accessing the file via HTTP, make sure the pathname is a relative or absolute URL.
"We make a living by what we get, we make a life by what we give." --Winston Churchill
|
|
|
|
|
hi guys,
I have failed to get a node set based on dates.
i have a simple xml
HTML Code:
<pre><code><PUBS>
<PUB>
<FIRSTINS>2006-12-08</FIRSTINS>
<LASTINS>2006-12-10</LASTINS>
</PUB>
</PUBS>
<PUBS>
<PUB>
<FIRSTINS>2004-12-08</FIRSTINS>
<LASTINS>2006-1-17</LASTINS>
</PUB>
</PUBS>
<PUBS>
<PUB>
<FIRSTINS>2007-12-08</FIRSTINS>
<LASTINS>2007-12-09</LASTINS>
</PUB>
</PUBS></code></pre>
in my xslt
HTML Code:
<pre><code><xsl:for-each select ="//PUB[FIRSTINS < LASTINS]">
..do some thing
</xsl:for-each></code></pre>
this always fails for me both less and greater than
in the above code i am using the lt; gt; but the html page is converting it to < and >
Regards
mhadamji
Mustafa
http://www.hostukdomain.com
|
|
|
|