|
then what is your problem ?? do u need to write non empty element only ??
love2code
|
|
|
|
|
Indeed, only the elements who have content need to be written from the dataset to xml.
Otherwise, a solution who will remove all the empty elements from the output xml-file would be a good alternative.
Every solution is right.
Ruud
|
|
|
|
|
Hai...
1. How can i send request post soap envelope in vb.net???
2. how i can get msxml??
Thank's....
Donnylie
|
|
|
|
|
i have a xml file , it looks like this:
<config>
<language name = "EN" output = "C:\" />
<language name = "CN" output = "D:\" />
.
.
.
</config>
i wrote a xdr file like this , but it doesn't work, i know there must be something wrong with my schema file, could u help me correct this file?
<?xml version="1.0" encoding="UTF-8" ?>
<Schema xmlns="urn:schemas-microsoft-com:xml-data">
<ElementType content = "eltOnly" name = "config" order = "one" model = "closed">
<ElementType content = "empty" name = "language" order = "one" model = "closed">
<AttributeType name = "name" dt:type="string" required = "yes"/>
<AttributeType name = "output" dt:type="string" required = "yes"/>
</ElementType>
<element type = "language" minOccurs = "1" maxOccurs = "*" />
</ElementType>
</Schema>
|
|
|
|
|
where from [dt:type="string"] is coming into the picture, did you specify the namespace ???
love2code
|
|
|
|
|
i have a xml schema file and a xml file which is to be validated?
how to use them in my vc program?
|
|
|
|
|
(i'm reposting, first time i posted i wasn't logged in )
hello
i have an xsd with a tag from type "xsd:time". <REGTIME>
when i generate a sample xml file with XML spy i get this sample filled in: <REGTIME>14:20:0Z</REGTIME>
now when i try to parse this file with the .NET xpathdocument the application crashes on this line:
XPathDocument document = new XPathDocument(readerToUse);
(readerToUse is of type xmlreader)
it crashes and says this string in REGTIME is not a valid string for type DATETIME.
so i assume .NET recognizes the xsd:time field, but says it's invalid, why? xmlspy says it's ok.
i hope someone can help me out here.
thank you
-- modified at 9:48 Monday 29th August, 2005
|
|
|
|
|
hello
i have an xsd with a tag from type "xsd:time".
when i generate a sample xml file with XML spy i get this sample filled in: <regtime>14:20:0Z
now when i try to parse this file with the .NET xpathdocument the application crashes on this line:
XPathDocument document = new XPathDocument(readerToUse);
(readerToUse is of type xmlreader)
it crashes and says this string in REGTIME is not a valid string for type DATETIME.
so i assume .NET recognizes the xsd:time field, but says it's invalid, why? xmlspy says it's ok.
i hope someone can help me out here.
thank you
|
|
|
|
|
I'm trying to use MSXML 4 DOM to parse a xml document in Visual C++, but without success. A snippet of the xml structure is a following:
<data>
<album label="Album title 1">
<track label="Label 1" sndUrl="1\0.jk" txtUrl="1\0.jk"/>
<track label="Label 2" sndUrl="1\1.jk" txtUrl="1\0.jk"/>
</album>
<album label="Album title 2">
<track label="Label 1" sndUrl="2\0.jk" txtUrl="2\0.jk"/>
<track label="Label 2" sndUrl="2\1.jk" txtUrl="2\0.jk"/>
</album>
</data>
Can anyone give me a code snippet to parse album label, track label, sndUrl, txtUrl attributes to a CString?
Please help!
Thanks in advance for any answers.
|
|
|
|
|
Hi
I am trying to upload the XML file to parse it. While I upload it I am getting this error:
System.Xml.XmlException: The '0' character, hexadecimal value 0x30, cannot begin with a name. Line 726, position 2823.
Somwtimes I also get invalid character exception.
I am parsing many XML files in a "for loop" after downloading it from a website automatically. Is their anyway to ignore these exceptions and able to load the document or a way to solve this problem with XML files through a progam, so that I dont have to manually handle such characters in the file?
Any help would be appreciated.
Thanks
rscr
|
|
|
|
|
Hi, I am new to manipulating XML with C#.
I want to know how to retrieve an element value.
I have this vey simple XML file :
<?xml version="1.0" encoding="utf-8"?>
<people>
<person>
<Lname> Washington </Lname>
<FName> George </Fname>
</person>
<person>
<Lname> Lincoln </Lname>
<Fname> Abraham </Fname>
</person>
</people>
All I need is a simple method :
public string GetFname(string Lname)
{
...
}
which returns the first name by last name.
Thanks a lot!
|
|
|
|
|
hi,
There are some different ways how you can do that. Maybe easiest (but not necessary most effective) is this:
XmlDocument doc = new XmlDocument();
doc.Load( fileNameofYourXml )
while( doc.Read() )
{
if( doc.Name == "Lname" && doc.Value == Lname )
{
doc.Read();
return doc.Value;
}
}
OR you can go with XPath:
doc.SelectSingleNode( string.Format("/person/following-sibling::Lname='{0}'", Lname) );
But I bet I got syntax for that XPath expresion wrong
Never forget: "Stay kul and happy" (I.A.)
David's thoughts / dnhsoftware.org / MyHTMLTidy
|
|
|
|
|
Hi, thanks for your reply,
In fact I tried the first method. It doesn't work.
1-XmlDocument has no method Read, (only a method ReadNode which take a reader as argument! No idea how it works)
2-Instead I used XmlTextReader, still not working. One remark: when I display all the Values and Names in a label, I get many of them null. Other think, they are always the same : value=name?
Any hint?
For the Xpath method didn't try it.
Thanks.
|
|
|
|
|
benqazou wrote:
1-XmlDocument has no method Read, (only a method ReadNode which take a reader as argument! No idea how it works)
Oh yes, sorry. My bad. Of course Read() is method of XmlReader.
benqazou wrote:
2-Instead I used XmlTextReader, still not working. One remark: when I display all the Values and Names in a label, I get many of them null. Other think, they are always the same : value=name?
Can you post snippet of your code?
Never forget: "Stay kul and happy" (I.A.)
David's thoughts / dnhsoftware.org / MyHTMLTidy
|
|
|
|
|
Hi, since it is a simple requirement, I have placed a simple solution
Try this..
//////////////////////////////////////////
using System;
using System.Xml;
namespace ConsoleApplication1
{
/* c:\pk.xml
<people>
<person>
<lname> Washington
<fname> George
<person>
<lname> Lincoln
<fname> Abraham
*/
class XmlTest
{
XmlDocument doc;//
public XmlTest()
{
doc = new XmlDocument();
doc.Load("c:\\pk.xml"); // put your file path
}
public void Run()
{
while(true)
{
Console.Write("\nEnter a Name: ");
string input = Console.ReadLine();
if(input == "" || input==null)
break;
Console.WriteLine("Your FName is " + GetFName(input));
}
}
public string GetFName(string lname)
{
string ret = "Unknown" ;
XmlNodeList lnode = doc.GetElementsByTagName("Lname");
for(int i=0; i< lnode.Count; i++)
{
if(lnode.Item(i).InnerText.Trim() == lname.Trim())
{
ret = lnode.Item(i).ParentNode.LastChild.InnerText;
break;
}
}
return ret;
}
public static void Main()
{
XmlTest xmlDoc = new XmlTest();
xmlDoc.Run();
}
}
}
love2code
|
|
|
|
|
How do we parse a xml data in a string to memory (without saving it as a file ...etc.)?
In my form, i am submitting an xml file's text in a hidden field. I want to receive it as a string, and directly parse it to memory and perform DOM functions on it...
ZiggY
|
|
|
|
|
|
Hi
I am using WSE 2.0 to sign and encrypt a soap message using the x509 xcertificate. The problem is when I only sign the message it works fine but once I use encryption it gives me following error:
---------------------------------------------------------------
Microsoft.Web.Services2.Security.SecurityFault: Referenced security token could not be retrieved
at Microsoft.Web.Services2.Security.EncryptedKey.LoadXml(XmlElement element)
at Microsoft.Web.Services2.Security.EncryptedKey..ctor(XmlElement element)
at Microsoft.Web.Services2.Security.Security.LoadXml(XmlElement element)
at Microsoft.Web.Services2.Security.SecurityInputFilter.ProcessMessage(SoapEnvelope envelope)
at Microsoft.Web.Services2.Pipeline.ProcessInputMessage(SoapEnvelope envelope)
at Microsoft.Web.Services2.WebServicesExtension.BeforeDeserializeServer(SoapServerMessage message)
---------------------------------------------------------------
can any one suggest a solution to it or any workaround.
Thanks.
|
|
|
|
|
I want to know what are different types of areas are generated by XSL-FO and little description of each. Any WEB SITE(EXCEPT THAT OF W3C). Any e-book that explains...
|
|
|
|
|
Hi,
I know that the XML Serializer does not support serializing private field. So I use a public field to get/set the private field like this:
namespace TestObjectToXML.CarComponent
{
[XmlRootAttribute("Wheel", Namespace="", IsNullable=false)]
public class Wheel : IWheel
{
public string wheelSize;
private string _wheelType;
public Wheel()
{
}
public string wheelType
{
get{return this._wheelType;}
set{this._wheelType = value;}
}
public string GetWheelType()
{
return this._wheelType;
}
public void SetWheelType(string type)
{
this._wheelType = type;
}
}
}
However, if the wheel class needs to implement methods from a IWheel interface which has already some get and set method for the wheelType, is there any way to simplify this? Sometimes the interface cannot be modified and has a lot of such get and set methods.
namespace TestObjectToXML.CarComponent
{
public interface IWheel
{
string GetWheelType();
void SetWheelType(string type);
}
}
Thanks
|
|
|
|
|
hi,
I have created a webservice project and i have another project of regular type.I have to move the webservice to this regular project.In order to do that what all files should I move and what steps need to be performed.
Thanks in advance,
Satish
|
|
|
|
|
hi,
umm what do you mean "move the webservice to this regular project"? Sounds like bad design to me... maybe you could move the code to another project (class library) and reference it in your project ( and in webservice project if you will still use it). BTW what is "regular type"? Windows app or class library or.. ?
To answer your question though, all code is in file(s) with extention .asmx.cs (or maybe .asmx.vb). Only difference between web method and ordinary method is in atributes, so without them (I think) it is ordinary method like in any other project.
[edit]can't you just reference dll in /bin folder of your webservice in your project?[/edit]
Does it help?
Never forget: "Stay kul and happy" (I.A.)
David's thoughts / dnhsoftware.org / MyHTMLTidy
|
|
|
|
|
Hi
has somebody an idea, a hint, a link, to find out, how to
PROGRAMATICALLY generate a sample xml file from
a xsd schema, like it is possible e.g. with XMLSpy?
I have to do this in the code (C#) for schema fragments.
What about:
- .NET xml/xsd API?
- xslt?
Thank you.
Gustavo
|
|
|
|
|
An xsd specifies what is a valid document, as you know. This includes specifying a minimum and maximum number of times a node can exist, which means that there are many possible valid documents. The other trick is that XSDs can reference other XSD's, and define types for groups of nodes. I'd be far more inclined to try and unwind this in code than in an XSLT.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|