Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I would say the best practice for a schema-less XML file is to create a schema for it!</p> <p>Having no schema is not particularly nice. It means you cannot validate the file in any way, other than to detect if it is well-formed XML or not.</p> <p>Having no semantics to the file whatsoever seems fishy. Because that would mean that you do not know what you should, did, or will put into it. If that is the case, it sounds suspiciously like a solution in search of a problem.</p> <p>If you have no schema because you do not yet know a schema language, take a look at DTD. It is very simple. You can learn and master it in about an hour or two, if you have a validation utility or validating parser in your application.</p> <p>If the issue that is preventing you from having a schema is that your schema rules do not seem to fit schema definition file types you have looked at so far, fear not.</p> <p>While DTD and even XSD (XML Schema) files are somewhat inflexible, there are other more flexible schema file types. They are much simpler than XSD too, trust me.</p> <p>Take a look at the RNC (RELAX NG, compact) schema file spec. The RNC files are very easy for humans to read and write. There are some XML editors out there that understand them. There are utilities that will convert back and forth between <a href="http://www.relaxng.org/" rel="nofollow noreferrer">RELAX NG</a> format (RNG or RNC) and other formats like DTD and XSD.</p> <p>Last time I checked, the XHTML TR included a non-normative RNC file for help in validating it, not to mention documenting it unambiguously. RELAX NG has the flexibility to do that, and you can actually read it without being part of the Borg collective. In this case Borg is not a euphemism Microsoft.</p> <p>If you need something even more flexible than RELAX NG, take a glance at <a href="http://www.schematron.com/" rel="nofollow noreferrer">Schematron</a>. It is a very nice rule-based schema validation language. It is not very complex. Like these other schema languages, it too has been around a long time, is mature, and is a recognized standard.</p> <p>Even some senior engineers at Microsoft had grave misgivings about XSD. The complexity is high, it turns out to be unable to express certain not-so-odd data arrangements, it is very verbose, it mixes concerns such as validation and default values, and so on. Whatever you are doing, it does not sound very well suited towards directly supporting it.</p> <p>RDF mappers, like XSD binding tools, are well suited towards persisting objects, given their classes in some supported programming language like Java (e.g. with JAXB). It is not clear you have some classes you want to persist in the first place, though.</p> <p>There are some semantic web technologies out there like OWL and RDF which are flexible, and very dynamic.</p> <p>One tool you might want to look at is Stanford's <a href="http://protege.stanford.edu/" rel="nofollow noreferrer">Protege</a>. It is quite powerful and very flexible. It is basically a semantic web IDE and framework. The latter is written in Java, as is the tool. However, the semantic web schema and data files Protege creates and edits could be used by programs written in any language. There is no bias towards Java in such files.</p> <p>Also, you can find lots of semantic web schemas by using <a href="http://swoogle.umbc.edu/" rel="nofollow noreferrer">Swoogle</a>. There might be a schema already that fits whatever your application is.</p> <p>Basically, coming up with a schema file in one of these many schema validation languages is not very hard once you know what you want to put in your XML data file. If you have no idea then it is unlikely a program or a person is going to know what to do with it when they read it. If that is the case, XML might not be the best storage representation. I am not sure anything would be.</p> <p>Instead, you might simple want to do whatever you are doing in a general purpose, dynamically typed scripting language like Python or Ruby. LISP could also be used, if you want your programs to be able to not only have unlimited data formats but be able to modify themselves as well.</p> <p>Another option for schema-less data storage is a logic programming language. These usually do not have any schema. They have an <a href="http://encyclopedia.thefreedictionary.com/Ontology+(computer+science)" rel="nofollow noreferrer">ontology</a> instead.</p> <p>Two programming languages I have worked a lot with that use ontologies are <a href="http://en.wikipedia.org/wiki/CLIPS" rel="nofollow noreferrer">CLIPS</a> and Prolog. There are free, open source, cross-platform, implementations of both available. </p> <p>Take a look at <a href="http://www.swi-prolog.org/" rel="nofollow noreferrer">SWI-Prolog</a>; fast, simple, and powerful. You can define facts in it, and rules which basically synthesize apropos facts when necessary. You pull the data out with queries. Prolog was actually an inspiration for RDF when it was created, back in the 1990's, as I recall. The original RDF documentation used to make frequent references to Prolog. If you want to "discover" or "analyze" or "find" things about facts in your ontology, Prolog is a very good language for writing such applications. It is also handy for natural language parsing.</p> <p>CLIPS is nice too, if you are looking to do problem-solving upon the facts in your ontology. It is well-suited towards organizing, troubleshooting, and configuration related applications.</p> <p>If schemas are not your thing, perhaps ontologies are. If not, maybe you should just use a dynamically typed scripting language and persist data stored in complex objects using maps and lists into files using their standard persistence mechanisms.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload