Coder Social home page Coder Social logo

XML schema invalid about urdfdom HOT 11 OPEN

ros avatar ros commented on August 19, 2024 3
XML schema invalid

from urdfdom.

Comments (11)

dljsjr avatar dljsjr commented on August 19, 2024

I'm also encountering this issue. I would like to use the standard xjc tooling that comes with JAXB to generate some Java classes for parsing URDF, and the xjc compiler errors out on the "unbounded" value on maxOccurs for link visuals and collisions.

from urdfdom.

scpeters avatar scpeters commented on August 19, 2024

So the link allows an arbitrary number of collision and visual tags. If we change it to a sequence, I wonder if each type of tag have to be adjacent or can they be mixed? Reading...

from urdfdom.

dljsjr avatar dljsjr commented on August 19, 2024

@lexknuther You seem to know a bit more about XML than I do, what about using choice instead of sequence? Something like this:

  <!-- link node type -->
  <xs:complexType name="link">
    <xs:choice minOccurs="0" maxOccurs="unbounded">
      <xs:element name="inertial"
                  type="inertial" minOccurs="0" maxOccurs="1" />
      <xs:element name="visual"
                  type="visual" minOccurs="0" maxOccurs="unbounded" />
      <xs:element name="collision"
                  type="collision" minOccurs="0" maxOccurs="unbounded" />
    </xs:choice>
    <xs:attribute name="name" type="xs:string" use="required" />

    <!-- FIXME: undocumented but used by PR2 -->
    <xs:attribute name="type" type="xs:string" />
  </xs:complexType>

from urdfdom.

scpeters avatar scpeters commented on August 19, 2024

Oh, maybe the sequence could contain both collision and visual definitions...

from urdfdom.

scpeters avatar scpeters commented on August 19, 2024

Ok, I don't know what I'm talking about at all.

from urdfdom.

dljsjr avatar dljsjr commented on August 19, 2024

@scpeters From my limited understanding, an xs:all doesn't enforce an ordering whereas a xs:sequence does. An xs:choice with an unbounded maxOccurs lets the choice show up as many times as you want and you can have additional bound constraints on the possible choices but in the case of code generators it can generate code that isn't type-safe.

For validation purposes, though, I think it should work.

from urdfdom.

scpeters avatar scpeters commented on August 19, 2024

Could the inertial tag remain in an xs:all block?

from urdfdom.

dljsjr avatar dljsjr commented on August 19, 2024

xs:complexType can only have a single child element.

from urdfdom.

scpeters avatar scpeters commented on August 19, 2024

choice seems like the right thing to me

from urdfdom.

dljsjr avatar dljsjr commented on August 19, 2024

Using a sequence of choices might make things look nicer for code generators. I'm going to keep playing with it.

from urdfdom.

dljsjr avatar dljsjr commented on August 19, 2024

The plot thickens.

@scpeters Okay so, apparently, using unbounded in the xs:all is actually valid in XSD 1.1…

It's just that almost nothing out in the wild supports XSD 1.1.

from urdfdom.

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.