Autor Beitrag
Matg40
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 52



BeitragVerfasst: Do 20.04.06 15:25 
Hi!


Kennt jemand ne einfache Möglichkeit, XML in XSD umzuwandeln (und umgekehrt) ?

Ich habs mit nem DataSet und ReadXmlSchema... probiert, das ging zwar, aber ich habe bei komplexeren XMLs Probleme mit "nested Tables", weil XML halt in Tabellenform umgewandelt wird...


Es geht darum: ich muss aus XML-Dateien und Schematas die Struktur auslesen (~ Tags ohne Daten).
Deshalb wollte ich gleich die Schemata der XMLs auslesen und zusammen mit den fertig gelieferten verarbeiten.

Ach ja, das ganze noch mit .NET 1.1 ;-) (ginge es mit .NET 2.0 notfalls?)



Ich hab grad auch das xsd.exe Tool von MS ausprobiert, passiert das selbe, auch in Visual Studio .NET 2003:

Error - The same table (Run) cannot be the child table in two nested relations


Gibts da noch Hilfe ? :cry:


Das Problem scheint zu sein, dass Tags enthalten sind, die andere enthalten, die wieder die drüberliegenden enthalten... :D siehe Bild


(habe .NET auf 2.0 gestellt, da es damit wenigsten halb klappt)


MfG

Matg40
Einloggen, um Attachments anzusehen!


Zuletzt bearbeitet von Matg40 am Fr 12.05.06 15:05, insgesamt 2-mal bearbeitet
Matg40 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 52



BeitragVerfasst: Mi 26.04.06 18:40 
Titel: XML -> XSD (Schema) = OK, aber umgekehrt...
Hi!


Also ich habs jetzt mit .NET 2.0 geschafft ein XSD aus (mehreren) XML(s) zu generieren. :D


Leider gehts rückwärts noch nicht, also von XSD -> XML (eine Beispielinstanz, da XSD ja nur die Struktur darstellt)


Ich hab einen Source-Code gefunden, der folgendes macht:

// - use xsd.exe to generate classes for the specified W3C XML Schema
// - compile the resulting source code into an assembly
// - use reflection to instantiate and fill an instance of the first type defined in that assembly
// - use XML Serialization to serialize the instance, and produce an XML doc that conforms to the XSD

ist aber nicht generisch... (manche Typen gehen nicht usw.)



Hat da wer ne bessere Lösung (aus C# raus, möglichst ohne externes Tool, höchstens Notfalls) :?:


(Mit XMLSpy gehts z.B.)



MfG


Matt
Matg40 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 52



BeitragVerfasst: Do 27.04.06 10:42 
Hi!

Hab ein C#-Tool dazu gefunden... falls jemand ein ähnliches Problem hat :wink:


XmlSampleGenerator: msdn.microsoft.com/l...lnet/html/xmlgen.asp


MfG

Matt