开发者

How to print XML Schema

i would like to ask, how to print a xml schema. I creating my xsd schema on runtime and for testing i would like to see the generated xml schema. At the moment i working with org.ap开发者_运维知识库ache.ws.commons.schema.XmlSchema and i doesnt find anything how can print the xml schema.

Did anyone know how to print out (System.out) my XmlSchema??


Try :

XMLOutputter outputter = new XMLOutputter();  
       try {  
           String outputString = outputter.outputString(loXMLDoc);
       }  

loXMLDoc is Dom for XML schema


If you are using XmlSchema 2.0

XmlSchema schema = ...
...
schema.write(System.out)

If you are using XmlSchema 1.x

XmlSchema schema = ...
...
schema.write(System.out, null)

Also, if you want to write to a string

StringWriter schemaWriter = new StringWriter();
schema.write(schemaWriter);
String schemaString = schemaWriter.toString();
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜