|
I have one node that contain number say NoofMonth
and one node that contain AmountPerMonth
now
i want to display based on no of months that amount
like if NoofMOnth =5
Amountpermonth=100
then i want to display 100 100 100 100 100
for(i=NoofMonth;i>0;i--)
{
<xsl:value-of select="Amountpermonth">}
how to using XSL
Nishant
|
|
|
|
|
You can't do that with xsl:for-each, as that'll only loop over a node-set.
Easiest way would be to use a recursive template:
{in your main template}
<xsl:call-template name="DoAMonth">
<xsl:with-param name="Count" select="NoofMonth"/>
<xsl:with-param name="What" select="AmountPerMonth"/>
</xsl:call-template>
{rest of your main template}
<xsl:template name="DoAMonth">
<xsl:param name="Count"/>
<xsl:param name="What"/>
<xsl:if test="$Count>0">
<td><xsl:value-of select="$What"/></td>
<xsl:call-template name="DoAMonth">
<xsl:with-param name="Count" select="$Count-1"/>
<xsl:with-param name="What" select="$What"/>
</xsl:call-template>
</xsl:if>
</xsl:template>
Stuart Dootson
'Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p'
|
|
|
|
|
Below is the sample xml analgous to mine,
"=============
<code><INVENTORY>
<BRANCH CODE='BC1'...>
<DEPTS>
<DEPT CODE='DC1'>
<EMP NAME='A' ...>
<EMP NAME='B' ...>
</DEPT>
<DEPT CODE='DC2'>
<EMP NAME='E' ...>
<EMP NAME='F' ...>
</DEPT>
</DEPTS>
</BRANCH>
<BRANCH CODE='BC2'>
...
</BRANCH>
</INVENTORY>
</code>==========="
Now, I am trying write a function which says an employee with name xxx belongs to Dept xxx or not? taking two parameters, <code>DEPT_NODE</code> and <code>EMPNAME</code> as parameters. I can not change the signature as its from top.
how to write an Xpath query for that?
Thanks for anticipation.
Regards.
MaulikCE
<pre></pre>
i don want
|
|
|
|
|
bool isInDepartment( string department, string employee );
XpathDocument doc= new XPathDocument();
doc.Load( ... );
XPathExpression exp = new XPathExpression( string.format("//DEPT[@name={0}]/EMP[@name={1}]", department, employee) );
return !( null == doc.SelectSingleNode( exp ) );
Or better take a look at SelectSingleNode[^].
Never forget: "Stay kul and happy" (I.A.)
David's thoughts / dnhsoftware.org / MyHTMLTidy
|
|
|
|
|
Thanks David,
My requirement is little different, I have reference to DEPT node so I have to search relatively from DEPT as other branches may also have same departments.
In terms of code,
bool isInDepartment( XmlElement eleDept, string employee );
What could be the XPath query for this?
|
|
|
|
|
If you can't work out your xpath from the help dnh gave you, then I really suggest you go and buy an xml book and read it. At the very least, run through the w3schools tutorial http://www.w3schools.com/xpath/default.asp, which will take you all of 5 minutes, rather than want someone else to write your code for you.
using System.Beer;
|
|
|
|
|
Hi Friends,
I want to display the following xml data in datagrid using dataset and dataview and to add new account and update existing account using dataset and dataview.
Can any plz help regarding this????
<Account>
<AccountNo>1241111</AcountNo>
<HolderName> james smith </Holdername>
<HolderAddress>
<StreenNo>12th main</StreetNo>
<Area>Koramangala</Area>
<City>Bangalore</City>
</HolderAddress>
<HolderPanNo>12514711-55</HolderPanNo>
<HolderStatus cheque="No">
<Balance>500000</Balance>
<Credit>1500000</Credit>
</HolderStatus>
</Account>
Thank all of u in advance
|
|
|
|
|
hii all;
i got a very serious problem.
there is two processes that access (read/wite) xml in same time how can i control this without exceptions,with good preformance.
marcoryos
|
|
|
|
|
If they read and write the same file at the same time, they can't do that at all.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
What about these processes? Do you have theirs source code??
... she said you are the perfect stranger she said baby let's keep it like this... Tunnel of Love, Dire Straits.
|
|
|
|
|
Hey
I used anchor element in xsl page, What i faced is only one value is passed at a time. How can i pass multiple values in querystring & How can i append the values to the querystring. I used xsl variables, but i can't get the multiple values. [Datas are retrived from XML Document ]
Aravind
|
|
|
|
|
i don't know.if u know .plz inform to stu_cs@yahoo.com
|
|
|
|
|
Hi friens:
Can you tell me how include a picture in a web service ?????
Thanks a lot
|
|
|
|
|
The image needs to be serialised and send as a CDATA tag.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Dear Friends,
I have and XML File and am binding that xml file to a datagrid using dataview with a check box to select the row to update or delete.
In the event of check box I used to find row from dataview using sort property and find() method.
But I got the row number more than one than the actual one.
e.g. when I got rowno = 1 as a result of find method, in dataview that row is actually at postition 0. so every time next row of the actual row is deleted or modified.
So if anyone have the solution of this then plz send it to me quickly .
Thanking u in advance
Chetan Ranpariya
|
|
|
|
|
I have brand new ATL attributed dll project.
I just downloaded and installed MSXML4 SP2.
I insert "c:\program files\msxml 4.0\inc\msxml2.h" - which is the just iknstalled msxml sdk.
Build and get 39 errors that say I have pretty much everything redefined.
I know there is that known issue with XML_ERROR and I inserted the IMPORTED_MSXML macro but I still get everything else redefined. What's wrong?! Anyone?! Please help!
Here is the whole dump:
Deleting intermediate files and output files for project 'TryMSXML', configuration 'Debug|Win32'.
Compiling...
stdafx.cpp
Compiling...
TryMSXML.cpp
Compiling resources...
Linking...
Creating library Debug/TryMSXML.lib and object Debug/TryMSXML.exp
Microsoft (R) 32b/64b MIDL Compiler Version 6.00.0361
Copyright (c) Microsoft Corporation 1991-2002. All rights reserved.
Processing .\_TryMSXML.idl
_TryMSXML.idl
Processing C:\MVS.NET\Vc7\PlatformSDK\include\prsht.idl
prsht.idl
Processing C:\MVS.NET\Vc7\PlatformSDK\include\wtypes.idl
wtypes.idl
Processing C:\MVS.NET\Vc7\PlatformSDK\include\basetsd.h
basetsd.h
Processing C:\MVS.NET\Vc7\PlatformSDK\include\guiddef.h
guiddef.h
Processing C:\MVS.NET\Vc7\PlatformSDK\include\mshtml.idl
mshtml.idl
Processing C:\MVS.NET\Vc7\PlatformSDK\include\ocidl.idl
ocidl.idl
Processing C:\MVS.NET\Vc7\PlatformSDK\include\oleidl.idl
oleidl.idl
Processing C:\MVS.NET\Vc7\PlatformSDK\include\objidl.idl
objidl.idl
Processing C:\MVS.NET\Vc7\PlatformSDK\include\unknwn.idl
unknwn.idl
Processing C:\MVS.NET\Vc7\PlatformSDK\include\oaidl.idl
oaidl.idl
Processing C:\MVS.NET\Vc7\PlatformSDK\include\servprov.idl
servprov.idl
Processing C:\MVS.NET\Vc7\PlatformSDK\include\urlmon.idl
urlmon.idl
Processing C:\MVS.NET\Vc7\PlatformSDK\include\msxml.idl
msxml.idl
Processing C:\MVS.NET\Vc7\PlatformSDK\include\dimm.idl
dimm.idl
Processing C:\MVS.NET\Vc7\PlatformSDK\include\mshtmhst.idl
mshtmhst.idl
Processing C:\MVS.NET\Vc7\PlatformSDK\include\docobj.idl
docobj.idl
Processing C:\MVS.NET\Vc7\PlatformSDK\include\exdisp.idl
exdisp.idl
Processing C:\MVS.NET\Vc7\PlatformSDK\include\objsafe.idl
objsafe.idl
Processing C:\MVS.NET\Vc7\PlatformSDK\include\msxml2.idl
msxml2.idl
C:\MVS.NET\Vc7\PlatformSDK\include\msxml2.idl(186) : error MIDL2003 : redefinition : NODE_INVALID
C:\MVS.NET\Vc7\PlatformSDK\include\msxml2.idl(187) : error MIDL2003 : redefinition : NODE_ELEMENT
C:\MVS.NET\Vc7\PlatformSDK\include\msxml2.idl(188) : error MIDL2003 : redefinition : NODE_ATTRIBUTE
C:\MVS.NET\Vc7\PlatformSDK\include\msxml2.idl(189) : error MIDL2003 : redefinition : NODE_TEXT
C:\MVS.NET\Vc7\PlatformSDK\include\msxml2.idl(190) : error MIDL2003 : redefinition : NODE_CDATA_SECTION
C:\MVS.NET\Vc7\PlatformSDK\include\msxml2.idl(191) : error MIDL2003 : redefinition : NODE_ENTITY_REFERENCE
C:\MVS.NET\Vc7\PlatformSDK\include\msxml2.idl(192) : error MIDL2003 : redefinition : NODE_ENTITY
C:\MVS.NET\Vc7\PlatformSDK\include\msxml2.idl(193) : error MIDL2003 : redefinition : NODE_PROCESSING_INSTRUCTION
C:\MVS.NET\Vc7\PlatformSDK\include\msxml2.idl(194) : error MIDL2003 : redefinition : NODE_COMMENT
C:\MVS.NET\Vc7\PlatformSDK\include\msxml2.idl(195) : error MIDL2003 : redefinition : NODE_DOCUMENT
C:\MVS.NET\Vc7\PlatformSDK\include\msxml2.idl(196) : error MIDL2003 : redefinition : NODE_DOCUMENT_TYPE
C:\MVS.NET\Vc7\PlatformSDK\include\msxml2.idl(197) : error MIDL2003 : redefinition : NODE_DOCUMENT_FRAGMENT
C:\MVS.NET\Vc7\PlatformSDK\include\msxml2.idl(199) : error MIDL2003 : redefinition : NODE_NOTATION
C:\MVS.NET\Vc7\PlatformSDK\include\msxml2.idl(199) : error MIDL2003 : redefinition : tagDOMNodeType
C:\MVS.NET\Vc7\PlatformSDK\include\msxml2.idl(443) : error MIDL2003 : redefinition : IXMLDOMDocument
C:\MVS.NET\Vc7\PlatformSDK\include\msxml2.idl(745) : error MIDL2003 : redefinition : IXMLDOMNodeList
C:\MVS.NET\Vc7\PlatformSDK\include\msxml2.idl(855) : error MIDL2003 : redefinition : IXMLDOMNamedNodeMap
C:\MVS.NET\Vc7\PlatformSDK\include\msxml2.idl(932) : error MIDL2003 : redefinition : IXMLDOMDocumentFragment
C:\MVS.NET\Vc7\PlatformSDK\include\msxml2.idl(946) : error MIDL2003 : redefinition : IXMLDOMCharacterData
C:\MVS.NET\Vc7\PlatformSDK\include\msxml2.idl(1021) : error MIDL2003 : redefinition : IXMLDOMAttribute
C:\MVS.NET\Vc7\PlatformSDK\include\msxml2.idl(1054) : error MIDL2003 : redefinition : IXMLDOMElement
C:\MVS.NET\Vc7\PlatformSDK\include\msxml2.idl(1127) : error MIDL2003 : redefinition : IXMLDOMText
C:\MVS.NET\Vc7\PlatformSDK\include\msxml2.idl(1147) : error MIDL2003 : redefinition : IXMLDOMComment
C:\MVS.NET\Vc7\PlatformSDK\include\msxml2.idl(1161) : error MIDL2003 : redefinition : IXMLDOMProcessingInstruction
C:\MVS.NET\Vc7\PlatformSDK\include\msxml2.idl(1191) : error MIDL2003 : redefinition : IXMLDOMCDATASection
C:\MVS.NET\Vc7\PlatformSDK\include\msxml2.idl(1205) : error MIDL2003 : redefinition : IXMLDOMDocumentType
C:\MVS.NET\Vc7\PlatformSDK\include\msxml2.idl(1236) : error MIDL2003 : redefinition : IXMLDOMNotation
C:\MVS.NET\Vc7\PlatformSDK\include\msxml2.idl(1261) : error MIDL2003 : redefinition : IXMLDOMEntity
C:\MVS.NET\Vc7\PlatformSDK\include\msxml2.idl(1292) : error MIDL2003 : redefinition : IXMLDOMEntityReference
C:\MVS.NET\Vc7\PlatformSDK\include\msxml2.idl(1305) : error MIDL2003 : redefinition : IXMLDOMImplementation
C:\MVS.NET\Vc7\PlatformSDK\include\msxml2.idl(1327) : error MIDL2003 : redefinition : IXTLRuntime
C:\MVS.NET\Vc7\PlatformSDK\include\msxml2.idl(1401) : error MIDL2003 : redefinition : IXMLDOMParseError
C:\MVS.NET\Vc7\PlatformSDK\include\msxml2.idl(1444) : error MIDL2003 : redefinition : XMLDOMDocumentEvents
C:\MVS.NET\Vc7\PlatformSDK\include\msxml2.idl(1576) : error MIDL2003 : redefinition : IXMLHTTPRequest
C:\MVS.NET\Vc7\PlatformSDK\include\msxml2.idl(3336) : error MIDL2003 : redefinition : IXMLDocument2
C:\MVS.NET\Vc7\PlatformSDK\include\msxml2.idl(3392) : error MIDL2003 : redefinition : IXMLElement2
C:\MVS.NET\Vc7\PlatformSDK\include\msxml2.idl(3418) : error MIDL2003 : redefinition : IXMLAttribute
C:\MVS.NET\Vc7\PlatformSDK\include\msxml2.idl(3453) : error MIDL2003 : redefinition : DOMDocument
|
|
|
|
|
Hi,
I was wondering if anyone could tell me if it is possible to write a xml program that would upload documents via HTTPS to a server. Is this possible?. If so please can someone explain how i would have to do this.
Thanks
Thanks
J
|
|
|
|
|
|
Hi,
I see that Loading and Iterating huge XML file using DOM is slow on Win2003SP1. Any idea why ? Is there any solution ?
I am using MSXML3.dll ver 8.10.8308.0 .I modified sample Books.xml to add 2000 more nodes. I wrote simple App in VC++ 6.0 to load books.xml and iterated through all the elements. I executed this on both Win2000-Sp4 and Win2003-Sp1. I see that on Win2003Sp1 its takes more time compared to Windows 2000 Sp4. Please comment on this.
Thanks
Sandeep Naik
|
|
|
|
|
Hi,
I am trying to load the following XML through MSXML4 APIs. But it does not load. It says "Reference to undeclared namespace prefix 'ns0'".
The code is:
CComBSTR bstrXML = "<ns0:name>Arun</ns0:name>";<br />
MSXML2::IXMLDOMDocumentPtr pDoc(__uuidof(MSXML2::DOMDocument30));<br />
VARIANT_BOOL b1 = pDoc->loadXML(bstrXML.m_str);
Could anyone tell me how to resolve this ?
Thanks in advance,
Arun.
|
|
|
|
|
I couldn't replicate it but i'd try:
- Change DOMDocument30 to DOMDocument40 if you don't have a good reason to not to do it.
- Have you added using namespace MSXML2;
Marc Soleda.
... she said you are the perfect stranger she said baby let's keep it like this... Tunnel of Love, Dire Straits.
|
|
|
|
|
I have a word document that i can show it in HTML form , but i wana to show all details on my word document such as PARAGRAPH , TITR , SPACES , how can i do this ?
i test SAVE AS XML , but i think it must be eisier way to show these details , HELP ME BY SAMPLE
i think i dont explain it well , i know i can see it with View menu , but i wana process this word document , so i must first process it , i can do it also , after processing , some sentence of this text change to some links , and some of them not !!! , THEN AFTER THESE PROCESS I WANA SHOW IT IN ASP FORM , but with paragraph , titrs , headers , footer !! how can i do this ???
thanks for helping me in this confused case !!!!
Have good day and time
|
|
|
|
|
AWAIS_YAR@YAHOO.COM
AWAis_yar@hotmail.com
Hi all
I am preparing a xml to access db project in vb.net. which does the following
1) open dynamic access file in vb.net [done it]
2) create its xml file[done it]
3) again transform this xml file to mdb database file through vb.net[creating problem]
I have tried many options but
here is the xml file[which i am trying to update in MS Access Database through VB.NET]
<newdataset>
<xs:schema id="NewDataSet" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xs:element name="NewDataSet" msdata:isdataset="true">
<xs:complextype>
<xs:choice maxoccurs="unbounded">
<xs:element name="Employees">
<xs:complextype>
<xs:sequence>
<xs:element name="EmployeeId" type="xs:short" minoccurs="0">
<xs:element name="EmployeeName" type="xs:string" minoccurs="0">
<xs:element name="Address" type="xs:string" minoccurs="0">
<xs:element name="City" type="xs:string" minoccurs="0">
<employees>
<employeeid>1
<employeename>awais
393 gg phase 4
<city>lahore
<employees>
<employeeid>2
<employeename>junaid
205 d phase 2
<city>lahore
<employees>
<employeeid>3
<employeename>ali
345
<city>lahore
<employees>
<employeeid>4
<employeename>mmm
999
<city>lahore
what i am doing is load mdb file through this code[get dynamically its tables and columns]
Imports Sdo = System.Data.OleDb
Imports System.Data.OleDb
Imports System.Xml
Private Sub btnLoad_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLoad.Click
OpnFlDlg1.ShowDialog()
Try
If Len(OpnFlDlg1.FileName) > 0 Then
Cn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & OpnFlDlg1.FileName & ""
Cn.Open()
btnImport.Enabled = True
Dim schemaTable As Data.DataTable = Cn.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, New Object() {Nothing, Nothing, Nothing, "TABLE"})
For Each row As DataRow In schemaTable.Rows
Dim TableName As String = row("TABLE_NAME").ToString
Dim DA As OleDbDataAdapter = New OleDbDataAdapter("Select * From [" + TableName + "]", Cn)
DS.Tables.Add(TableName)
DA.FillSchema(DS, SchemaType.Source, TableName)
Next
For Each dt In DS.Tables
CmbTables.Items.Add(dt.TableName)
Me.CmbTables.SelectedIndex = 0
Next
End If
Catch ex As Exception
MsgBox("Error Connecting/Schema Loading : " & ex.Message, MsgBoxStyle.Information, "Error")
End Try
End Sub
Private Sub xml_2_Db_Closing(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase.Closing
If MsgBox("Are You Sure To Quit Application", MsgBoxStyle.Information + MsgBoxStyle.YesNo, "Information About Quitting Application") = MsgBoxResult.Yes Then
e.Cancel = False
Else
e.Cancel = True
End If
Try
Cn.Close()
Cm.Connection.Close()
dsAccess = Nothing
Cn = Nothing
Cm = Nothing
Catch ex As Exception
MsgBox("Error Closing" & ex.Message, MsgBoxStyle.Information, "Error Closing")
End Try
End Sub
problem lies in this Import Button click methid when i am importing file to mdb
Private Sub btnImport_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnImport.Click
Try
Cm.Connection = Cn
Cm.CommandText = "delete from " & CmbTables.SelectedItem & ""
Cm.CommandType = CommandType.Text
Cm.ExecuteNonQuery()
dsAccess.Clear()
Dim daxml As New Sdo.OleDbDataAdapter("select * from " & CmbTables.SelectedItem & "", Cn)
'FILLING VALUES FROM XML FILE TO DATAGRID
dsAccess.ReadXml("c:\" & CmbTables.SelectedItem & ".xml", XmlReadMode.ReadSchema)
daxml.Fill(dsAccess, "" & CmbTables.SelectedItem & "")
DataGrid1.DataSource = dsAccess.DefaultViewManager
'FILLING VALUES FROM XML FILE TO EXCEL FILE
Try
Dim stream As FileStream = File.Open("C:\" & CmbTables.SelectedItem & ".xml", FileMode.Open)
Dim output As FileStream = File.Create("output3.txt")
Dim writer As StreamWriter = New StreamWriter(output)
Dim dataset As DataSet = New DataSet
Dim xx As Integer
Dim StrQuery As String
Dim xLoopCount As Int16
dataset.ReadXml(stream)
For Each dc As Data.DataColumn In dt.Columns
xLoopCount += 1
'MAKE STRING FROM COLUMN NAMES FOR INSERT QUERY
'writer.WriteLine("ID: {0}", row("ID"))
'writer.WriteLine("Text: {0}", row("Text"))
'writer.WriteLine("VarChar: {0}", row("VarChar"))
'writer.WriteLine("Data: {0}", row("Data"))
'If dc.DataType.ToString = "System.INT32" Or dc.DataType.ToString = "System.Int16" Or dc.DataType.ToString = "System.DateTime" Or dc.DataType.ToString = "System.Decimal" Or dc.DataType.ToString = "System.Float" Then
' If xLoopCount <> CountCol Then
' StrQuery += "row(" & "" & dc.ColumnName & "" & "),"
' Else
' StrQuery += "row(" & "" & dc.ColumnName & "" & ")"
' End If
' MsgBox(dc.DataType.ToString)
'ElseIf dc.DataType.ToString = "System.String" Then
' MsgBox(dc.DataType.ToString)
' If xLoopCount <> CountCol Then
' StrQuery += "row(" & "'" & dc.ColumnName & "'" & ") ,"
' Else
' StrQuery += "row(" & "'" & dc.ColumnName & "'" & ") "
' End If
'End If
Next
MsgBox(StrQuery)
'writing each table/column in database
Dim ss As Int16 = 0
'For Each table As Data.DataTable In dsAccess.Tables
'SELECT TABLE FROM SELECTED COMBO BOX & INSERT QUERY FROM ABOVE AND DATA FROM FILETEXT OR EXCEL
For Each table As Data.DataTable In dataset.Tables
For Each row As DataRow In table.Rows
writer.Write("{0}*", row("TrnId"))
writer.Write("{0}*", row("TrnDate"))
writer.Write("{0}*", row("EmployeeId"))
writer.Write("{0}#", row("Salary"))
Next
Next
'ss += 1
'Cm.Connection = Cn
'Cm.CommandText = "Insert Into " & CmbTables.SelectedItem & " values(" & StrQuery & ")"
'Cm.CommandText = "Insert Into " & CmbTables.SelectedItem & " values(" & ss & ",'2006-03-02','53','32.33')"
'MsgBox(Cm.CommandText)
'Cm.CommandType = CommandType.Text
'Cm.ExecuteNonQuery()
stream.Close()
writer.Close()
output.Close()
MsgBox("complete")
Exit Sub
Catch ex As Exception
MsgBox(ex.ToString)
End Try
MsgBox("success Xml Written to Db")
Catch ex As Exception
MsgBox("Error Updating : " & ex.Message, MsgBoxStyle.Information, "Error")
End Try
End Sub
also this method is not getting column names in combo box onItem Change Method
Private Sub CmbTables_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles CmbTables.SelectedIndexChanged
CmbColumns.Items.Clear()
CountCol = 0
For Each dc As Data.DataColumn In dt.Columns
CmbColumns.Items.Add(dc.ColumnName)
CmbColumns.SelectedIndex = 0
CountCol += 1
Next
End Sub
plz help ...............URGENT.....
REGARDS
A.W
" rel="nofollow">http://www.kdkeys.net/msgs/default.aspx?MessageID=48
Hi John
I am preparing for MCAD Papers . and have assignment to get
1) open dynamic access file in vb.net [done it]
2) create its xml file[done it]
3) again transform this xml file to mdb database file through vb.net[creating problem]
I have tried many options but
here is the xml file[which i am trying to update in MS Access Database through VB.NET]
<newdataset>
<xs:schema id="NewDataSet" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xs:element name="NewDataSet" msdata:isdataset="true">
<xs:complextype>
<xs:choice maxoccurs="unbounded">
<xs:element name="Employees">
<xs:complextype>
<xs:sequence>
<xs:element name="EmployeeId" type="xs:short" minoccurs="0">
<xs:element name="EmployeeName" type="xs:string" minoccurs="0">
<xs:element name="Address" type="xs:string" minoccurs="0">
<xs:element name="City" type="xs:string" minoccurs="0">
<employees>
<employeeid>1
<employeename>awais
393 gg phase 4
<city>lahore
<employees>
<employeeid>2
<employeename>junaid
205 d phase 2
<city>lahore
<employees>
<employeeid>3
<employeename>ali
345
<city>lahore
<employees>
<employeeid>4
<employeename>mmm
999
<city>lahore
what i am doing is load mdb file through this code[get dynamically its tables and columns]
Imports Sdo = System.Data.OleDb
Imports System.Data.OleDb
Imports System.Xml
Private Sub btnLoad_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLoad.Click
OpnFlDlg1.ShowDialog()
Try
If Len(OpnFlDlg1.FileName) > 0 Then
Cn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & OpnFlDlg1.FileName & ""
Cn.Open()
btnImport.Enabled = True
Dim schemaTable As Data.DataTable = Cn.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, New Object() {Nothing, Nothing, Nothing, "TABLE"})
For Each row As DataRow In schemaTable.Rows
Dim TableName As String = row("TABLE_NAME").ToString
Dim DA As OleDbDataAdapter = New OleDbDataAdapter("Select * From [" + TableName + "]", Cn)
DS.Tables.Add(TableName)
DA.FillSchema(DS, SchemaType.Source, TableName)
Next
For Each dt In DS.Tables
CmbTables.Items.Add(dt.TableName)
Me.CmbTables.SelectedIndex = 0
Next
End If
Catch ex As Exception
MsgBox("Error Connecting/Schema Loading : " & ex.Message, MsgBoxStyle.Information, "Error")
End Try
End Sub
Private Sub xml_2_Db_Closing(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase.Closing
If MsgBox("Are You Sure To Quit Application", MsgBoxStyle.Information + MsgBoxStyle.YesNo, "Information About Quitting Application") = MsgBoxResult.Yes Then
e.Cancel = False
Else
e.Cancel = True
End If
Try
Cn.Close()
Cm.Connection.Close()
dsAccess = Nothing
Cn = Nothing
Cm = Nothing
Catch ex As Exception
MsgBox("Error Closing" & ex.Message, MsgBoxStyle.Information, "Error Closing")
End Try
End Sub
problem lies in this Import Button click methid when i am importing file to mdb
Private Sub btnImport_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnImport.Click
Try
Cm.Connection = Cn
Cm.CommandText = "delete from " & CmbTables.SelectedItem & ""
Cm.CommandType = CommandType.Text
Cm.ExecuteNonQuery()
dsAccess.Clear()
Dim daxml As New Sdo.OleDbDataAdapter("select * from " & CmbTables.SelectedItem & "", Cn)
'FILLING VALUES FROM XML FILE TO DATAGRID
dsAccess.ReadXml("c:\" & CmbTables.SelectedItem & ".xml", XmlReadMode.ReadSchema)
daxml.Fill(dsAccess, "" & CmbTables.SelectedItem & "")
DataGrid1.DataSource = dsAccess.DefaultViewManager
'FILLING VALUES FROM XML FILE TO EXCEL FILE
Try
Dim stream As FileStream = File.Open("C:\" & CmbTables.SelectedItem & ".xml", FileMode.Open)
Dim output As FileStream = File.Create("output3.txt")
Dim writer As StreamWriter = New StreamWriter(output)
Dim dataset As DataSet = New DataSet
Dim xx As Integer
Dim StrQuery As String
Dim xLoopCount As Int16
dataset.ReadXml(stream)
For Each dc As Data.DataColumn In dt.Columns
xLoopCount += 1
'MAKE STRING FROM COLUMN NAMES FOR INSERT QUERY
'writer.WriteLine("ID: {0}", row("ID"))
'writer.WriteLine("Text: {0}", row("Text"))
'writer.WriteLine("VarChar: {0}", row("VarChar"))
'writer.WriteLine("Data: {0}", row("Data"))
'If dc.DataType.ToString = "System.INT32" Or dc.DataType.ToString = "System.Int16" Or dc.DataType.ToString = "System.DateTime" Or dc.DataType.ToString = "System.Decimal" Or dc.DataType.ToString = "System.Float" Then
' If xLoopCount <> CountCol Then
' StrQuery += "row(" & "" & dc.ColumnName & "" & "),"
' Else
' StrQuery += "row(" & "" & dc.ColumnName & "" & ")"
' End If
' MsgBox(dc.DataType.ToString)
'ElseIf dc.DataType.ToString = "System.String" Then
' MsgBox(dc.DataType.ToString)
' If xLoopCount <> CountCol Then
' StrQuery += "row(" & "'" & dc.ColumnName & "'" & ") ,"
' Else
' StrQuery += "row(" & "'" & dc.ColumnName & "'" & ") "
' End If
'End If
Next
MsgBox(StrQuery)
'writing each table/column in database
Dim ss As Int16 = 0
'For Each table As Data.DataTable In dsAccess.Tables
'SELECT TABLE FROM SELECTED COMBO BOX & INSERT QUERY FROM ABOVE AND DATA FROM FILETEXT OR EXCEL
For Each table As Data.DataTable In dataset.Tables
For Each row As DataRow In table.Rows
writer.Write("{0}*", row("TrnId"))
writer.Write("{0}*", row("TrnDate"))
writer.Write("{0}*", row("EmployeeId"))
writer.Write("{0}#", row("Salary"))
Next
Next
'ss += 1
'Cm.Connection = Cn
'Cm.CommandText = "Insert Into " & CmbTables.SelectedItem & " values(" & StrQuery & ")"
'Cm.CommandText = "Insert Into " & CmbTables.SelectedItem & " values(" & ss & ",'2006-03-02','53','32.33')"
'MsgBox(Cm.CommandText)
'Cm.CommandType = CommandType.Text
'Cm.ExecuteNonQuery()
stream.Close()
writer.Close()
output.Close()
MsgBox("complete")
Exit Sub
Catch ex As Exception
MsgBox(ex.ToString)
End Try
MsgBox("success Xml Written to Db")
Catch ex As Exception
MsgBox("Error Updating : " & ex.Message, MsgBoxStyle.Information, "Error")
End Try
End Sub
also this method is not getting column names in combo box onItem Change Method
Private Sub CmbTables_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles CmbTables.SelectedIndexChanged
CmbColumns.Items.Clear()
CountCol = 0
For Each dc As Data.DataColumn In dt.Columns
CmbColumns.Items.Add(dc.ColumnName)
CmbColumns.SelectedIndex = 0
CountCol += 1
Next
End Sub
plz help ...............URGENT.....
REGARDS
A.W
[
<newdataset>
<xs:schema id="NewDataSet" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xs:element name="NewDataSet" msdata:isdataset="true">
<xs:complextype>
<xs:choice maxoccurs="unbounded">
<xs:element name="Employees">
<xs:complextype>
<xs:sequence>
<xs:element name="EmployeeId" type="xs:short" minoccurs="0">
<xs:element name="EmployeeName" type="xs:string" minoccurs="0">
<xs:element name="Address" type="xs:string" minoccurs="0">
<xs:element name="City" type="xs:string" minoccurs="0">
<employees>
<employeeid>1
<employeename>awais
393 gg phase 4
<city>lahore
<employees>
<employeeid>2
<employeename>junaid
205 d phase 2
<city>lahore
<employees>
<employeeid>3
<employeename>ali
345
<city>lahore
<employees>
<employeeid>4
<employeename>mmm
999
<city>lahore
what i am doing is load mdb file through this code[get dynamically its tables and columns]
Imports Sdo = System.Data.OleDb
Imports System.Data.OleDb
Imports System.Xml
Private Sub btnLoad_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLoad.Click
OpnFlDlg1.ShowDialog()
Try
If Len(OpnFlDlg1.FileName) > 0 Then
Cn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & OpnFlDlg1.FileName & ""
Cn.Open()
btnImport.Enabled = True
Dim schemaTable As Data.DataTable = Cn.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, New Object() {Nothing, Nothing, Nothing, "TABLE"})
For Each row As DataRow In schemaTable.Rows
Dim TableName As String = row("TABLE_NAME").ToString
Dim DA As OleDbDataAdapter = New OleDbDataAdapter("Select * From [" + TableName + "]", Cn)
DS.Tables.Add(TableName)
DA.FillSchema(DS, SchemaType.Source, TableName)
Next
For Each dt In DS.Tables
CmbTables.Items.Add(dt.TableName)
Me.CmbTables.SelectedIndex = 0
Next
End If
Catch ex As Exception
MsgBox("Error Connecting/Schema Loading : " & ex.Message, MsgBoxStyle.Information, "Error")
End Try
End Sub
Private Sub xml_2_Db_Closing(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase.Closing
If MsgBox("Are You Sure To Quit Application", MsgBoxStyle.Information + MsgBoxStyle.YesNo, "Information About Quitting Application") = MsgBoxResult.Yes Then
e.Cancel = False
Else
e.Cancel = True
End If
Try
Cn.Close()
Cm.Connection.Close()
dsAccess = Nothing
Cn = Nothing
Cm = Nothing
Catch ex As Exception
MsgBox("Error Closing" & ex.Message, MsgBoxStyle.Information, "Error Closing")
End Try
End Sub
problem lies in this Import Button click methid when i am importing file to mdb
Private Sub btnImport_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnImport.Click
Try
Cm.Connection = Cn
Cm.CommandText = "delete from " & CmbTables.SelectedItem & ""
Cm.CommandType = CommandType.Text
Cm.ExecuteNonQuery()
dsAccess.Clear()
Dim daxml As New Sdo.OleDbDataAdapter("select * from " & CmbTables.SelectedItem & "", Cn)
'FILLING VALUES FROM XML FILE TO DATAGRID
dsAccess.ReadXml("c:\" & CmbTables.SelectedItem & ".xml", XmlReadMode.ReadSchema)
daxml.Fill(dsAccess, "" & CmbTables.SelectedItem & "")
DataGrid1.DataSource = dsAccess.DefaultViewManager
'FILLING VALUES FROM XML FILE TO EXCEL FILE
Try
Dim stream As FileStream = File.Open("C:\" & CmbTables.SelectedItem & ".xml", FileMode.Open)
Dim output As FileStream = File.Create("output3.txt")
Dim writer As StreamWriter = New StreamWriter(output)
Dim dataset As DataSet = New DataSet
Dim xx As Integer
Dim StrQuery As String
Dim xLoopCount As Int16
dataset.ReadXml(stream)
For Each dc As Data.DataColumn In dt.Columns
xLoopCount += 1
'MAKE STRING FROM COLUMN NAMES FOR INSERT QUERY
'writer.WriteLine("ID: {0}", row("ID"))
'writer.WriteLine("Text: {0}", row("Text"))
'writer.WriteLine("VarChar: {0}", row("VarChar"))
'writer.WriteLine("Data: {0}", row("Data"))
'If dc.DataType.ToString = "System.INT32" Or dc.DataType.ToString = "System.Int16" Or dc.DataType.ToString = "System.DateTime" Or dc.DataType.ToString = "System.Decimal" Or dc.DataType.ToString = "System.Float" Then
' If xLoopCount <> CountCol Then
' StrQuery += "row(" & "" & dc.ColumnName & "" & "),"
' Else
' StrQuery += "row(" & "" & dc.ColumnName & "" & ")"
' End If
' MsgBox(dc.DataType.ToString)
'ElseIf dc.DataType.ToString = "System.String" Then
' MsgBox(dc.DataType.ToString)
' If xLoopCount <> CountCol Then
' StrQuery += "row(" & "'" & dc.ColumnName & "'" & ") ,"
' Else
' StrQuery += "row(" & "'" & dc.ColumnName & "'" & ") "
' End If
'End If
Next
MsgBox(StrQuery)
'writing each table/column in database
Dim ss As Int16 = 0
'For Each table As Data.DataTable In dsAccess.Tables
'SELECT TABLE FROM SELECTED COMBO BOX & INSERT QUERY FROM ABOVE AND DATA FROM FILETEXT OR EXCEL
For Each table As Data.DataTable In dataset.Tables
For Each row As DataRow In table.Rows
writer.Write("{0}*", row("TrnId"))
writer.Write("{0}*", row("TrnDate"))
writer.Write("{0}*", row("EmployeeId"))
writer.Write("{0}#", row("Salary"))
Next
Next
'ss += 1
'Cm.Connection = Cn
'Cm.CommandText = "Insert Into " & CmbTables.SelectedItem & " values(" & StrQuery & ")"
'Cm.CommandText = "Insert Into " & CmbTables.SelectedItem & " values(" & ss & ",'2006-03-02','53','32.33')"
'MsgBox(Cm.CommandText)
'Cm.CommandType = CommandType.Text
'Cm.ExecuteNonQuery()
stream.Close()
writer.Close()
output.Close()
MsgBox("complete")
Exit Sub
Catch ex As Exception
MsgBox(ex.ToString)
End Try
MsgBox("success Xml Written to Db")
Catch ex As Exception
MsgBox("Error Updating : " & ex.Message, MsgBoxStyle.Information, "Error")
End Try
End Sub
also this method is not getting column names in combo box onItem Change Method
Private Sub CmbTables_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles CmbTables.SelectedIndexChanged
CmbColumns.Items.Clear()
CountCol = 0
For Each dc As Data.DataColumn In dt.Columns
CmbColumns.Items.Add(dc.ColumnName)
CmbColumns.SelectedIndex = 0
CountCol += 1
Next
End Sub
plz help ...............URGENT.....
REGARDS
A.W
" target="_blank" rel="nofollow" title="New Window">^]
|
|
|
|
|
hi,
I am trying to access the webservice by sending the SOAP request.That webservice actually allows only the valid user so it validates with the data base.I got the folloing message
<soap:body>
<soap:fault>
<soap:faultcode xmlns="urn:verizon:security:soap:authorize:code">DENIED<s
oap:faultstring>DENIED
when I tried to pass an invalid user.
If the user on my application enters the valid "id" and "password" which i will be sending to the webservice then I get the Xml which I will be parsing but if the user enters the invalid id or password then I get the error as above How do I take care of this.
What I am thinking is when I get the SOAP I will parse the SOAP response with the XMLDOCUMENT as bellow
XmlDocument xd=new XmlDocument();
xd.LoadXml(strOutputXML);
XmlNodeList JobIDNodeList=xd.GetElementsByTagName("soap:Faultcode");
but is throwing an error.
questions:
1)IS my Approach wrong
2)IF correct How can I get the data of Xml tag with attributes in it
3)Does this problem get solved if I use proxy class instead of directly parsing the SOAP,If so how.
Thanking you in advace.
Satish.
|
|
|
|
|
I writen a application on Microsoft Mobile5.0 Pocket PC.
Parts of my code as below.
I create my own ISAXXMLContentHandler implementation class, and it used to handle my XML file ("\ori.xml").
<IMG src="http://home.pchome.com.tw/funny/alger_lin/Codes/code1.JPG">
I initiate XML reader as below.
<img src="http://home.pchome.com.tw/funny/alger_lin/Codes/code2.JPG">
And my XML content handler class's constructor and destructor as below.
<img src="http://home.pchome.com.tw/funny/alger_lin/Codes/code3.JPG">
However, when I call XML reader's parseURL() function in first picture, I got an error message as below.
<img src="http://home.pchome.com.tw/funny/alger_lin/Codes/err1.JPG">
The error message's detail as below.
<img src="http://home.pchome.com.tw/funny/alger_lin/Codes/err2.JPG">
I don't know what happen? and I don't know how to solve it? Does anyone can help me to solve it?
Alger, Lin
|
|
|
|
|