Twitter iPhone pliant OnePlus 11 PS5 Disney+ Orange Livebox Windows 11

pb de tableau dans un tableau

1 réponse
Avatar
OLIVIER
Bonjour à tous,

J'ai un probleme avec des tableau de tableau ,je galere depuis une eternité
je vais finir par devenir cinglé !!!!

Je m'explique :

Je dois ecrire une petite application qui va généré des fichiers xml
normalisé (on m'a fournit le fichier XSD qui decrit cette normalisation)

J'ai donc généré un fichier de class via xsd.exe a partir du fichier XSD que
l'on m'a transmis.

Le probleme c' est qu'il y a des décalration relativment complex de tableau
de tableau (jagged array) et là je m'y perd completement, impossible
d'instancier correctement n'y d'initailiser tout ça !!!!

si quelqu'un pouvait me filer un coup de main ....

Voila mon fichier de class


Public Class Presentation
'<remarks/>
Public Entity As String
'<remarks/>
<System.Xml.Serialization.XmlArrayItemAttribute("Row", IsNullable:=False), _
System.Xml.Serialization.XmlArrayItemAttribute("Col", IsNullable:=False,
NestingLevel:=1)> _
Public RawData()() As PresentationRowCol
'<remarks/>
<System.Xml.Serialization.XmlArrayItemAttribute("Col", IsNullable:=False)> _
Public Show() As PresentationCol
'<remarks/>
<System.Xml.Serialization.XmlArrayItemAttribute("Row", IsNullable:=False), _
System.Xml.Serialization.XmlArrayItemAttribute("Col", IsNullable:=False,
NestingLevel:=1)> _
Public DisplayData()() As PresentationRowCol1
End Class
Public Class PresentationRowCol
'<remarks/>
Public Name As String
'<remarks/>
Public Value As String
End Class
Public Class PresentationRowCol1
'<remarks/>
Public Name As String
'<remarks/>
Public Value As Object
End Class
Public Class PresentationCol
'<remarks/>
Public Name As String
End Class
Module Module1
Dim zp As New Presentation
Dim zprowcol As New PresentationRowCol
Sub Main()
zp.RawData = New PresentationRowCol(0)()
End Sub
End Module


et voila au final a quoi devrait ressembler le fichier xml :

<ZMessage>
<Action>Get</Action>
<Entity>P</Entity>
<Data>
<Entity>Asceline</Entity>
<RawData>
<Row>
<Col>
<Name>code</Name>
<Value>XXX</Value>
</Col>
<Col>
<Name>Ref</Name>
<Value>XXX</Value>
</Col>
</Row>
</RawData>
</Data>
</ZMessage>


Au secours !!!!



Merci d'avance

Olivier

1 réponse

Avatar
Patrice
Et ? Message d'erreur ? Ligne exacte ?

Pour l'instant, je suppose que le problème est que :
- zp.RawData = New PresentationRowCol(0)() ne compile pas

Je proposerais plutôt :
Redim zp.RawData(10)
Redim zp.RawData(0)(20)

Il s'agit d'un tableau de tableaux, il faut donc dimensionner le tableau
"contenant" puis redimensionner ensuite le tableau contenu dans chaque
cellule du tableau "contenant".


--
Patrice


"OLIVIER" a écrit dans le message de news:
%
Bonjour à tous,

J'ai un probleme avec des tableau de tableau ,je galere depuis une
eternité je vais finir par devenir cinglé !!!!

Je m'explique :

Je dois ecrire une petite application qui va généré des fichiers xml
normalisé (on m'a fournit le fichier XSD qui decrit cette normalisation)

J'ai donc généré un fichier de class via xsd.exe a partir du fichier XSD
que l'on m'a transmis.

Le probleme c' est qu'il y a des décalration relativment complex de
tableau de tableau (jagged array) et là je m'y perd completement,
impossible d'instancier correctement n'y d'initailiser tout ça !!!!

si quelqu'un pouvait me filer un coup de main ....

Voila mon fichier de class


Public Class Presentation
'<remarks/>
Public Entity As String
'<remarks/>
<System.Xml.Serialization.XmlArrayItemAttribute("Row", IsNullable:úlse),
_
System.Xml.Serialization.XmlArrayItemAttribute("Col", IsNullable:úlse,
NestingLevel:=1)> _
Public RawData()() As PresentationRowCol
'<remarks/>
<System.Xml.Serialization.XmlArrayItemAttribute("Col", IsNullable:úlse)>
_
Public Show() As PresentationCol
'<remarks/>
<System.Xml.Serialization.XmlArrayItemAttribute("Row", IsNullable:úlse),
_
System.Xml.Serialization.XmlArrayItemAttribute("Col", IsNullable:úlse,
NestingLevel:=1)> _
Public DisplayData()() As PresentationRowCol1
End Class
Public Class PresentationRowCol
'<remarks/>
Public Name As String
'<remarks/>
Public Value As String
End Class
Public Class PresentationRowCol1
'<remarks/>
Public Name As String
'<remarks/>
Public Value As Object
End Class
Public Class PresentationCol
'<remarks/>
Public Name As String
End Class
Module Module1
Dim zp As New Presentation
Dim zprowcol As New PresentationRowCol
Sub Main()
zp.RawData = New PresentationRowCol(0)()
End Sub
End Module


et voila au final a quoi devrait ressembler le fichier xml :

<ZMessage>
<Action>Get</Action>
<Entity>P</Entity>
<Data>
<Entity>Asceline</Entity>
<RawData>
<Row>
<Col>
<Name>code</Name>
<Value>XXX</Value>
</Col>
<Col>
<Name>Ref</Name>
<Value>XXX</Value>
</Col>
</Row>
</RawData>
</Data>
</ZMessage>


Au secours !!!!



Merci d'avance

Olivier