I have an xml object and need to create a schema to it so when I give it to anybody they will know how the xml I'm sending look like
Asked
Active
Viewed 57 times
0
-
http://php.net/manual/en/book.simplexml.php - U'll find everything to manipulate XML – Falt4rm May 31 '15 at 18:33
-
@Falt4rm none of it creates a schema... I don't think I need to manipulate an xml rather I need to know how to create a schema of a particular xml format – STIKO May 31 '15 at 18:45
-
1But the function asXML() writes data into a file if you specified it : http://php.net/manual/en/simplexmlelement.asxml.php – Falt4rm May 31 '15 at 18:53
-
@Falt4rm will that be considered as a schema? – STIKO May 31 '15 at 18:58
-
Finally Found it : http://stackoverflow.com/questions/486757/how-to-generate-xml-file-dynamically-using-php – Falt4rm May 31 '15 at 19:00
1 Answers
1
Here are some complex applications that can generate XSD/DTD/RelaxNG from a given set of XML sources. But this is always a fallback solution. A way to get information about XMLs you can not get another way.
A schema describes the XML format. Which nodes and content is allowed. Nodes can be optional and values can be described by regular expressions. So the application can create a Schema that matches all the provided XMLs, but this is not necessarily the actually needed schema.
If you want to provide others with a format description, you will have to write it yourself.
Here is an exception. If you have a class to XML mapper (like JAXB in Java) the schema can be generated from the mapping definitions.

ThW
- 19,120
- 3
- 22
- 44