Skip to content
Doug Bird edited this page Oct 23, 2015 · 31 revisions

#Flat XML Schema An XML Namespace

version 0.2

  • xml version: 1.0
  • character encoding must be UTF-8
  • Top level node: "flat"
  • suggested namespace declarations:
  • attributes:
    • fx:flat-xml-version: specify version of flat-xmlns used in the document.
    • fx:meta: indicate meta-data regarding document, such as an object type that was mapped.
    • fx:created: ISO 8601 formatted time of document creation.
    • fx:crc32: crc32 polynomial of a hypothetical object represented by the document; expressed as a base16 number.
    • fx:md5: md5 hash of a hypothetical object represented by the document; expressed as a base16 number.
  • Base64 Encoding may be described for an attribute value:
  • the encoded attribute value should be prefixed with "data:application/octet-stream;base64,".
  • example usage, considering the value "hello"
    • <mynode myattr="data:application/octet-stream;base64,aGVsbG8=" />
  • Base64 Encoding may be described for an node value using the namespace https://github.com/katmore/flat/wiki/xmlns-extxs:
  • example usage, considering the value "hello"
    • <mynode extxs:encoding="base64">aGVsbG8=</mynode>
  • The "xsi:type" attribute (see xsi documentation) may optionally describe a node's data type:
  • The "xsi:type" attribute value may be one of the following primitive datatypes:
    • "xs:DateTime"
    • "xs:hexBinary"
    • "xs:base64Binary"
    • "xs:anyURI"
    • "xs:string"
    • "xs:integer"
    • "xs:decimal"
    • "xs:boolean"
  • Additionally, the "xsi:type" attribute value may be one of the following special flat xs extension datatypes:
    • "extxs:Array"
    • "extxs:Object"
    • "extxs:NumericStringInt"
    • "extxs:NumericStringFloat"
    • "extxs:NumericString"
    • "extxs:Resource"
    • "extxs:UnknownType"
  • A 'nil' value may be described with the attribute "xsi:nil" (without requiring an xsi:type attribute).
    • xsi:nil="true"
  • example xsi usage, considering a 'string' type with the value "My String":
    • <mynode xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xsi:type="xs:string">My String</mynode>
  • example xsi usage, considering a 'nil' value:
    • <mynode xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xsi:nil="true" />
  • Reserved node names for namespace https://github.com/katmore/flat/wiki/xmlns-extxs
  • dump: nodes with name "dump" must include the attribute "encoding" to describe encoding type. Acceptable values are "base64" and "none".
    • <extxs:dump extxs:encoding="base64">aGVsbG8=</dump>
    • <extxs:dump extxs:encoding="none">hello</dump>
  • data: nodes with the name "data" must use flat's xsi methodology to describe values.
    • <data xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xsi:type="xs:string">My String</data>
  • Reserved attribute names:
  • "index": numerical integer value indicating a node's relationship to its parent as a reference.
    • example usage, considering a parent node "mylist" with 2 subset members: <mylist> <item extxs:index="0">Item 1</item> <item extxs:index="1">Item 2</item> </mylist>
  • "key": string value indicating a node's relationship to its parent as a reference.
    • example usage, considering a parent node "mything" with a member having key "my_first_thing" and another having key "my_second_thing" with corresponding values of "Thing 1" and "Thing 2": `
Thing 1 Thing 2 ` * example flat document ` hello `
Clone this wiki locally