|
i'm new to xml and i'm using the hlep files trying to read an xml document but i can't get it to work. everytime it tries to access anything in the xmldoc it errors with an unhandled exception.
here's my code:
private void button1_Click(object sender, System.EventArgs e)<br />
{<br />
OpenFileDialog1.ShowDialog();<br />
XmlNodeList nodeList;<br />
XmlDocument doc = new XmlDocument();<br />
doc.LoadXml(OpenFileDialog1.FileName);<br />
<br />
XmlNode root = doc.DocumentElement;<br />
nodeList=root.SelectNodes("members");<br />
<br />
foreach (XmlNode node in nodeList)<br />
{<br />
listBox1.Items.Add(node.Name);<br />
}<br />
}
please help, thanks,
Rob
--
There are 10 kinds of people. Those who understand binary and those who don't. <param name="e" />
<member name="M:Newco.Controls.GroupBoxLine.Dispose(System.Boolean)">
Clean up any resources being used.
<member name="P:Newco.Controls.GroupBoxLine.LineColor">
Specifies the color of the line.
<member name="P:Newco.Controls.GroupBoxLine.TextColor">
Specifies the color of the text.
please help, thanks,
Rob
--
There are 10 kinds of people. Those who understand binary and those who don't.
|
|
|
|
|
stupid thing posted when i hit the 'preview' button. here's the xml source:
<?xml version="1.0"?>
<doc>
<assembly>
<name>Newco.Controls</name>
</assembly>
<members>
<member name="T:Newco.Controls.GroupBoxLineDesigner">
<summary>
Summary description for GroupBoxLine.
</summary>
</member>
<member name="M:Newco.Controls.GroupBoxLineDesigner.PostFilterProperties(System.Collections.IDictionary)">
<summary>
Removes the 'FlatStyle' property for this item.
</summary>
<param name="id"></param>
</member>
<member name="M:Newco.Controls.GroupBoxLineDesigner.OnPaintAdornments(System.Windows.Forms.PaintEventArgs)">
<summary>
Draws a light dashed line around the control in design view to make it more visible.
</summary>
<param name="pe"></param>
</member>
<member name="T:Newco.Controls.GroupBoxLine">
<summary>
Custom control to mirror the look of an Office 2003 groupBox.
</summary>
</member>
<member name="F:Newco.Controls.GroupBoxLine.lineColor">
<summary>
Specifies the color of the line.
</summary>
</member>
<member name="F:Newco.Controls.GroupBoxLine.textColor">
<summary>
Specifies the color of the text.
</summary>
</member>
<member name="M:Newco.Controls.GroupBoxLine.#ctor">
<summary>
Default contructor for the class GroupBoxLine.
</summary>
</member>
<member name="M:Newco.Controls.GroupBoxLine.OnPaint(System.Windows.Forms.PaintEventArgs)">
<summary>
Overrides the OnPaint event to create the look of Office 2003.
</summary>
<param name="e"></param>
</member>
<member name="M:Newco.Controls.GroupBoxLine.Dispose(System.Boolean)">
<summary>
Clean up any resources being used.
</summary>
</member>
<member name="P:Newco.Controls.GroupBoxLine.LineColor">
<summary>
Specifies the color of the line.
</summary>
</member>
<member name="P:Newco.Controls.GroupBoxLine.TextColor">
<summary>
Specifies the color of the text.
</summary>
</member>
</members>
</doc>
--
There are 10 kinds of people. Those who understand binary and those who don't.
|
|
|
|
|
LoadXml expects the string to be the XML
you should be using Load(filename)
"When the only tool you have is a hammer, a sore thumb you will have."
|
|
|
|
|
MindNets
“MindNets” is an organization that is being established for providing support and solution in different fields of IT/Computer Science.
Our Expertise includes:
Web Design and Development, Databases, Networks, Desktop Applications, Business Applications, Image Processing, Biometrics, Science and Engineering.
For Students:
During our final projects, we found that there is very little guidance for students; in working on their projects (software) using latest tools and technologies. This is where the whole idea came to our mind and became the basis of “MindNets”.
For Companies:
In this era, for each and every organization; it’s necessary to transfer its business online. This is so, because it not only helps in expanding the business but also in providing more facilities to the customers.
For this we are providing complete web site design, development and hosting facilities. We are also looking forward to facilitate these companies in building and maintaining efficient LAN/WAN networks.
So feel free to contact us at any time; you need us; as we are to help YOU.
Team:
Khurram Ishtiaq Qazi (Netsol)
(c++, visual c++, java, Oracle 8i, (sql/plsql, Developer6))
Asim Nazir (XavorInt)
(c++, java, visual c#, ASP.NET, Sqlserver 2000, Crystal Reports)
Irfan Yousaf (ICBCS)
(VB6, ASP, VB.NET, ASP.NET, Oracle, Visual C++, Visual Prolog)
Mohsin Ali (TWE)
(Microsoft Certified Solution Developer (MCSD), VB6, Flash)
Aamir Alla-u-Din (Operation Al-Badar)
(Microsoft Certified System Engineer (MCSE NT+2000), CCNA)
Contact:
Mail: mind_nets@yahoo.com
Voice: 0333-4294413
MindNets
|
|
|
|
|
Okay i just upgraded from vs.net 2002 to vs.net 2003 and this error comes up. It worked fine before the upgrade but now this error can someone please help. I even did some error testing i can pull xml from my machince and i can access the file directly. Ahhhh!! whats the problem? Thanks.
"The underlying connection was closed: Unable to connect to the remote server. "
Line 69: {
Line 70: case 0:
Line 71: dataSet1.ReadXml("http://www.w3schools.com/xml/note.xml");
Line 72: break;
Line 73: case 1:
Source File: c:\inetpub\wwwroot\bc\webform1.aspx.cs Line: 71
Stack Trace:
[WebException: The underlying connection was closed: Unable to connect to the remote server.]
System.Net.HttpWebRequest.CheckFinalStatus()
System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
System.Net.HttpWebRequest.GetResponse()
System.Xml.XmlDownloadManager.GetNonFileStream(Uri uri, ICredentials credentials)
System.Xml.XmlDownloadManager.GetStream(Uri uri, ICredentials credentials) +94
System.Xml.XmlUrlResolver.GetEntity(Uri absoluteUri, String role, Type ofObjectToReturn) +55
System.Xml.XmlTextReader.CreateScanner() +384
System.Xml.XmlTextReader.Init() +23
System.Xml.XmlTextReader.Read() +530
System.Xml.XmlReader.MoveToContent() +75
System.Data.DataSet.ReadXml(XmlReader reader, Boolean denyResolving) +145
System.Data.DataSet.ReadXml(String fileName) +63
BC.WebForm1.Button1_Click(Object sender, EventArgs e) in c:\inetpub\wwwroot\bc\webform1.aspx.cs:71
System.Web.UI.WebControls.Button.onclick(EventArgs e)
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
System.Web.UI.Page.ProcessRequestMain() +1277
Da Intern
|
|
|
|
|
Are you saying that you can access http://www.w3schools.com/xml/note.xml from a browser, but not your ASPX page?
- Mike
|
|
|
|
|
exactly, do you have some ideas
Da Intern
|
|
|
|
|
I have an XML document that in some elements can contain HTML. The document is being sent to a client app via a web service. The HTML contained in the document can contain images. The images have document delative Urls. I want to add the complete url to the image tag. Is there an easy way to do this? I have tried using a regex but have been unable to get it to work. Thanks.
Steve
Not all who wander are lost...
|
|
|
|
|
Hi im trying to use this line of code to create an xml file but it just overwrites it every time or appends to the wrong part. I have tried changing the bool to true and false also tried changing write to writeline nothing works please help.
using (StreamWriter sw = new StreamWriter("TestFile.xml"))
{
sw.Write("<DispatcherQ>" + "<Dispatcher> " + DispID.Text + "</Dispatcher>" + "<CustomerInfo> " + listBox2.SelectedItem.ToString() + "</CustomerInfo>" + "<TaxiInfo> " +listBox3.SelectedItem.ToString()+ "</TaxiInfo>" + "</DispatcherQ>" );
}
Thanks alot,
Da Intern
|
|
|
|
|
Hi
Isn´t XmlTextWriter a better choice?
in VB
Dim wrtXMLWriter As New XmlTextWriter("TestFile.xml", Nothing)
and use .WriteRaw or any other XmlTextWriter-method that works for your purposes.
Regards
Daniel
|
|
|
|
|
okay but i want it to create a new set of elements like this: when i click this button it creates the xml file and the first element then when i click it again it adds the new elements to that xml file.
Da Intern
|
|
|
|
|
You can use XmlDocument.CreateElement and .AppendChild to add your information to your document.
in c++
given that Child,Name,TopElement all are XmlElements
sData is the content, the info in the element;
ChildElement = doc->CreateElement("tagname");
TopElement->AppendChild(ChildElement);
NameElement = doc->CreateElement("tagname");
NameElement->InnerText = sData;
ChildElement->AppendChild(NameElement);
.. or something like that
I guess you have to check in the button_click function if you already have pressed the button and if not -> create a new xmldokument
Regards
Daniel
|
|
|
|
|
Anyone know where to find one? I'm too lazy to make one;) just wanted the news on my site...
// Steve McLenithan
Family Guy: Season 2 - Episode 8
|
|
|
|
|
|
Yeah I have that... I just need a stylesheet to display it properly, and not just a bunch of text. Thanks anyway;)
// Steve McLenithan
Family Guy: Season 2 - Episode 8
|
|
|
|
|
I am creating a few modules for DNN and I want to use an XML file for each one to store the settings. Doing this would greatly reduce the pain of installing the module (not having to mess with DB scripts). I know there is a function that you can use to get the value of a key in the web.config file (can't remember its name...).
How would I go about creating a similar function of my own?
// Steve McLenithan
Family Guy: Season 2 - Episode 8
|
|
|
|
|
|
|
Awesome! That is way better
// Steve McLenithan
Family Guy: Season 2 - Episode 8
|
|
|
|
|
Glad to help.
-Nick Parker
|
|
|
|
|
Hi,
I'm trying to read a XML file in vb. I've found some code to explain how to read it using a dataset.
The problem is that I can't read sub-section of my main table DVD.
Here is the XML code of my file :
<?xml version="1.0" encoding="us-ascii"?>
<Collection>
<DVD>
<ID>099720116493.9</ID>
<UPC>099720-116493</UPC>
<Title>Les Mystérieuses Cités d'Or L'integrale</Title>
<SortTitle>Les Mystérieuses Cités d'Or L'integrale</SortTitle>
<Description>Collector's Edition</Description>
<Regions>
<Region>2</Region>
</Regions>
<CollectionType>Owned</CollectionType>
<CollectionNumber>90</CollectionNumber>
<Rating>AL</Rating>
<ProductionYear>1982</ProductionYear>
<Released>2000-10-25</Released>
<RunningTime>974</RunningTime>
<Genres>
<Genre>Animation</Genre>
</Genres>
<Format>
<FormatAspectRatio>1.33</FormatAspectRatio>
<FormatVideoStandard>PAL</FormatVideoStandard>
<FormatLetterBox>False</FormatLetterBox>
<FormatPanAndScan>False</FormatPanAndScan>
<FormatFullFrame>True</FormatFullFrame>
<Format16X9>False</Format16X9>
<FormatDualSided>False</FormatDualSided>
<FormatDualLayered>False</FormatDualLayered>
<FormatFlipper>False</FormatFlipper>
</Format>
<Features>
<FeatureSceneAccess>True</FeatureSceneAccess>
<FeatureCommentary>False</FeatureCommentary>
<FeatureTrailer>True</FeatureTrailer>
<FeatureDeletedScenes>False</FeatureDeletedScenes>
<FeatureMakingOf>True</FeatureMakingOf>
<FeatureProductionNotes>True</FeatureProductionNotes>
<FeatureGame>False</FeatureGame>
<FeatureDVDROMContent>False</FeatureDVDROMContent>
<FeatureMultiAngle>False</FeatureMultiAngle>
<FeatureMusicVideos>False</FeatureMusicVideos>
<FeatureClosedCaptioned>False</FeatureClosedCaptioned>
<FeatureTHXCertified>False</FeatureTHXCertified>
</Features>
<Studios>
<Studio>Sony Music Video</Studio>
</Studios>
<Audio>
<AudioFormat>
<AudioLanguage>French</AudioLanguage>
<AudioCompression>MPEG Audio Stream</AudioCompression>
<AudioChannels>Mono</AudioChannels>
</AudioFormat>
</Audio>
<Subtitles>
</Subtitles>
<Directors>
</Directors>
<Actors>
</Actors>
<Review>
<ReviewFilm>0</ReviewFilm>
<ReviewVideo>0</ReviewVideo>
<ReviewAudio>0</ReviewAudio>
<ReviewExtras>0</ReviewExtras>
</Review>
<SRPInfo>
<SRP>$0.00</SRP>
<SRPCurrencyID>USD</SRPCurrencyID>
<SRPCurrencyName>United States (Dollar)</SRPCurrencyName>
</SRPInfo>
<PurchaseInfo>
<PurchasePriceInfo>
<PurchasePrice>$0.00</PurchasePrice>
<PurchasePriceCurrencyID>USD</PurchasePriceCurrencyID>
<PurchasePriceCurrencyName>United States (Dollar)</PurchasePriceCurrencyName>
</PurchasePriceInfo>
<PurchaseDate>1899-12-30</PurchaseDate>
</PurchaseInfo>
<LoanInfo>
</LoanInfo>
<Overview>Rencontre avec Bernard Deyriès Filmographie Descriptif des personnages Carte interactive des sites traversés par les personnages Bandes-annonces 39 épisodes avec documentaires de fin</Overview>
<LastEdited>2003-07-27</LastEdited>
</DVD>
</Collection></code>
Thanx
Sybux
|
|
|
|
|
Hi
I would load the xmldocument into a XmlDocument-class. Then I would use SelectNodes to fetch the proper information.
Dim lstNode As XmlNodeList
Dim xmlDoc As New XmlDocument()
xmlDoc.Load("...\...path\file.xml")
lstNode = xmlDoc.SelectNodes(strChoose)
(strChoose is the "xpathway" to your information)
(For each XmlNode in XmlNodeList, do build a string, use XmlNode.ChildNodes )
Regards
// Daniel
|
|
|
|
|
Thanks for the answer.
Is it possible to know the name of the XML Element ?
In my case I'd like to know, in the order, that I'm in :
DVD
ID
UPC
Title
etc...
Sybux
|
|
|
|
|
Hi
I guess you mean XmlElement.Name ?
Regards
Daniel
|
|
|
|
|
HI,
I'm not familiar with XML name but I just want to know (from my exemple) the name of the "category" I'm in. The category for me is <id> <utc> <title> etc...
If this is XMLElement so I need to get those information from the XMLNode (if possible).
Thx
Sybux
|
|
|
|