|
K V S Chand wrote: Column means a column in XML.
There is no such thing as a "column" in XML. If you plan on using text based communications for solving your programming problems don't you think it might be a good idea to learn and use the standard terms for a given technology? Otherwise how do expect to be able to communicate. XML has nodes and elements and attributes, no columns, so I have no idea what you are talking about.
led mike
|
|
|
|
|
i created an xml file using xml serialization for a c# CLASS.
BUT I GOT ALL THE FIELDS FROM THAT CLASS. HOW CAN I REMOVE UN NECESSARY ATTRIBUTES.
CAN ANYBODY HELP ME PLEASE?
KSRS
|
|
|
|
|
First, please don't shout.
Second if it is class that you have created simply apply the [System.Xml.Serialization.XmlIgnoreAttribute] to the properties that you don't want to show.
If it is a framework class, you need to get the data from the XMLSerializer object to an XML document object for manipulation. If this is the case and you have problems with this, please post the specifics.
topcoderjax - Remember, Google is your friend.
|
|
|
|
|
hi iam new to the Xpath
could anyone help me?? i just want to pick up countryname which is element and it has a attribute for the code. i want to pick these values from the XmlDoc
the code here as follows:-
Dim CountryPropExpr As XPath.XPathExpression = Nav.Compile("./CountryName[@Code=""]")
Dim CountryPropIter As XPath.XPathNodeIterator = Nav.Select(CountryPropExpr)
If CountryPropIter IsNot Nothing AndAlso CountryPropIter.Count > 0 Then
Try
Dim CountryNameCode As String = getNodeValue(CountryPropIter.Current.SelectSingleNode("./CountryName[@Code=""]"))
For Each CountryNameCode In CountryPropIter
CountryNameCode = CountryPropIter.Current.Value
Next
Builder.AppendLine("<countryname code="" ""="">")
Catch ex As Exception
Debug.Write(ex.Message)
End Try
End If
when i compile it didn't pickup the values.
Thanks Heaps in Advance
|
|
|
|
|
Please provide a document fragment. Without the XML, there is noway to test the validity of your method call.
"In quiet and silence, the truth is made clear."
|
|
|
|
|
Could someone advise me on the syntax to use to get the IXMLNode whose attribute id="abc" so in the XPath expression used to SelectSinglenode you would specifiy the @id="abc" or whatever the correct syntax is so as to select the Node whose attribute id has the value == "abc".
Thanks.
|
|
|
|
|
Basically, I want to locate and return any Node in the XML document which has an attribute id equal to the id I am searching for.
I have been trying with XPath's such as:
"//*[@id( 'abc' )]"
But alas so far I have not found the correct syntax.
|
|
|
|
|
I managed to get this to work thus:
"//*[@id='" + sURI + "']"
Thanks
|
|
|
|
|
I have a complex XML document and the associated XSD document. But I don't have a XSL document. I want to display the XML in a HTML viewer. Is there any way to create a XSL from the XSD and XML or do you have no option but to create the XSL file to display how you want?
|
|
|
|
|
Andy H wrote: I want to display the XML in a HTML viewer.
What does that mean? If you open an XML file in Firefox or Internet Explorer they will display them for you.
led mike
|
|
|
|
|
In addition to what Mr. led mike said, it may be possible to create XSLT from the XML document's XSD but it won't be worth the effort. To create a HTML document that meet your needs, you must create the XSLT manually or settle with the default XSLT in IE and Firefox.
"We make a living by what we get, we make a life by what we give." --Winston Churchill
|
|
|
|
|
George L. Jackson wrote: or settle with the default XSLT in IE and Firefox.
You can get the XSLT from IE. actually it's in the MSXML3.dll I think.
led mike
|
|
|
|
|
led mike wrote: You can get the XSLT from IE. actually it's in the MSXML3.dll I think.
Well Said led Mike.
Regards,
Satips.
|
|
|
|
|
Thanks Mike! I messed up. It is a resource of MSXML3.DLL and you can view IE's default XSLT via this URN: res://msxml.dll/DEFAULTSS.xsl.
"We make a living by what we get, we make a life by what we give." --Winston Churchill
|
|
|
|
|
Hi all
I have XML document and I need to add gif file.
I dont now XML and can you help me.
|
|
|
|
|
david bagaturia wrote: I dont now XML and can you help me.
Did you try Google[^]
or maybe this would help more[^]
led mike
|
|
|
|
|
Hmmm, an explicit display of tough love. Someone will need a man hug after this.
"We make a living by what we get, we make a life by what we give." --Winston Churchill
|
|
|
|
|
You can use Base64 or quadrosexagesimal! Please use Google to find more information.
"We make a living by what we get, we make a life by what we give." --Winston Churchill
|
|
|
|
|
|
I'm trying to serialise a graph structure to XML.
Everything is working fine except for one object which is alwasy coming out as an empty element. Even if I serialise it on its own. Its the most important object as it represents the link. Any idea why it wouldn't show any attributes?
Heres the code:
<br />
[Serializable()]<br />
[System.Xml.Serialization.XmlInclude(typeof(ParticipantNode))]<br />
public class EdgeToNeighbour<br />
{<br />
#region Private Member Variables<br />
private string id;<br />
private Node neighbour;<br />
#endregion<br />
<br />
#region Constructors<br />
public EdgeToNeighbour() <br />
{<br />
}<br />
<br />
public EdgeToNeighbour(Node neighbour)<br />
{<br />
this.neighbour = neighbour;<br />
this.id = neighbour.Key;<br />
}<br />
#endregion<br />
<br />
#region Properties<br />
public Node Neighbour<br />
{<br />
get<br />
{<br />
return neighbour;<br />
}<br />
}<br />
public string ID<br />
{<br />
get{return id;}<br />
}<br />
#endregion<br />
}<br />
I've tried ignoring the complex type, i've tried adding XML text, I've tried lots of different combinations of XmlAttribute etc. but i always end up with this:
Serialised on its own:
<br />
<EdgeToNeighbour xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" /><br />
Serialised as part of the graph structure:
<br />
<anyType xsi:type="Node"><br />
<Data><br />
<ID>2</ID><br />
<TypeID>0</TypeID><br />
<Name>A Node</Name><br />
</Data><br />
<Edges><br />
<EdgeToNeighbour /><br />
<EdgeToNeighbour /><br />
</Edges><br />
</anyType><br />
All I want is for edge to neighbour object to show the attribute ID so I can see the nodes it is linked to.
Thanks in advance.
Rob.
|
|
|
|
|
All of you properties are either private or read only. Only public read/write properties are serialized unless you implement the ISerializable interface(which lets you determine exactly how your class is serialized).
-- modified at 20:58 Wednesday 23rd May, 2007
topcoderjax - Remember, Google is your friend.
|
|
|
|
|
i am using sitemap control to navigate through site. Plse suggest me to traverse .
I mean root+child+sublings..home>News> which looks like this and how to create the sitemap file or xml to traverse.....help me plse
came out of hardwork
|
|
|
|
|
I'm creating a typed DataSet for my XML file and I'm having trouble modifying the XSD file to conform to my data's format. Here's a sample of my data:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<dropdowns>
<Country lang="en">Albania</Country>
<Country lang="en">Algeria</Country>
...
I need for my Country data table to have two columns: "lang" and "name". How do I set up the XSD to treat the contents of the Country element as my name column? I've tried this, but it's not working:
<xs:element name="Dropdowns" msdata:IsDataSet="true" msdata:UseCurrentLocale="true" msprop:Generator_UserDSName="Dropdowns" msprop:Generator_DataSetName="Dropdowns">
<xs:complexType>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="Country" form="unqualified" msprop:Generator_UserTableName="Country" msprop:Generator_RowDeletedName="CountryRowDeleted" msprop:Generator_RowChangedName="CountryRowChanged" msprop:Generator_RowClassName="CountryRow" msprop:Generator_RowChangingName="CountryRowChanging" msprop:Generator_RowEvArgName="CountryRowChangeEvent" msprop:Generator_RowEvHandlerName="CountryRowChangeEventHandler" msprop:Generator_TableClassName="CountryDataTable" msprop:Generator_TableVarName="tableCountry" msprop:Generator_RowDeletingName="CountryRowDeleting" msprop:Generator_TablePropName="Country">
<xs:complexType name="name" form="unqualified" msprop:Generator_UserColumnName="name" msprop:nullValue="_empty" msprop:Generator_ColumnPropNameInRow="name" msprop:Generator_ColumnPropNameInTable="nameColumn" msprop:Generator_ColumnVarNameInTable="columnname" type="xs:string" default="">
<xs:attribute name="lang" form="unqualified" msprop:Generator_UserColumnName="lang" msprop:nullValue="_throw" msprop:Generator_ColumnPropNameInRow="lang" msprop:Generator_ColumnPropNameInTable="langColumn" msprop:Generator_ColumnVarNameInTable="columnlang" type="xs:string" msdata:DefaultValue="en" use="required" />
</xs:complexType>
</xs:element>
How do I fix the part in bold?
Thanks!
Alvaro
Eat right. Exercise. Die anyway.
|
|
|
|
|
Hi All,
I am sure the solution to this is *Really* easy, but i've been staring at it for a while now and have got nowhere. I've written the test below in both C# and VB and both do the same thing.
I need to use an XmlReader object to read in an xml document. Note that it is essential that i use an XmlReader object as I need to perform schema validation. The code below does not incluse schema validation as as this stage i'm just trying to get an xml file into an XmlReader.
Looking in the msdn and a range of examples in google i should be able to get an XmlReader object containing my xml document by using XmlReader.Create(TextReader o). Everything is working right up until that step, but using the debug tools my XmlReader object appears to remain content-less. Here's the code:
using System;
using System.Collections.Generic;
using System.Text;
using System.Xml;
using System.IO;
namespace XmlTest
{
class Program
{
static void Main(string[] args)
{
String file = "C:\\WINDOWS\\Microsoft.NET\\Framework\\v2.0.50727\\CONFIG\\web.config";
XmlDocument doc = new XmlDocument();
doc.Load(new System.IO.StreamReader(file));
String docString = doc.OuterXml;
TextReader tr = new StringReader(docString);
XmlReader xr = XmlReader.Create(tr);
System.Console.ReadKey();
}
}
}
So we're loading in an xml file, putting it into an XmlDocument and getting the Xml as a string out of it. This is because ultimately when i slot this work back into what i'm doing i'll be obtaining the xml document via a string.
A TextReader object is then created from the string via a StringReader. If i debug the code i can see the document correctly loaded into the TextReader (tr) in it's entirity. It just doesn't seem to be converted into an XmlReader object via XmlReader.Create(tr).
Similarly, if i replace XmlReader.Create(tr) with XmlReader.Create(new System.IO.StreamReader(file)) I have the same problem, proving it's none of the logic inbetween that is messing things up.
What am i missing about XmlReader? Please help if you can, this is driving me absolutely nuts. When i look at it in debug the object has a depth of zero and looking in items i see "In order to evaluate an indexed property, the property must be qualified and the arguments must be explicitly supplied by the user." I have no idea what this means and google doesn't help.
You should be able to copy and paste the code and replicate the issue easily.
Many thanks,
Rolf
|
|
|
|
|
I think the problem is that the reader isn't position on an XML node after being created, so you'll have to call any Read method before the properties (e.g. depth) return any useful information.
"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
|
|
|
|