|
The type of the element is defined in the schemas, there is no way to get this information from the xml document alone.
Denevers
|
|
|
|
|
hi all,i'm creating a mobile appliction with ms vs2005 release edition, im using a webservice from www.webservicex.com and i get the exception with the details :
Status :System.Net.WebExceptionStatus.ConnectFailure
System.Net.WebException was unhandled
Message="Could not establish connection to network."
StackTrace:
at System.Net.HttpWebRequest.finishGetResponse()
at System.Net.HttpWebRequest.GetResponse()
at System.Web.Services.Protocols.WebClientProtocol.GetWebResponse()
at System.Web.Services.Protocols.HttpWebClientProtocol.GetWebResponse()
at System.Web.Services.Protocols.SoapHttpClientProtocol.doInvoke()
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke()
at DeviceApplication2.net.webservicex.www.lengthUnit.ChangeLengthUnit()
at DeviceApplication2.Form1.button1_Click()
at System.Windows.Forms.Control.onclick()
at System.Windows.Forms.Button.onclick()
at System.Windows.Forms.ButtonBase.WnProc()
at System.Windows.Forms.Control._InternalWnProc()
at Microsoft.AGL.Forms.EVL.EnterMainLoop()
at System.Windows.Forms.Application.Run()
at DeviceApplication2.Program.Main()
&here's my code:
private void button1_Click(object sender, EventArgs e)
{
net.webservicex.www.lengthUnit l = new
DeviceApplication2.net.webservicex.www.lengthUnit();
double x = l.ChangeLengthUnit(120, DeviceApplication2.net.webservicex.www.Lengths.Feet, DeviceApplication2.net.webservicex.www.Lengths.Meters);
MessageBox.Show(x.ToString());
}
please tell me where is the error (i'm deploying it using the device emulator and the active sync program)
|
|
|
|
|
Hi,
I wonder if anyone can offer some advice on the best way to accomplish this:
I have an existing asp.net app that displays products from a catalogue, data stored in access. My friend has provided an xml feed from their database so that I can incorporate their data into my app, without the need to duplicate the data. How would I go about building a feed mechanism where by I can display their data whenever a user loads my app?
I would guess this is a common requirement.
Many Thanks
Kieran
|
|
|
|
|
am i getting u right ...
u friend as provided an access for u to get the datas as xml ....
and u r askin how get tht data and display it in ur app???
if tht is the case u write a webservice for tht ... to get the datas from there....
if not provide some more details
sathy
|
|
|
|
|
Hi everybody,
I'm looking for an activex control (or anything that could be interfaced easily with MFC) which provides XML code editing with the following features:
- syntax highlight
- auto completion
- auto validation of the syntax
Something real simple like the VS.Net XML Editor.
I've searched for one during many hours, but unsuccessfully...
Thanks
|
|
|
|
|
could anyone please suggest how to convert a .mat file to xml
|
|
|
|
|
I have the following code sequence:
MemoryStream memStream= new MemoryStream();
XmlTextWriter xmlWriter= new XmlTextWriter(memStream, System.Text.Encoding.UTF8);
doc.Save(xmlWriter, myCommand );
string xmlCmd= System.Text.Encoding.ASCII.GetString(memStream.ToArray());
System.Console.WriteLine( "xmlCmd= {0}", xmlCmd );
Here's the command it creates:
o;?<mycommand xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
...="" lots="" of="" valid="" xml="" here
<="" mycommand="">
Why the 'o;?' characters in front of the command?
|
|
|
|
|
Hi,
could anybody help with this?
I want to replicate this hard coded xml by drawing the data from a sql database.
I have had some sucess but I would like to omit "PR_Ref" entry from the resulting dataset,
but I do need it for the foreignkey/primarykey. I'm not sure if the string conversion is
correct either.
I need to read the resulting dataset to a string. This is the original hard coded bit:
______________________________________________________________________________________________
string xmlData;
xmlData = "<newdataset>";
xmlData += " <group>";
xmlData += " <name>Project 1";
xmlData += " <blockcolor>#ff0000";
xmlData += " <block>";
xmlData += " <href>activity.aspx?ActID=7";
xmlData += " <startdate>2005-04-01T00:00:00.0000000+01:00";
xmlData += " <enddate>2005-04-03T00:00:00.0000000+01:00";
xmlData += " <name>First part";
xmlData += " ";
xmlData += " <block>";
xmlData += " <href>activity.aspx?ActID=13";
xmlData += " <startdate>2005-04-06T00:00:00.0000000+01:00";
xmlData += " <enddate>2005-04-06T00:00:00.0000000+01:00";
xmlData += " <name>blah, blah";
xmlData += " ";
xmlData += " ";
xmlData += " <group>";
xmlData += " <name>Project 2";
xmlData += " <blockcolor>#ff0000";
xmlData += " <block>";
xmlData += " <href>activity.aspx?ActID=14";
xmlData += " <startdate>2005-04-06T00:00:00.0000000+01:00";
xmlData += " <enddate>2005-04-09T00:00:00.0000000+01:00";
xmlData += " <name>blah, blah";
xmlData += " ";
xmlData += " <block>";
xmlData += " <href>activity.aspx?ActID=15";
xmlData += " <startdate>2005-04-06T00:00:00.0000000+01:00";
xmlData += " <enddate>2005-04-09T00:00:00.0000000+01:00";
xmlData += " <name>blah";
xmlData += " ";
xmlData += " ";
xmlData += "";
______________________________________________________________________________________________
This is my attempt
____________________________________________________________________________________________
DataSet myds = new DataSet();
OleDbDataAdapter myGroupAdapter;
OleDbDataAdapter myBlockAdapter;
DataColumn primaryKey = new DataColumn();
DataColumn ForeignKey = new DataColumn();
OleDbConnection myConn = new OleDbConnection("Provider=SQLOLEDB.1; Persist Security Info=False; Data Source=xxx; Initial Catalog=xxx;User ID=xx;Password=xxxxxx;");
myGroupAdapter = new OleDbDataAdapter("select PR_NAME, blockcolor, PR_Ref from PM_PROJECT", myConn);
myBlockAdapter = new OleDbDataAdapter("Select href, Sub_Start, Sub_End, Sub_Name, PR_Ref from SUBTASK", myConn);
myGroupAdapter.Fill(myds, "group");
myBlockAdapter.Fill(myds, "block");
primaryKey = myds.Tables["group"].Columns["PR_Ref"];
ForeignKey = myds.Tables["block"].Columns["PR_Ref"];
DataRelation relation = new DataRelation("group", primaryKey, ForeignKey);
relation.Nested = true;
myds.Relations.Add(relation);
string xmlData = Convert.ToString((DataSet)myds);//not sure if this bit works
//I tested it with this:
myds.WriteXml("TestXML.txt")
___________________________________________________________________________________________
This was the resulting output
<newdataset>
<group>
<pr_name>Test Project
<blockcolor>#ff0000
<pr_ref>1
<block>
<href>activity.aspx?ActID=7
<sub_start>2006-02-02T00:00:00+00:00
<sub_end>2006-02-03T00:00:00+00:00
<sub_name>Start Test
<pr_ref>1
<block>
<href>activity.aspx?ActID=7
<sub_start>2006-02-03T00:00:00+00:00
<sub_end>2006-02-05T00:00:00+00:00
<sub_name>second sub for
<pr_ref>1
<block>
<href>activity.aspx?ActID=7
<sub_start>2006-02-03T00:00:00+00:00
<sub_end>2006-02-07T00:00:00+00:00
<sub_name>3rd test
<pr_ref>1
<group>
<pr_name>second Test
<blockcolor>#ff0000
<pr_ref>2
<block>
<href>activity.aspx?ActID=7
<sub_start>2006-02-01T00:00:00+00:00
<sub_end>2006-02-08T00:00:00+00:00
<sub_name>first/second
<pr_ref>2
Sorry the post is so long. Does anybody have any ideas??
Thanks
Ironstrike
|
|
|
|
|
Output didnt copy properly, sorry again about the long post
<newdataset>
<group>
<pr_name>Test Project
<blockcolor>#ff0000
<pr_ref>1
<block>
<href>activity.aspx?ActID=7
<sub_start>2006-02-02T00:00:00+00:00
<sub_end>2006-02-03T00:00:00+00:00
<sub_name>Start Test
<pr_ref>1
<block>
<href>activity.aspx?ActID=7
<sub_start>2006-02-03T00:00:00+00:00
<sub_end>2006-02-05T00:00:00+00:00
<sub_name>second sub for
<pr_ref>1
<block>
<href>activity.aspx?ActID=7
<sub_start>2006-02-03T00:00:00+00:00
<sub_end>2006-02-07T00:00:00+00:00
<sub_name>3rd test
<pr_ref>1
<group>
<pr_name>second Test
<blockcolor>#ff0000
<pr_ref>2
<block>
<href>activity.aspx?ActID=7
<sub_start>2006-02-01T00:00:00+00:00
<sub_end>2006-02-08T00:00:00+00:00
<sub_name>first/second
<pr_ref>2
|
|
|
|
|
I have an xsd file that I use to validate inbound xml files and it works fine as long as the elements are in the same order. But what I would like is for it to validate the element exists rather than it exists in a specific order.
For example I want both of these to be validated as true:
<Customer>
<LastName>Smith</LastName>
<FirstName>John</FirstName>
</Customer>
- or -
<Customer>
<FirstName>John</FirstName>
<LastName>Smith</LastName>
</Customer>
The elements FirstName and LastName under customer need to exist, I just don't care which order they are in. Is there something in the xsd that can be set to make it work this way?
Thanks in advance,
Al
|
|
|
|
|
Dear All,
Can You Help me to come accross my problem.
I need to convert the Excel file in the following format to Xml file Specified below...
Taskid Name OutlineLevel Colvalue
110i Design 3 L4_R_D04.002
111i Coding 3 L4_R_D04.004
112i Testing 3 L4_R_D04.006
<tasks>
<task Taskid="110i" Name="Design" Oulinelevel="3">
<colValue>L4_R_D04.002</colValue>
</task>
<task Taskid="111i" Name="Coding" Oulinelevel="3">
<colValue>L4_R_D04.004</colValue>
</task>
..........
</tasks>
Thanks n Regards,
Ramya.R
-- modified at 23:58 Thursday 23rd February, 2006
|
|
|
|
|
Any idea on xsl watermark.
|
|
|
|
|
You create your watermark with HTML. XSL can transform XML data into an HTML document that has a watermark.
|
|
|
|
|
Hi,
I need to add attribute information defined in xsd file to my resx file, which contains already defined schema and other information. For example I have defined attribute 'Page' in XSD file then I need to add this attribute in my resx file. Suggest me how to acheive this..I have already imported the underlying XSD file through "schemalocation"...
I guess I made myself clear.............
|
|
|
|
|
Hi!
When creating a new XmlDocument with DOM I stumbled upon the following problem. Wanting to display the xml-structure (containing namespaces) the XmlDocument.NameTable used in XmlNamespaceManager(xmlDocument.NameTable) is different when I try to display the XmlDocument directly after creating it than it is when saving the XmlDocument to file, reopening and THEN displaying it. The result is that the NameSpaceManager doesn't underestand the namespaces in SelectSingleNode & selectNode methods.
Saving to file and reopening before running the two methods works fine, and I notice in debugging that the length of the XmlDocument.NameTable is different(longer) than before saving/reopening to/from file. How can I manipulate the XmlDocument.NameTable in order for the NameSpaceManager to understand the namespaces without having to save and reopen the file? Or is my problem elsewhere ? This was the only difference I could find. The innerXml of the xmlDocument is 100% identical in both cases.
Hopefully awaiting a helping hand.
C
|
|
|
|
|
Once you reload the XML file, you have to iterate through the Namespace table, loading up the contained namespaces into the namespace manager (this doesn't happen for you). In order for selectSingleNode & selectNode to work, if the XML contains namespaces, those must be added to the Namespace manager.
So, you'll want to do something like (C# code):
<code>private void UpdateNamespaces(XmlNamespaceManager nsm)
{
this.lbNamespaces.Items.Clear();
xmlNodeList = xmlDocument.SelectNodes("//namespace::*");
if (xmlNodeList != null)
{
for (int i=0; i<xmlNodeList.Count; i++)
{
xmlNode = xmlNodeList.Item(i);
if (xmlNode != null)
{
string strPreFix = xmlNode.Name.ToString();
int iPos = strPreFix.IndexOf(":", 0, strPreFix.Length - 1);
strPreFix = strPreFix.Substring(iPos + 1);
if (strPreFix == "xmlns")
strPreFix = "BogusName";
string strNameSpaceURI = xmlNode.InnerText.ToString();
if (this.lbNamespaces.FindString(strPreFix + "=" + strNameSpaceURI) < 0)
{
this.lbNamespaces.Items.Add(strPreFix + "=" + strNameSpaceURI);
nsm.AddNamespace(strPreFix, strNameSpaceURI);
}
}
}
}
}
</code>
Note: the list of namespaces will contain duplicates, so those must be removed ...
:..::. Douglas H. Troy ::..
Bad Astronomy |Development Blogging|Viksoe.dk's Site
|
|
|
|
|
Dear Expert,
Please take a look at the bottom sample XML codes. I would like to write a XPath that finds out the "ProjectId" based on a given "File Name". For example, the file name "file1.txt" corresponds to the ProjectId "P007". My XPath was written as follows:
xPath = "/Sample/Projects/Project[./Files/File/Name='file1.txt']/ProjectId"
This xPath is then put into the following code fragment for processing:
XmlTextReader xtr = new XmlTextReader(xmlFilePath);
xtr.WhitespaceHandling = WhitespaceHandling.None;
XmlDocument xd = new XmlDocument();
xd.Load(xtr);
XmlNodeList xnl = xd.DocumentElement.SelectNodes(xPath);
Unfortunately, it seems the above xPath is invalid and so exception was thrown. I don't know how to write the correct XPath for this case. Could you please advice?
Thanks a lot for your help.
Tigger
-----------------------------------------------------------------------------
XML sample:
<?xml version="1.0" encoding="UTF-8"?>
<Sample>
<Projects>
<Project>
<ProjectName>Project-1</ProjectName>
<ProjectId>P007</ProjectId> <--*****
<Files>
<File>
<Name>file1.txt</Name> <---*****
</File>
<File>
<Name>file2.txt</Name>
</File>
</Files>
</Project>
<Project>
<ProjectName>Project-2</ProjectName>
<ProjectId>P008</ProjectId>
<Files>
<File>
<Name>file3.txt</Name>
</File>
<File>
<Name>file4.txt</Name>
</File>
</Files>
</Project>
</Projects>
</Sample>
|
|
|
|
|
String xPath = "/Sample/Projects/Project[./Files/File/Name='file1.txt']/ProjectId/child::text()"
XmlTextReader xtr = new XmlTextReader(xmlFilePath);
xtr.WhitespaceHandling = WhitespaceHandling.None;
XmlDocument xd = new XmlDocument();
xd.Load(xtr);
XmlNodeList xnl = xd.DocumentElement.SelectNodes(xPath);
for each (XmlNode ^ node in xnl)
{
Console::WriteLine(node->Value);
}
|
|
|
|
|
Hello everyone,
I had a weird case in an XML file some days ago.
I have an application to read/write/delete from XML file at a customer site, (i am only using XMLElements, InnerText...etc). Few days ago, i looked at the XML file, and i found out that the file is filled with SPACES for almost 300 lines, here's an example of what am talking about.
Thats the original document
<document>
<id>1
<fields>
<field>123
<field>333
<field>555
Here's what i found:
<document>
<id>1
<fields>
|
|
|
|
|
Actually, your XML is hidden since you didn't check the "Ignore HTML tags in this message (good for code snippets)" checkbox.
Since I don't know anything about the context of how this file got corrupt, it is very hard to speculate what happened.
|
|
|
|
|
Thanks for ur interest,
here's the original XML document what it is usually is:
<Document>
<Field>
<ID>1</ID>
<Name>123</Name>
</Field>
<Field>
<ID>2</ID>
<Name>234</Name>
</Field>
</Document>
and the corrupted XML file that i found was like:
<Document>
<Field>
<ID>1</ID>
<Name>123</Name>
</Field>
<Fie (and the rest of the XML is just spaces...that also include the root element, even the field tag is not completed!)
This issue occured only once, although the XML file is accessed hundreds of times a day!
|
|
|
|
|
Looks like your application may have thrown an exception during the writing the XML application and it had already allocated the disk space. So, you will see what was there on disk from previous discarded storage data before the writing of the XML file.
|
|
|
|
|
Hi,
Thanks for the reply
But is that even possible? whatever thrown exception, if you didn't apply save, it won't apply any changes.
If the exception is thrown during the saving, can this exception be simulated?
Thanks a lot!
|
|
|
|
|
Hi,
I was wondering if Visual Studio 2003 supports reading XML file generated by saving Word Document 2003 as XML?
I was trying to read word doc xml into an empty dataset just like a regular xml file but DuplicationNameException error persists. The word XML is basically well-formed but the data view for the xml is unable to display the structures.
Could someone help explain to me the reason why? Im still working on Visual Studio 2003 and if this is a new feature of word document 2003 that is not supported in VS2003, then I have no choice but to acquire VS2005.
My goal is to be able to load a word document xml in a server (maybe sql server) and then be able to read back that xml, load into a dataset, display in a view keeping all the formatting properties of the contents of the word document.
If anyone has any idea to do this within the boundary of the Visual Studio and C#, I would really appreciate the help.
Thanks so much!
Teddy
Teddy
|
|
|
|
|
I have no idea if this is possible, but you'll probably need to point your DataSet to the Microsoft XSD for XML formatted Word documents.
The duplicate name maybe because of a namespace issue in the XML ...
Why would you want to read the underlying Word XML into a DataSet anyway? Wouldn't you want to be able to read it back and load it back up into Word?
:..::. Douglas H. Troy ::..
Bad Astronomy |Development Blogging|Viksoe.dk's Site
|
|
|
|