|
I'v been advised to, and have chosen to follow that advice to, author a schema (xsd) that represents a hierarchy of classes (not an inheritance hierarchy, rather a master-child) and to generate the classes using the Visual Studio xsd.exe tool. This makes sense to me, as I currently have draft XML documents, for which I have hand [crafted] classes to represent functioning parts of the object described by the XML.
Currently I'm just taking my first step beyond the demo/prototype stage, where each class has hard-coded logic, even hard-coded element and attribute mappings, and moving toward a more generic serialization mechanism. This xsd.exe seems ideal, as my schema should be the driving artifact, not the classes. What I would like now is a crash course in schema authoring, an online resource I can print or download and take home with me. Who can recommend what for me?
|
|
|
|
|
I'm writing a C# Windows/.Net 2.0 app which will take a large XML document as an initial input. My form has 4 basic controls: 3 comboboxes (Country, State, and City) for filtering the XML data and a DataGrid to display the results. The XML doc has this format:
<updates xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<locations>
<country name="United States">
<state name="California">
<city name="Santa Monica">
<location id="2" venue_id="1" category="Hotel" name="Example Hotel" address="3214 Wilshire Blvd." zipcode="90404"/>
<location id="3" venue_id="2" category="Airport" name="Santa Monica Airport" address=" 3223 Donald Douglas Loop"/>
</city>
<city name="Los Angeles">
<location id="4" venue_id="3" category="wwan" name="Cell Carrier GPRS Network" address="Entire LA Metro Area"/>
</city>
<city name="San Diego">
<location id="5" venue_id="1" category="Hotel" name="Mike Hotel" address="3214 Mike Blvd." zipcode="90414"/>
<location id="6" venue_id="2" category="Airport" name="John Airport" address=" 3223 john Douglas Loop S Ste 3"/>
<location id="7" venue_id="1" category="Cafe" name="New Hotel" address="3214 New Scott Blvd." zipcode="90434"/>
<location id="8" venue_id="2" category="Bar" name="New Airport" address=" 3223 New Douglas Loop S Ste 4"/>
</city>
</state>
<state name="Colorado">
<city name="Colorado Springs">
<location id="2" venue_id="1" category="Hotel" name="Example Hotel" address="3214 El Paso Blvd." zipcode="90404"/>
<location id="3" venue_id="2" category="Airport" name="Colorado Springs Airport" address=" 3223 Airport Drive"/>
</city>
<city name="Denver">
<location id="4" venue_id="3" category="wwan" name="Cell Carrier GPRS Network" address="Entire COSP Metro Area"/>
</city>
</state>
</country>
</locations>
</updates>
I have no problem using XPath queries to extract the values to populate the Country, State, and City comboboxes; each selection drives the data in the subsequent combobox. Upon selection in the City combobox, I can query for a resulting set of 'locations'. My problem is how to stuff this XmlNodeList into a DataSet which I can then use with my DataGrid. I have no problem reading an entire document into a DataSet
DataSet ds = new DataSet();
ds.ReadXml("Test.Search.xml");
but have no idea how to stuff an XmlNodeList into one.
Thanks.
Jack80918
|
|
|
|
|
As you probably already know, an XmlNodeList is really a collection XmlNode s. You have mentioned you can read an XML document directly into a DataSet . So, I can give you a some suggestions.
1. You can create an XmlDocument populating it with XmlNode s cloned from the XmlNodeList .
2. You can create an XmlDocument using XSLT with the same criteria you used to create the XmlNodeList .
3. You can create a DataTable (or DataTable s) that corresponds to your XmlNodeList and extract data from your XmlNode s into the appropriate rows and columns.
There are certainly other ways of doing this. So, search the web for ideas or just be creative.
"We make a living by what we get, we make a life by what we give." --Winston Churchill
|
|
|
|
|
I tried to apply data islands to ordered list. But it is not working. I checked the data islands in table. It is working correctly. Please let me know why it is not working on ordered list?
Thanks and Regards,
Hogan
|
|
|
|
|
hogan.smith wrote: Please let me know why it is not working on ordered list?
That might be possible Hogan, but at least for me I require more specific information.
What does "apply data island to ordered list" mean?
What does "it is not working" mean?
|
|
|
|
|
Hi mike,
Thanks for reply. I tried to load data into an ordered list from an xml file.
Content of test.xml file.
<?xml version="1.0" encoding="utf-8"?>
<menu>
<node>
<name>Link 1</name>
<link>link1.htm</link>
</node>
<node>
<name>Link 2</name>
<link>link2.htm</link>
</node>
<node>
<name>Link 3</name>
<link>link3.htm</link>
</node>
<node>
<name>Link 4</name>
<link>link4.htm</link>
</node>
<node>
<name>Link 5</name>
<link>link5.htm</link>
</node>
</menu>
Html code
<html>
<head>
</head>
<body>
<xml id="menu" src="test.xml"></xml>
<ol datasrc="#menu">
<li><span datafld="name"></span></li>
</ol>
</body>
</html>
Thanks and regards,
Hogan
|
|
|
|
|
Hi,
could you please recommend me a free XSLT files generator?
Thank you in advance
|
|
|
|
|
Yoyosch wrote: could you please recommend me a free XSLT files generator?
try using Yoyosch
|
|
|
|
|
|
led mike believes you are capable of creating XSLT code after studying XSLT syntax. As far as the existense of free XSLT generator software, I haven't had any reason to look for that. However, XSLT is just XML, and can be created as you would an XML document. IMHO, XSLT generator software would be for a special purpose.
"We make a living by what we get, we make a life by what we give." --Winston Churchill
|
|
|
|
|
Where can i get open source code for Media RSS 2.0 parser?
I want the output to be generated in XML format by passing url of type Media RSS 2.0.
For this where can i get open source code?
Rajshri
|
|
|
|
|
hi everyone ..i m working on one zoo project ..so i need some information .. i want 2 create xml file as a database and i want 2 insert data ,delete data,and update .. in xml database plzz can any one tell how it ll do?? in using C# code..
thanks 2 all..
|
|
|
|
|
Insert and delete are pretty simple methods. U just need to access proper node with the help of Xpath query.
Post ur specific question if u have any...
|
|
|
|
|
can u provide insert and delete code..plz...
thanks 2 all..
|
|
|
|
|
|
Check This Out...It will work out...
Protected Sub GridView1_RowUpdating(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewUpdateEventArgs) Handles GridView1.RowUpdating
Dim i As Integer = GridView1.Rows(e.RowIndex).DataItemIndex
Dim strId As String = CType(GridView1.Rows(e.RowIndex).Cells(2).Controls(0), TextBox).Text
Dim strName As String = CType(GridView1.Rows(e.RowIndex).Cells(3).Controls(0), TextBox).Text
GridView1.EditIndex = -1
BindGrid()
' Update the XML file using the new values
Dim oDs As Data.DataSet = GridView1.DataSource
oDs.Tables(0).Rows(i).Item(0) = strId
oDs.Tables(0).Rows(i).Item(1) = strName
oDs.WriteXml(Request.PhysicalApplicationPath + "books.xml")
BindGrid()
End Sub
Protected Sub GridView1_RowDeleting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewDeleteEventArgs) Handles GridView1.RowDeleting
BindGrid()
Dim oDs As Data.DataSet = GridView1.DataSource
oDs.Tables(0).Rows(GridView1.Rows(e.RowIndex).DataItemIndex).Delete()
oDs.WriteXml(Request.PhysicalApplicationPath + "books.xml")
BindGrid()
End Sub
Protected Sub GridView1_RowCancelingEdit(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewCancelEditEventArgs) Handles GridView1.RowCancelingEdit
GridView1.EditIndex = -1
BindGrid()
End Sub
Protected Sub GridView1_RowEditing(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewEditEventArgs) Handles GridView1.RowEditing
GridView1.EditIndex = e.NewEditIndex
BindGrid()
End Sub
Protected Sub GridView1_PageIndexChanging(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewPageEventArgs) Handles GridView1.PageIndexChanging
GridView1.PageIndex = e.NewPageIndex
BindGrid()
End Sub
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Page.IsPostBack = False Then
BindGrid()
End If
End Sub
Sub BindGrid()
Dim oDs As New Data.DataSet
oDs.ReadXml(Request.PhysicalApplicationPath + "books.xml")
GridView1.DataSource = oDs
GridView1.DataBind()
End Sub
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
If txtId.Text = "" Or txtName.Text = "" Then
MsgBox("A Value Is Required...!")
Else
BindGrid()
Dim oDs As Data.DataSet = GridView1.DataSource
Dim oDr As Data.DataRow = oDs.Tables(0).NewRow
oDr("Name") = txtId.Text
oDr("Author") = txtName.Text
oDs.Tables(0).Rows.Add(oDr)
oDs.WriteXml(Request.PhysicalApplicationPath + "books.xml")
BindGrid()
txtId.Text = ""
txtName.Text = ""
txtId.Focus()
End If
End Sub
Regards
Abhishek,Nanda
|
|
|
|
|
|
Please try with mozilla firefox.
Regards,
Bala.
|
|
|
|
|
hi guys,
I want to do verify xml file on scema file. For this purpose i've to design xsl file which take two documents as input 1 is xml and 2nd is xsd.
can anyone help me in this regard?
|
|
|
|
|
Is there any built-in classes of ASP.NET 2.0 similar to the ConfigurationManager to be able to access a custom config file (similar to web.config) without having write a process to read in the xml and handle the nodes?
|
|
|
|
|
We have a number of dev and test SQL Servers (2005) and I would like a more structured and manageable way to setup access/security on these test/dev servers. Currently, it's a time-consuming process because I generally have to manually setup whatever Logins/Security the developers want in test/dev on an ad-hoc basis. Sometimes it's a combination of copying Logins from production and creating test specific logins/security. When the test db's get refreshed/restored, I often end up having to start again - although I try to get the developers to script out the test environment specific security stuff.
I was wondering if I could write/buy a utility, like an ASP.NET app that helped developers to input the required Logins, access and so on into a form and have the app save this info as an XML file. The XML file could then in turn be used as in input into another ASP.NET app using SMO to apply the security model defined in the XML file. It would also be necessary to be able to point the app at an existing server, production for example, and generate a template - ie. populate the XML file with that server's Logins, db access, schema info (db owner), db roles, role membership and permissions.
I can code this up if necessary and SMO should gve me what I want. However, given that someone else might have already done this, maybe I could save myself a lot of time and effort. Thoughts or suggestions?
|
|
|
|
|
i want example code for creating table using xml
p.ayyapa swamy
|
|
|
|
|
|
|
Colleagues,
I’m brand new to XML. I’m using VB6 and DOM to write an XML log file. (I have to use VB6, because I’m retrofitting a legacy application.) Each log entry has 3 layers of nesting and about 20 nodes. I want to avoid pain of creating every new entry node-by-node. I’m looking for a way to create a new blank log entry efficiently (in terms of required amount of code). I have some ideas, but how do the big kids do it?
-Nick
P.S. I know Java and C++, so if you have examples in other languages, please post them; I can translate them to VB6.
-- modified at 15:52 Wednesday 21st November, 2007
|
|
|
|