Jump to content

Welcome to MSFN Forum
Register now to gain access to all of our features. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more. This message will be removed once you have signed in.
Login to Account Create an Account



Photo

XML boundaries and file bindings (Urgent help needed)

- - - - -

  • Please log in to reply
No replies to this topic

#1
Velayutham

Velayutham
  • Member
  • 1 posts
  • Joined 20-September 11
  • OS:Windows 7 x86
  • Country: Country Flag
Im currently creating a XML schema for a program named 'Win 7 Boot Updater'.
This is the schema structure of the file format which i can use in this program. (Published by the author)
Please have a look :

Tell me how to create a custom file with an attached base64 encoded png and with the correct multipart headers and boundaries????
please help me.. urgent.

<?xml version="1.0" encoding="utf-8"?>
<!--

The XML file that is validated using this XSD is only part of the BS7 file format.

The entire BS7 file format is a multipart/related file with the following parts:
	an "application/xml" entry with the ID of "bs7" that contains the XML file validated using this XSD
	as many "image/png" entries that are referenced by the "cid" attribute of either "Animation" or "Background" tags in the XML

You may choose to put the PNG data inline within the XML. In that case it must be base64 encoded and the "cid" attribute must be left out.
If you only have an XML file there is no need to wrap it in the multipart format. The program detects this and handles it appropiately.

The multipart file reader built into the Windows 7 Boot Updater is very simple. Currently the following restrictions apply:
	the multipart headers and boundaries must be ASCII encoded (preferably 7-bit codes only)
	the only headers that are looked at are "Content-Type" and "Content-ID" (so "Content-Transfer-Encoding" and others are ignored)
	use the exact capitilization as used in the template (NOT case-insensitive)
	the boundary specification can be surrounded by " or ', but there is no way to escape those characters (or ; if not quoted)

BS7 File Template (note: since XML doesn't allow dash-dash in comments ~~ is used instead, but you must use two dashes):


MIME-Version: 1.0
Content-Type: multipart/related; boundary="some random string"

~~some random string
Content-ID: bs7
Content-Type: application/xml

<?xml version="1.0" encoding="utf-8"?><BootSkin7 version="1"><Winload><Animation cid="wl-anim" />...</Winload></BootSkin7>
~~some random string
Content-ID: wl-anim
Content-Type: image/png

‰PNG

   
IHDR   .... (lots of data in binary)
~~some random string~~

-->
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:simpleType name="color">
    <xs:restriction base="xs:hexBinary">
      <xs:length value="3"/>
    </xs:restriction>
  </xs:simpleType>
  <xs:simpleType name="animationSource">
    <xs:restriction base="xs:string">

      <xs:enumeration value="default"/>
      <xs:enumeration value="winload"/>
      <xs:enumeration value="embedded"/>
    </xs:restriction>
  </xs:simpleType>
  <xs:complexType name="data">
    <xs:simpleContent>
      <xs:extension base="xs:base64Binary">
        <xs:attribute name="cid" type="xs:string" use="optional" /><!-- Content-ID of data in multipart file -->

      </xs:extension>
    </xs:simpleContent>
  </xs:complexType>
  <xs:complexType name="file">
    <xs:sequence>
      <xs:element name="Animation" maxOccurs="1" minOccurs="0">
        <xs:complexType>
          <xs:simpleContent>
            <xs:extension base="data">

              <xs:attribute name="source" type="animationSource" use="optional" default="embedded" />
            </xs:extension>
          </xs:simpleContent>
        </xs:complexType>
      </xs:element>
      <xs:element name="BackgroundColor" type="color" default="000000" maxOccurs="1" minOccurs="0" />
      <xs:element name="Background" maxOccurs="1" minOccurs="0" type="data"/>
      <xs:element name="Messages" maxOccurs="1" minOccurs="0">
        <xs:complexType>

          <xs:sequence minOccurs="0" maxOccurs="unbounded">
            <xs:element name="BackgroundColor" type="color" default="000000" maxOccurs="1" minOccurs="0" />
            <xs:element maxOccurs="2" minOccurs="0" name="Message">
              <xs:complexType>
                <xs:all>
                  <xs:element name="Text" type="xs:string" />
                  <xs:element name="Position">
                    <xs:simpleType>
                      <xs:restriction base="xs:integer">

                        <xs:minInclusive value="0"/>
                        <xs:maxInclusive value="768"/>
                      </xs:restriction>
                    </xs:simpleType>
                  </xs:element>
                  <xs:element name="TextColor" type="color" />
                  <xs:element name="TextSize">
                    <xs:simpleType>
                      <xs:restriction base="xs:integer">

                        <xs:minInclusive value="1"/>
                        <xs:maxInclusive value="120"/>
                      </xs:restriction>
                    </xs:simpleType>
                  </xs:element>
                </xs:all>
                <xs:attribute name="id" use="required">
                  <xs:simpleType>
                    <xs:restriction base="xs:integer">

                      <xs:minInclusive value="1"/>
                      <xs:maxInclusive value="2"/>
                    </xs:restriction>
                  </xs:simpleType>
                </xs:attribute>
              </xs:complexType>
            </xs:element>
          </xs:sequence>
        </xs:complexType>

      </xs:element>
    </xs:sequence>
  </xs:complexType>
  <xs:element name="BootSkin7">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="Winload" maxOccurs="1" minOccurs="1" type="file" />
        <xs:element name="Winresume" maxOccurs="1" minOccurs="0" type="file" />
      </xs:sequence>

      <xs:attribute name="version" type="xs:double" use="required" />
    </xs:complexType>
  </xs:element>
</xs:schema>



How to remove advertisement from MSFN



0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users