How does XML phaser find the schema it can be use for validation? - xmlschema

This question was raised because I find the some:schema is referencing the documentation instead of a XML schema file. I have has read this question but it still doesn't answer my question. Doesn't the validation require DTD or schema to process?
Example that do give DTD is the W3 school example.

Related

Does Gorilla/schema support the `json` reflection tag natively?

In the documentation, Gorilla/schema says that you must specify the schema reflection tag to unpack the struct. I've seen it unpack when I don't have the schema tag, for example when I just am using the json tag.
When the schema tag isn't specified what does Gorilla do under the covers? Does it look at other tags or does it do a case-insensitive match? Is there a huge performance hit as a result of not specifying the schema tag?
EDIT: Specified/linked package
For others searching for this answer -
This package has the ability to use any tag. The default is schema (which is initialized here). To change the tag it's searching for, use decoder.SetAliasTag("json"). While I think the fallback logic is around this function, I'm not totally certain what the performance hit really is from not explicitly setting a different tag.

Is there XML binding library for Ruby (like JAXB)?

is there any tool for Ruby which can transform XML (SOAP) to objects and vice versa? And if possible, generate all the objects (models) from XML schema (XSD). I worked several times with JAXB tool (in Java) and I need something simmilar:
generate models from XML schema
easily create component for serializing and deserializing them
easily create component for storing the objects to database
if possible, generate database tables according to that schema
Do you know any tool for this? What approach would you recommend to complete such task?
Thanks for your answers.
Savon should cover SOAP part of it.
I haven't used it but there is a library called HappyMapper: http://happymapper.rubyforge.org/

Implementing a DSL in Ruby for generating domain specific XML

I'd like to implement a DSL in Ruby for generating domain specific XML documents (i.e. XML which conforms to a specific schema). I can use e.g. Builder to write the XML in Ruby, which is already a great improvement on writing the XML manually, but I'd also like:
convenience methods that would generate a whole bunch of XML for me
and possibly a way to restrict the generator to a schema (not necessarily an XSD or a DTD, but the implementation could possibly generate only certain tags)
So my plan at the moment is to extend Builder with the convenience methods and ignore the schema restriction side of things for now.
My questions to the community are does this sounds like a reasonable plan, and more importantly, are there any DSLs out there that extend Builder in some fashion that I could use for inspiration.
Unfortunately googling for ruby, xml, builder, extend, dsl, ... doesn't return very interesting results.
I don't know if it uses Builder, but haml is certainly worth looking.
I also found this article wich mentions many more, of those, probably Markaby is the closest to your idea, but the last commit on github is from 2008. Surely looking at _why's code should be entertaining.

xsd - validating values from external dictionary file

I would like to define a schema for a document like:
...
<car>
<make>ford</make>
<model>mondeo</model>
</car>
...
the problem is that I would like to constraint possible values (so ford/mondeo or audi/a4 would be valid values for make/model, but audi/mondeo would not) from external data dictionary. In case when new car models needs to be added only external data file would change, but xsd schema would remain the same.
Is this possible at all? I have looked at key/keyref constraint, I see I can use them within a single document, but this is not I'm looking for. I don't want to repeat full data dictionary with every document instance, I would prefer to have the data file rather constitute part of the schema.
That is not possible in XML Schema 1.0.
XML Schema 1.1 will add some support that will allow expressing this kind of constraints (although AFAIK not in external files) - but that is not yet a W3C recommendation.
It is possible to implement this now with Schematron, eventually embedded in XML Schema.
However, there was already work in this area with usable results. See OASIS Code Lists
http://www.oasis-open.org/committees/tc_home.php?wg_abbrev=codelist
More details can be found here:
http://www.genericode.org/
This is used in the OASIS Universal Business Language (UBL)
http://www.oasis-open.org/committees/tc_home.php?wg_abbrev=ubl
Best Regards,
George

Coredata: import/export objects from xml

I'm trying to write some functions that import/export only some objects of certain entity from the database of CoreData. I have googled and I found not much helpful hints so far... the only one example that helped me is this tutorial: MultiThreding code sample from this site
somehow I could magage to export objects in XML, but in this example, "import" doesn't work... I looked into the source code of PPImportOperation.m and it seems that the function copyRecipe:(NSManagedObject*)recipe has some issues... then I read well the whole source code and I felt that there would be more simple and easier solution for getting objects' data from XML, maybe by using NSXmlParser or NSXMLNode (NSXMLNodePreserveCDATA,NSXMLNodeisCDATA)... or if you can tell me some other simple solution to get import function work, your help is appreciated. I'm not an experienced coder (I began Objective-C recently) so please answer me in details with example code, thanks.
Take a look at blog.sallarp.com for some example code that imports objects from XML using NSXMLParser.

Resources