Jump to content

Alfred XML validator


Recommended Posts

Hey guys, 

 

Anyone knows anything about XML validation? I don't at all... I just know it'd be incredibly easy and quick to make a custom online validator for Alfred, something we can host on github and then people can copy and paste their XML output and see where the problem is.

 

I started an XS schema for this, but as I know nothing about XML, I feel like anyone would be 10x faster than me at it. Can you see what's wrong with this?

<?xml version="1.0"?>
<xs:schema>

<xs:element name="item">
  <xs:attribute name="uid" type="xs:string"/>
  <xs:attribute name="valid" type="xs:string">
    <xs:restriction base="xs:string">
      <xs:pattern value="[Nn][Oo]" />
      <xs:pattern value="[Yy][Ee][Ss]" />
    </xs:restriction>
  </xs:attribute>
  <xs:attribute name="arg" type="xs:string"/>
  <xs:attribute name="autocomplete" type="xs:string"/>
  <xs:complexType>
    <xs:all>
      <xs:element name="title" type="xs:string" maxOccurs="1" minOccurs="0"/>
      <xs:element name="subtitle" type="xs:string" maxOccurs="6" minOccurs="0">
        <xs:attribute name="mod" type="xs:string"/>
      </xs:element>
      <xs:element name="arg" type="xs:string" maxOccurs="1" minOccurs="0"/>
      <xs:element name="icon" type="xs:string" maxOccurs="1" minOccurs="0">
        <xs:attribute name="type" type="xs:string"/>
      </xs:element>
    </xs:all>
  </xs:complexType>
</xs:element>

</xs:schema>
Link to comment

Don't know much about schemas personally. I try to avoid XML where possible.

 

AFAIK, if you wanted to host it on GitHub, it'd have to be JavaScript-based.

 

There are a few things missing there: `arg` can be an element as well as a attribute. The `text` (`copy` / `largetype`) element is missing, too, as is the root `items`.

 

I wonder about the utility of a validator, however. Doesn't everyone use a workflow library to generate the XML? And Alfred's XML format is very simple, as these things go.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...