santhosh-tekuri/jlibs

Generate XML using defined namespace prefixes

Opened this issue · 5 comments

Feature Request: Generate the sample XML using the namespace prefixes defined in the xsd files.

Yes. this makes the generated sample more readable...
Xerces xsd parser, does not give any prefix information. need to manually parse xsd files to get namespace prefixes.

you have to do the following to use the sample prefixes in generates sample xml:

String xsdFile = ...
XSModel xsModel = ...
XMLDocument xml = ....
XSUtil.suggestNamespacePrefixes(URLUtil.toURL(xsdFile), xml);
new XSInstance().generate(...)

Perfect! Thanks a million!

Hi Santhosh.

This is my first time using GitHub, I am not quite sure how it works. I can see you have made the changes but my Maven can't seem to pick them up. I can only see version 2.1 not version 2.2 in Maven.

See: http://search.maven.org/#search%7Cga%7C1%7Cjlibs

Thanks for your help!

It is not recommended to increase version number for each change. only on release it will be available in Maven central repo. you have to use snapshot versions to get this change:

<project>

<dependencies>
    <dependency>
        <groupId>in.jlibs</groupId>
        <artifactId>jlibs-xsd</artifactId>
        <version>2.2-SNAPSHOT</version>
    </dependency>
</dependencies>
<repositories>
    <repository>
      <id>sonatype-snapshots</id>
      <name>sonatype snapshots repository</name>
      <url>https://oss.sonatype.org/content/repositories/snapshots/</url>
    </repository>
  </repositories>
</project>

use 2.2-SNAPSHOT as shown above. Do not forget to add repository to your pom.
after above changes, your build should pick up the changes