wiztools / xsd-gen Goto Github PK
View Code? Open in Web Editor NEWJava cli tool for generating XSD from an XML
License: MIT License
Java cli tool for generating XSD from an XML
License: MIT License
Hi! I'm looking forward this library and I want to know which kind of release plan do you have for a stable version, any idea? I think some explanation on wiki or readme could help.
Thanks!
Our team is using this library in our Java project. Unfortunately, we are stuck using the 0.2.1 version, because that's the latest available in the maven repository: https://mvnrepository.com/artifact/org.wiztools/xsd-gen/
Are there any plans to publish the latest version? We would like to be able to use newer features introduced post 0.2.1.
Thank you
the present code will not traverse sibling nodes that may have undiscovered optional nodes (minOccurs="0", xsd:choice, use="optional", etc). I would like an option to submit XML with sparse sibling nodes AND to submit multiple XML documents (each with same structure but incomplete information).
I will try to contribute this.
Great library - very useful :-)
Would it be possible to add a feature where the data type is inferred from the contents? For example dateTime
could be accurately guessed based on a content of ISO8601 formatted data (2000-01-01T12:34:56Z
).
I'm thinking a few of these in TypeInferenceUtil
:
private static final Pattern P_DATE_TIME = Pattern.compile("^([\\+-]?\\d{4}(?!\\d{2}\\b))((-?)((0[1-9]|1[0-2])(\\3([12]\\d|0[1-9]|3[01]))?|W([0-4]\\d|5[0-2])(-?[1-7])?|(00[1-9]|0[1-9]\\d|[12]\\d{2}|3([0-5]\\d|6[1-6])))([T\\s]((([01]\\d|2[0-3])((:?)[0-5]\\d)?|24\\:?00)([\\.,]\\d+(?!:))?)?(\\17[0-5]\\d([\\.,]\\d+)?)?([zZ]|([\\+-])([01]\\d|2[0-3]):?([0-5]\\d)?)?)?)?$");
This will correctly identify an ISO8601 format containing a valid date time.
Hi @subwiz.
It looks like this repository is missing open source license reference.
This make it problematic to fork and reuse the code in big corporation projects.
According to this manifest I believe, it wasn't your intention:
https://www.wiztools.org/tenets.html
Wouldn't it make it difficult to you to add some license reference (e.g MIT) to this github repository?
Thanks a lot!
Examples of wrongfully intepreted values from xml:
1200
2012
1983
3373
When there are more digits it is properly intepreted as integer.
Hi,
My request is to generate ref tags for nested tags
I was trying to use the software to generate xml. The xml that I was using is here : https://hadoop.apache.org/docs/current/hadoop-yarn/hadoop-yarn-site/ResourceManagerRest.html#Cluster_Scheduler_API. In the XML response section.
So, Basically there is a nested attribute called "queues", which should ideally have a ref tag to the previous queue.
I am wondering if there is way to do this ?
Hello,
I'm trying to use your tool but get a "java.net.ConnectException", can you give me any advice?
thanks
Hello,
It would be nice to add a feature for scanning the whole xml sample in order to determine if there are optional attributes.
Hi,
by following the documentation for make, in both examples I receive an error "make: *** [/usr/local/share/XML-Schema-learner/schema-learn] Error 64".
Checking Google didn't help me. Any ideas?
Many thanks & kind regards
Mike
Hello guys. here is example of why 20 digits of number. Xsd generates it like long type data
40700810256895634168
040037470
1
After using XsdGen class it outputs like this.
xsd:sequence
<xsd:element name="account" minOccurs="0" type="xsd:long"/>
<xsd:element name="branchBIC" minOccurs="0" type="xsd:int"/>
<xsd:element name="branchCode" minOccurs="0" type="xsd:int"/>
<xsd:element name="currencyIsoCode" minOccurs="0" type="xsd:normalizedString"/>
</xsd:sequence>
If you guys pay attention leading zero type is also xsd int and account which more than long maximal size also xsd:long type why not making it string guys.
Exception: cvc-datatype-valid.1.2.1: '12121212' is not a valid value for 'dateTime'.
However ->12121212 results in schema file as <xsd:element name="CusomerACCTNumber" minOccurs="0" type="xsd:dateTime"/> ?
我想知道怎么在myeclipse上执行这个代码
Perhaps XsdGen
could be modified to take an InputStream
to remove the need to use a File
if this library is embedded in another app:
private Document getDocument(InputStream is) throws ParsingException, IOException {
Builder parser = new Builder();
Document d = parser.build(is);
return configureDocument(d);
}
private Document getDocument(File file) throws ParsingException, IOException {
Builder parser = new Builder();
Document d = parser.build(file);
return configureDocument(d);
}
private Document configureDocument(Document d) {
final Element rootElement = d.getRootElement();
// output Document
Element outRoot = new Element(xsdPrefix + ":schema", XSD_NS_URI);
Document outDoc = new Document(outRoot);
// setting targetNamespace
final String nsPrefix = rootElement.getNamespacePrefix();
final boolean hasXmlns = rootElement.getNamespaceDeclarationCount() > 0;
if (hasXmlns || StringUtil.isNotEmpty(nsPrefix)) {
outRoot.addAttribute(new Attribute("targetNamespace", rootElement.getNamespaceURI()));
outRoot.addAttribute(new Attribute("elementFormDefault", "qualified"));
}
// adding all other namespace attributes
for (int i = 0; i < rootElement.getNamespaceDeclarationCount(); i++) {
final String nsPrefix2 = rootElement.getNamespacePrefix(i);
final String nsURI = rootElement.getNamespaceURI(nsPrefix2);
outRoot.addNamespaceDeclaration(nsPrefix, nsURI);
}
// adding the root element
Element rootElementXsd = new Element(xsdPrefix + ":element", XSD_NS_URI);
rootElementXsd.addAttribute(new Attribute("name", rootElement.getLocalName()));
outRoot.appendChild(rootElementXsd);
recurseGen(rootElement, rootElementXsd);
return outDoc;
}
public XsdGen parse(InputStream is) throws IOException, ParseException {
try {
doc = getDocument(is);
return this;
} catch (ParsingException ex) {
throw new ParseException(ex);
}
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.