Create XSD (or something else) from XML to validate

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Hello everybody, here is my question (sorry for my english)

I know I am going to receive some xml´s. I know the structure they are
going to have.
As an example:

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/
envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>
<soapenv:Body>
<gi-test xmlns="urn:pm_interfaz_soap2">
<cod-user xmlns="">TESTUSER</cod-user>
<tex-pass xmlns="">TESTPASS</tex-pass>
<cod-action xmlns="">pupporttest</cod-action>
<cod-issue xmlns="">6001-000200880</cod-issue>
<typ-associate xmlns="">P</typ-associate>
<tex-associate xmlns=""></tex-associate>
<fec-action xmlns="">11/01/2008 12:21:00</fec-action>
<lst-options xmlns="">
<item xsi:type="xsd:string">test1</item>
<item xsi:type="xsd:string">test2</item>
</lst-options>
<tex-issue xmlns="">Issue test type P</tex-issue>
</gi-test>
</soapenv:Body>
</soapenv:Envelope>

How can I validate future xmls I will receive, knowing they will need
to have the structure of the above xml?

I think I should generate an XSD, DTD or something similar from the
above xml, and then validate the future xml I will receive.

If this is correct (not really sure), another issue is that I will not
have those xml in a file, and all I have found for validating xml need
to have the xml in a file.
Another problem, is that I can not modify those xmls so they will not
be linked to the xsd to which they will need to be validated.

How could this be done??

I don´t know if I have explained well, but thanks in advance for any
help.

Greetings.
.



Relevant Pages

  • Re: Referencing the xml: namespace in BTS2004
    ... namesace as any other namespace instead of the reserved namespace the W3C ... except for the "lang" attribute qualified to the special xml: ... > able to validate your xsd file and also xml.xsd and you should now be able ... > generated XSD was equivalent to the original DTD. ...
    (microsoft.public.biztalk.general)
  • allow any child element in
    ... I want to create an xsd so that I can validate xml against it. ... is that the root node (named brl) exists in the document. ...
    (microsoft.public.dotnet.xml)
  • Re: Obsessive Compulsive XMLing
    ... As in 'validate the XML against a series of rules'? ... DTD, XSD, Schematron, Relax-NG.. ...
    (comp.lang.java.programmer)
  • Re: Test Driven Development and C#
    ... programmer comes along and needs to edit what I wrote and breaks my ... as the unit tests are broken and politely ask the developer responsible ... How does one go about Unit Testing data structures like XML that are ... validate if it's well-formed XML. ...
    (microsoft.public.dotnet.languages.csharp)
  • XML validation of single value without entire XML document
    ... entire XML document to validate against the schema. ... Within XSD certain restrictions are defined for a particular ... Is it at all possible to validate a simple string value against these ...
    (microsoft.public.dotnet.xml)