There I was, flicking my way through XML Hacks when the book fairly shouted out at me that trang can generate schemas from instance documents. I never knew that. I have no idea how come I never managed to internalise that (now blindingly obvious) fact.
You create an XML instance:
<foo>
<bar baz="bork"/>
Hello World
</foo>
You run:
java -jar d:\data\utils\trang.jar -I xml -O rnc foo.xml foo.rnc
You get:
default namespace = ""
start =
element foo {
(text
| element bar {
attribute baz { xsd:NCName }
})+
}
Wonderful! This riffs rather nicely with an upcoming ITWorld article on the subject of ex post facto formalisation of schemas in XML app dev.
No comments:
Post a Comment