Click here to Skip to main content
15,927,129 members
Home / Discussions / XML / XSL
   

XML / XSL

 
GeneralRe: XMLSchema and C# Pin
Mazdak4-Sep-03 0:29
Mazdak4-Sep-03 0:29 
GeneralText to XML Pin
Hojtha Karlsson3-Sep-03 22:14
Hojtha Karlsson3-Sep-03 22:14 
GeneralRe: Text to XML Pin
Philip Fitzsimons4-Sep-03 3:01
Philip Fitzsimons4-Sep-03 3:01 
QuestionCant Create File??? Pin
Daron Tan1-Sep-03 6:24
Daron Tan1-Sep-03 6:24 
AnswerRe: Cant Create File??? Pin
Philip Fitzsimons2-Sep-03 3:32
Philip Fitzsimons2-Sep-03 3:32 
GeneralUsing XPath on xsd Pin
jholt31-Aug-03 11:07
jholt31-Aug-03 11:07 
GeneralRe: Using XPath on xsd Pin
Diederik de Haas5-Sep-03 4:20
Diederik de Haas5-Sep-03 4:20 
GeneralRe: Using XPath on xsd Pin
jholt7-Sep-03 8:08
jholt7-Sep-03 8:08 
Many thanks your reply - but I still can't get my head around it. I was using the XPath on the XML file.

I wrote a small form to test the expressions using an example in the Help files.

The xsd looks like this (obviously I'm actually accessing the data in the xml).

Using the form below:
/ returns everything as one long string
/* returns only table Images
//* returns everything split into lines
//Journal returns nothing
//Journal/Amount returns nothing

Maybe the code for ProcessFile is wrong ?

Many thanks for your help
Jeremy



<xs:schema id="dsJFinancials" targetNamespace="http://www.tempuri.org/dsJFinancials.xsd" xmlns:mstns="http://www.tempuri.org/dsJFinancials.xsd" xmlns="http://www.tempuri.org/dsJFinancials.xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" attributeFormDefault="qualified" elementFormDefault="qualified">
- <xs:element name="dsJFinancials" msdata:IsDataSet="true">
- <xs:complexType>
- <xs:choice maxOccurs="unbounded">
- <xs:element name="Images">
- <xs:complexType>
- <xs:sequence>
<xs:element name="Beneficiary" type="xs:int" />
<xs:element name="Image" type="xs:base64Binary" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
- <xs:element name="Journal">
- <xs:complexType>
- <xs:sequence>
<xs:element name="JournalID" type="xs:int" />
<xs:element name="Cno" type="xs:string" minOccurs="0" />
<xs:element name="Ino" type="xs:int" minOccurs="0" />
<xs:element name="BankCodeID" type="xs:int" minOccurs="0" />
<xs:element name="ChargeCustID" type="xs:int" minOccurs="0" />
<xs:element name="Cheque" type="xs:string" minOccurs="0" />
<xs:element name="Date" type="xs:dateTime" />
<xs:element name="IsFullyPaid" type="xs:boolean" />
<xs:element name="Idnote" type="xs:string" minOccurs="0" />
<xs:element name="Nett" type="xs:decimal" />
<xs:element name="VATAmount" msdata:ReadOnly="true" type="xs:decimal" minOccurs="0" />
<xs:element name="PaidTno" type="xs:int" minOccurs="0" />
<xs:element name="IsPrinted" type="xs:boolean" minOccurs="0" />
<xs:element name="ReceivedDate" type="xs:dateTime" minOccurs="0" />
<xs:element name="IsReconciled" type="xs:boolean" />
<xs:element name="Notes" type="xs:string" minOccurs="0" />
<xs:element name="UserInitials" type="xs:string" />
<xs:element name="UserLocation" type="xs:string" />
<xs:element name="VATRate" type="xs:decimal" />
<xs:element name="BankReference" type="xs:string" minOccurs="0" />
<xs:element name="DbCurr" msdata:ReadOnly="true" type="xs:string" minOccurs="0" />
<xs:element name="CrCurr" msdata:ReadOnly="true" type="xs:string" minOccurs="0" />
<xs:element name="Amount" msdata:ReadOnly="true" type="xs:decimal" minOccurs="0" />
<xs:element name="ExRate" type="xs:decimal" minOccurs="0" />
<xs:element name="LookupRate" msdata:ReadOnly="true" type="xs:decimal" minOccurs="0" />
<xs:element name="AccountID" msdata:ReadOnly="true" type="xs:int" minOccurs="0" />
<xs:element name="ContraAccountID" msdata:ReadOnly="true" type="xs:int" minOccurs="0" />
<xs:element name="DebitID" type="xs:int" />
<xs:element name="CreditID" type="xs:int" />
<xs:element name="ConvertRate" msdata:ReadOnly="true" type="xs:boolean" minOccurs="0" />
<xs:element name="DebitAmount" msdata:ReadOnly="true" type="xs:decimal" minOccurs="0" />
<xs:element name="CreditAmount" msdata:ReadOnly="true" type="xs:decimal" minOccurs="0" />
<xs:element name="IsBankToBank" msdata:ReadOnly="true" type="xs:boolean" minOccurs="0" />
<xs:element name="DebitGroupID" msdata:ReadOnly="true" type="xs:int" minOccurs="0" />
<xs:element name="CreditGroupID" msdata:ReadOnly="true" type="xs:int" minOccurs="0" />
<xs:element name="ContraGroupID" msdata:ReadOnly="true" type="xs:int" minOccurs="0" />
<xs:element name="ContraCurrency" msdata:ReadOnly="true" type="xs:string" minOccurs="0" />
<xs:element name="ContraAccountDescription" type="xs:string" minOccurs="0" />
<xs:element name="AccountDescription" type="xs:string" minOccurs="0" />
<xs:element name="RunningBalance" type="xs:decimal" minOccurs="0" />
<xs:element name="DaysUnpaidText" type="xs:string" minOccurs="0" />
<xs:element name="DaysUnpaid" type="xs:int" minOccurs="0" />
<xs:element name="USDAmount" type="xs:decimal" minOccurs="0" />
<xs:element name="USDExRate" type="xs:decimal" minOccurs="0" />
<xs:element name="Reference" type="xs:string" minOccurs="0" />
<xs:element name="MonthDate" type="xs:dateTime" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>


- <Journal>
<JournalID>33993</JournalID>
<Cno>KK041085</Cno>
<Ino>90777</Ino>
<Date>2003-08-24T00:00:00.0000000-03:00</Date>
<IsFullyPaid>false</IsFullyPaid>
<Idnote>D</Idnote>
<Nett>63930.0000</Nett>
<VATAmount>0</VATAmount>
<PaidTno>0</PaidTno>
<IsReconciled>false</IsReconciled>
<UserInitials>JH</UserInitials>
<UserLocation>B</UserLocation>
<VATRate>0</VATRate>
<DbCurr>$</DbCurr>
<CrCurr>$</CrCurr>
<Amount>63930.0000</Amount>
<LookupRate>1.00000000</LookupRate>
<AccountID>198</AccountID>
<ContraAccountID>712</ContraAccountID>
<DebitID>198</DebitID>
<CreditID>712</CreditID>
<ConvertRate>false</ConvertRate>
<DebitAmount>63930.000000000000</DebitAmount>
<CreditAmount>0</CreditAmount>
<IsBankToBank>false</IsBankToBank>
<DebitGroupID>13</DebitGroupID>
<CreditGroupID>21</CreditGroupID>
<ContraGroupID>21</ContraGroupID>
<ContraCurrency>$</ContraCurrency>
<ContraAccountDescription>Sale of goods</ContraAccountDescription>
<AccountDescription>Company Ltd</AccountDescription>
<RunningBalance>1424917.550000000000</RunningBalance>
<USDAmount>63930.000000000000</USDAmount>
<USDExRate>1</USDExRate>
<Reference>024158.001/024158.000</Reference>
<MonthDate>2003-08-01T00:00:00.0000000-03:00</MonthDate>
</Journal>


Public Class frmXPath
Inherits System.Windows.Forms.Form

Private _xp As Xml.XmlDataDocument
Private _nav As XPathNavigator

Private Property XPDoc() As Xml.XmlDataDocument
Get
Return _xp
End Get
Set(ByVal Value As Xml.XmlDataDocument)
_xp = Value
_nav = Value.CreateNavigator
End Set
End Property

Private ReadOnly Property Nav() As XPathNavigator
Get
Return _nav
End Get
End Property

Private Sub frmXPath_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim ds As New dsJFinancials
ds.ReadXml("c:\VSReports\dsFinancials.xml")
Me.XPDoc = New Xml.XmlDataDocument(ds)
End Sub

Private Sub ProcessFile()
Try
Dim expr As XPathExpression = Me.Nav.Compile(Me.txtExpression.Text)
Dim iterator As XPathNodeIterator = Me.Nav.Select(expr)
Dim sb As New System.Text.StringBuilder

While iterator.MoveNext
Dim nav2 As XPathNavigator = iterator.Current.Clone
nav2.MoveToFirstChild()
sb.Append(String.Format("{0} {1}", nav2.Value, nav2.Name))
sb.Append(vbCrLf)
End While

Me.txtOutput.Text = sb.ToString

Catch ex As XPathException
MessageBox.Show(ex.Message)
End Try
End Sub

Private Sub btnOK_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnOK.Click
Me.ProcessFile()
End Sub
End Class
GeneralRe: Using XPath on xsd Pin
Diederik de Haas7-Sep-03 10:21
Diederik de Haas7-Sep-03 10:21 
GeneralRe: Using XPath on xsd Pin
jholt8-Sep-03 5:47
jholt8-Sep-03 5:47 
QuestionDelete item from xml??? Pin
Daron Tan31-Aug-03 9:25
Daron Tan31-Aug-03 9:25 
AnswerRe: Delete item from xml??? Pin
Philip Fitzsimons1-Sep-03 2:43
Philip Fitzsimons1-Sep-03 2:43 
GeneralRe: Delete item from xml??? Pin
Diederik de Haas5-Sep-03 4:24
Diederik de Haas5-Sep-03 4:24 
GeneralProblem with typed datasets and column expressions Pin
AirGuitarist31-Aug-03 6:57
AirGuitarist31-Aug-03 6:57 
GeneralReplacing forbidden chars Pin
dekel30-Aug-03 23:10
dekel30-Aug-03 23:10 
GeneralRe: Replacing forbidden chars Pin
Anonymous31-Aug-03 2:17
Anonymous31-Aug-03 2:17 
Generalread xml file 'Hello world' Pin
30-Aug-03 22:42
suss30-Aug-03 22:42 
GeneralRe: read xml file 'Hello world' Pin
Member 50926230-Aug-03 22:44
Member 50926230-Aug-03 22:44 
GeneralRe: read xml file 'Hello world' Pin
Philip Fitzsimons1-Sep-03 2:47
Philip Fitzsimons1-Sep-03 2:47 
GeneralSolution of your IT/Computer science Problems Pin
mindnets29-Aug-03 17:43
mindnets29-Aug-03 17:43 
GeneralHard work gone to waste, help please !!! Pin
jphuphilly24-Aug-03 12:50
jphuphilly24-Aug-03 12:50 
GeneralRe: Hard work gone to waste, help please !!! Pin
ZoogieZork24-Aug-03 14:27
ZoogieZork24-Aug-03 14:27 
GeneralRe: Hard work gone to waste, help please !!! Pin
jphuphilly24-Aug-03 14:43
jphuphilly24-Aug-03 14:43 
Generalmodifying urls in XML docs Pin
Steve Severance22-Aug-03 5:01
Steve Severance22-Aug-03 5:01 
Generalcreate xml file using streamwriter Pin
jphuphilly21-Aug-03 3:00
jphuphilly21-Aug-03 3:00 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.