Coder Social home page Coder Social logo

`type` instead of `ref`? about ids HOT 2 CLOSED

pjanck avatar pjanck commented on June 21, 2024
`type` instead of `ref`?

from ids.

Comments (2)

aothms avatar aothms commented on June 21, 2024

xs:restriction is not a built-in data type. Those are listed here in the spec https://www.w3.org/TR/xmlschema-2/#built-in-datatypes

I also want to stress the obligatory https://www.quora.com/Is-W3Schools-a-reliable-source here I don't think we should base our decisions on that source.

Also there are apparently other issues with xsd.exe handling ref incorrectly (although not very similar to this case) https://stackoverflow.com/questions/44028046/how-to-use-xsd-exe-with-attributegroup-ref I personally have mixed experience with automated codegen from XSD.

In my understanding, but I'm not an XML/XSD expert, and I know @berlotti has consulted people infinitely more knowledgeable than me on this regard, it's as you hinted on in the other issue, in this case mostly a matter of taste. When you use type, you declare something of that type but still need to give it a name local to your schema [in XML files that adhere to the schema you see the local name]. When you use ref you basically nest that thing verbatim in your schema [in XML files that adhere to the schema you see xs:restriction].

Another difference, but not relevant, but what's described in your table, is that type can only be used for, well, types. And ref is much more general, can be used for identifiable elements, including types.

from ids.

berlotti avatar berlotti commented on June 21, 2024

It is an explicit choice to use the xs:restriction as is. We don't want to create an IDS restriction of the same type as an xs:restriction, but use the actual xs:restriction. This brings a lot of added value with the ability to use multiple toolkits for xs:restriction saving implementation time and adding consistency.

Combining two namespaces was a deliberate choice. The use of two namespaces in the XSD is not common, but valid.

Closing this issue.

from ids.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.