Skip to content

Conversation

solonovamax
Copy link

@solonovamax solonovamax commented Jul 13, 2025

Updates the URDF xml schema to include documentation about all the elements.

Also makes it play more nicely when using xacro (by spamming a bunch of <xs:any>).

All documentation was taken from the ROS URDF wiki.

Also makes it play more nicely when using xacro.

Signed-off-by: solonovamax <[email protected]>
@solonovamax
Copy link
Author

I do also have the following xml schema for xacro. Although, I'm not sure if it would be best to place it in this repo as it already has an xml schema definition, or the xacro repo where it's more relevant.

<?xml version="1.0" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="https://ros.org/wiki/xacro" elementFormDefault="qualified">
    <xs:element name="property">
        <xs:complexType>
            <xs:attribute name="name" type="xs:string" use="required"/>
            <xs:attribute name="value" type="xs:string" use="required"/>
        </xs:complexType>
    </xs:element>

    <xs:element name="if">
        <xs:complexType>
            <xs:sequence minOccurs="0" maxOccurs="unbounded">
                <xs:any minOccurs="0" maxOccurs="unbounded" processContents="lax" />
            </xs:sequence>

            <xs:attribute name="value" type="xs:string" use="required"/>
        </xs:complexType>
    </xs:element>

    <xs:element name="unless">
        <xs:complexType>
            <xs:sequence minOccurs="0" maxOccurs="unbounded">
                <xs:any minOccurs="0" maxOccurs="unbounded" processContents="lax" />
            </xs:sequence>

            <xs:attribute name="value" type="xs:string" use="required"/>
        </xs:complexType>
    </xs:element>

    <xs:element name="arg">
        <xs:complexType>
            <xs:attribute name="name" type="xs:string" use="required"/>
            <xs:attribute name="default" type="xs:string"/>
        </xs:complexType>
    </xs:element>

    <xs:element name="macro">
        <xs:complexType>
            <xs:sequence minOccurs="0" maxOccurs="unbounded">
                <xs:any minOccurs="0" maxOccurs="unbounded" processContents="lax" />
            </xs:sequence>

            <xs:attribute name="name" type="xs:string" use="required"/>
            <xs:attribute name="params" type="xs:string"/>
        </xs:complexType>
    </xs:element>

    <xs:element name="include">
        <xs:complexType>
            <xs:sequence minOccurs="0" maxOccurs="unbounded">
                <xs:any minOccurs="0" maxOccurs="unbounded" processContents="lax" />
            </xs:sequence>

            <xs:attribute name="filename" type="xs:string" use="required"/>
            <xs:attribute name="ns" type="xs:string"/>
        </xs:complexType>
    </xs:element>

    <xs:element name="element">
        <xs:complexType>
            <xs:sequence minOccurs="0" maxOccurs="unbounded">
                <xs:any minOccurs="0" maxOccurs="unbounded" processContents="lax" />
            </xs:sequence>

            <xs:attribute name="name" form="qualified" type="xs:string" use="required"/>

            <xs:anyAttribute processContents="lax" namespace="https://www.ros.org"/>
        </xs:complexType>
    </xs:element>

    <xs:element name="attribute">
        <xs:complexType>
            <xs:attribute name="name" form="qualified" type="xs:string" use="required"/>
            <xs:attribute name="value" form="qualified" type="xs:string" use="required"/>

            <xs:anyAttribute processContents="lax" />
        </xs:complexType>
    </xs:element>
</xs:schema>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant