版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
RFC M.:ebml- 15thMarchExtensibleBinaryMarkupCopyright(C)MartinNilsson2004.Allrights摘有文件中的关键字——"MUST","MUSTNOT","REQUIRED","SHALL","SHALLNOT","SHOULD","SHOULDNOT"," MENDED","MAY",和"OPTIONAL",在RFC2119RFC2119]%b0是一位比特零,%b000是三位比特零。如下的(重)定义被用于本文BIT=%b1/%b0BYTE=OCTETWSP=SP/HTAB/CR/言,用于和操作分层数据形式的变量字符串,数据的结构紧凑而又容易被解析。EBML是专门为Matroska容器格式(MKV)设计的框架语言。本文档介绍EBML二进制语法,包括它的语释与用来定义规则和EBML语言BNF2章标识二进制格式,一个用于文档其余部分的定义。为了避免,不同的地方已在文中标明。=====EBMLEBML元素的列表。每个元素有三个部分:ID,SIZE,DATA。其中,IDSIZEUTF-8编码那样的不定长前,,IDSIZEn0开头(n0)表示数据的字n+11做间隔标志,1后面跟的是实际的整数值,该整数值由队列数据和尾数据组成,尾数据的字节数为n。=VINT_WIDTHVINT_MARKER===VINT_ALIGNMENT==VINT=(%b0VINT7BIT)/(%b17BIT11xxx201xxxxxxxxxx3001xxxxxxxxxxxxxxxxx40001xxxxxxxxxxxxxxxxxxxxxxxxEBMLID4字节。其EBMLheaderEBMLMaxIDWidth5.1。ID总是被0x7f被保留(本来应该用0xff。 A1=B2=16C3=2080D4=266338EBMLSIZE8字节。其EBMLheaderEBMLMaxSizeWidth5.1。在语意上,1需要同时缩小SIZE的宽度。出来的。被定义的数据类型为:有符号整数,无符号整数,单精度浮点型,ASCII字符串,UTF-8字符串,日期,二进制。VALUE=INT/UINT/FLOAT/STRING/DATE/INT=*8有符号整数,representedintwo’scomplementnotation,sizesfrom0-8bytes零字节表示值为0的整数。UINT=*8FLOAT=*1(4BYTE/8BYTE/10BYTEPADDING=STRING=-*BYTE串的长度可以是0.DATE=8有符号的,64位(8字节)整数,以纳秒表示距离新千年开始的时间(2001-01-0100:00:00UTC)nameparent,IDcardinality,valuerestrictionsdefaultvalue,valuetype,childorder.这些元素可能会有一些开放限制,例如它们在EBML数据中出现的次数,在文件中的顺序,以及各种其他的对于它们的DATA的限制.Name下划线可以用于Name,且不可以以数字开头,不区分大小写。NAME=[A-Za-z_]1*[A-Za-z_0-EBMLEBML进制的方式,例如1a45dfa3.ID=1*(2HEXDIG例如,考虑这样一个EBMLDTD:Weight:={WeightValue:=41a1WeightUnit:=41a2string[def:"kilogram"}Weight:={WeightValue:=41a1WeightUnit:=41a2string[def:WeightUnit}WeightWeightUnitweight应该被设置为“1见3.6节。DEFAULT=INT_DEF/UINT_DEF/FLOAT_DEF/STRING_DEF/DATE_DEF/BINARY_DEF/NAMEDATE_VALUE=*1DIGIT2DIGIT2DIGIT*1(%x542DIGIT“:”2DIGIT2DIGIT*1(“.”*1DIGIT)INT_DEF=*1“-”1*DIGITUINT_DEF=1*DIGITFLOAT_DEF=INT“.”1*DIGIT*1(“e”*1(“+”/“-”)1*DIGIT) =INT_DEF/DATE_VALUESTRING_DEF=(“0x”1*(2HEXDIG))/(%x22*(%x20-7e)%x22BINARY_DEF=THH:MM:DDF表 :=c0int[def:-114;]ExampleUInt:=c1uint[def:0;]ExampleFloat:=c2float[def:6.022E23] :=c3date[def: T15:00:03.21;]ExampleBinary:=c5binary[def:0x ;]ExampleString:=c6string[def:“Sweden”;EBMLDTD中这由元素可LEVEL=1*DIGIT*1(“..”*DIGIT)例如:Envelope:=a0Letter b0string[parent:上例中包含两个元素,EnvelopeLetterLetterLetter必EnvelopeEnvelopeEnvelope必须处于顶层。Envelope:=a0{Letter:=b0string}Envelope:=a0containerLetter:=b0string[parent:Transhcan;}Trashcan:=a1Void:=ecbinary[level:1..;card:*;下面是一个和上面相似的例子,不同的是使用了容器类型。其中,SHA1父元素的EnvelopeSHA1:=190babe5container[level:1..;card:*;{SHA1Content:=20110fcontainer}SHA1Hash:=20110e}行选择,选择默认值或下面的任何一个值。注意这将对元素可以入的所有范围产生Symbol Zeroormore Zerooroneoccurrence Exactlyone Oneormoreoccurrences.CARDINALITY=“*”/“?”/“1”/“+”YES=“yes”/ =“no”/ORDERED=YES/并且使编码的数据在或解析的时候保持一致。不同的元素类型有不同的限制,且语RANGE_LIST=RANGE_ITEM/(RANGE_ITEMS“,”SRANGE_LIST)RANGE_ITEM=INT_RANGE/UINT_RANGE/FLOAT_RANGE/STRING_RANGE/DATE_RANGE/INT_RANGE=INT_DEF/(INT_DEF“..”)/(“..”INT_DEF)/(“..”INT_DEFUINT_RANGE=UINT_DEF*1(“..”UINT_DEFFLOAT_RANGE=((“<”/“<=/“>”/“>=FLOAT_DEF(FLOAT_DEF“<”/“<=”“..”“<”/“<=”FLOAT_DEF)用整型表示也可以用IS0短格式表示。DATE_RANGE=(DATE_DEF“..”)/(“..”DATE_DEF)/(DATE_DEFUNICODE0-STRING_RANGE=UINT_RANGE的系统参数和关系以一种人类和计算机都可读的方式进行描述。语法上它由块组成,不像大多数编程语言那样包含类似BNF那样的定义和。格式上不区分空白,不区了增加可读性,本章列出的BNF相对于附录B中的完全的BNF是有点简化的。COMMENT=LCOMMENT/ =*WSP/(*WSPCOMMENT*WSP);Optionalwhite =*(S/HBLOCK/TBLOCK/EBLOCK头头的意思是什么值应该被加入元素的头,这些值应该和默认值不同。头声明块被写成“declareheader”加大括号,括入块。实际的非常直接,元素名后头块。 =“declare”WSP“header”S“{“*(S/STATEMENT)STATEMENT=NAMES“:=”SDEFSS因为DocType元素没有默认值,所有它必须在EDTD中被。此外,建 Declare{DocType:=EBMLVersion:=1;}TBLOCK=“define”SWSP“types”S“{“*(S/DTYPE”}”DTYPE=NAMES“:=”STYPES(PROPERTIESS*1“;”)/“”Definetypes{Digits:=int;Number:=digits;}TYPE=VTYPE/CTYPEVTYPE=“int”/“uint”/“float”/“string”/“date”/“binary”/NAMECTYPE=“conainer”/NAMEPROPERTIES=“[“S1*PROPERTYScrc32:=binary[size:4;]sha1:=binary[size:20;]bool:=uint[range:0..1;里面是块。每个既可以是类似类型定义那样的单个的,也可以是包含的一个块 =“define”WSP“elements”S“{“*(S/ELEMENT)”}”DELEMENT=VELEMENT/CELEMENT/“%children;”VELEMENT=NAMES“:=”SIDWSPSTYPES(PROPERTIESSCELEMENT=NAMES“:=”SIDWSPS“container”S*1PROPERTIESS(“{“*DELEMENT”}”)/“EBMLEBMLEBML(MUST)EBMLheaderEBML元素组成。一般来说,为了某个EBML元素中的所有元素定义默认值,这样能够表示实际中这意味着至少DocType总是被在所有EBML文档中。EBML:=1a45dfa3container[card:+;EBMLVersion:=4286uint[def:1;parent:EBML;该文档中使用的ID的最大的宽度。建议( 于4个字节。EBMLMaxIDWidth应该大于文档中使用的任何实际宽度。EBMLMaxIDWidth:=42f2uint[def:4;parent:EBML; EBMLMaxSizeWidth:=42f3uint[def:8;parent:EBML;DocType:=4282binary[range:32..126;parent:EBML;CRC32容器能被放置在任何EBML元素的附近。在CRC32Value中的值是其他子元素上执行的CRC-32检查值的结果。CRC32:=c3container[level:1..;card:*;CRC32Value:=42febinary[size:4;}Void:=ecbinary[level:1..;card:*;[ABNF]D.Crocker,P.Overell,'AugmentedBNFforSyntaxSpecifications:ABNF',RFC2234,November1997.-DataCommunicationHigh-LevelDataLinkControlProcedure-FrameStructure",IS3309,October1984,3rdEdition.[FLOAT]InstituteofElectricalandElectronicsEngineers,'IEEEStandardforBinaryFloating-PointArithmetic',ANSI/IEEEStandard754-1985,August1985.[RFC2119]S.Bradner,' foruseinRFCstoIndicateRequirementLevels',RFC2119,March1997.[UNICODE]InternationalOrganizationforStandardization,'UniversalMultiple-OctetCodedCharacterSet(UCS),Part1:ArchitectureandBasicMultilingualne',ISO/IEC10646-[UTF-8]F.Yergeau,'UTF-8,atransformationformatofISO10646',RFC3629,NovemberRFC M.:ebml- 15thMarchExtensibleBinaryMarkupCopyright(C)MartinNilsson2004.AllrightsTheextensiblebinarymarkuplanguage,EBML,isabinarylanguageforstoringhierarchical,typedindatainacompact,yeteasilyparsedformat.About iscurrentlyinitsdraftstageandissubjecttochanges.Thecontentsshouldnotberelieduponforimplementationalpurposes. "MUST","MUSTNOT","REQUIRED","SHALL","SHALLNOT","SHOULD","SHOULDNOT"," MENDED","MAY",and"OPTIONAL"inthisaretobeinterpretedasdescribedinRFC2119[RFC2119].Thedefinitionsinthis usesABNF[ABNF].NotethatstringterminalsarecaseinsensitiveinABNF.Theinterpretationofbinaryvalueshasbeenslightlyalteredsothateverybitmustbeexplicitlyprinted,e.g.%b0isonezerobitwhile%b000representsthreezerobits.Thefollowing(re)definitionsareusedthroughoutthis. =%b1/%b0BYTE=OCTET =SP/HTAB/CR/TheExtensibleBinaryMarkupLanguageEBMLwasdesignedtobeasimplifiedbinaryversionofXMLforthepurposeofstoringandmanipulatingdatainahierarchicalformwithvariablefieldlengths.SpecificallyEBMLwasdesignedastheframeworklanguageforthecontainerformatMatroska.SomeoftheadvantagesofEBMLare:PossibilityforcompatibilitybetweendifferentversionsofbinarylanguagesdefinedinEBML.ArarepropertyofbinaryformatthatotherwiseoftenneedscarefulconsiderationUnlimitedsizeofdataCanbebothgeneratedandreadasastream,withoutknowingthedatasizeOftenveryspaceefficient,evencomparedtootherbinaryrepresentationsoftheSomeoftheEBMLdisadvantagesNoreferencescanbemadebetweenEBMLfiles,suchasincludesorinherits.EBMLisaself-containedentity.ThedatastoredinEBMLmayofcoursereferenceotherresources.NocompositioningprocesstomergetwoormoreEBMLlanguagescurrentlyThisdescribestheEBMLbinarysyntax,itssemanticinterpretationandthesyntaxofatextualtypedefinitionformatusedtodefinetherulesandconstraintsofanEBMLlanguage.BNFisusedthroughoutthistoaugmentthedescriptionandmakeitmoreformalized.Itmusthoweverbenotedthattwodifferentformatsaredescribedinthis,withtwodifferentBNFs.Oneforthebinaryformatinchapter2andoneforthetypedefinitionintherestofthe.Toavoidconfusiondifferenttokennameshasbeenchosen.TheBNFscanbeviewedinfullintheappendices.SyntacticallyanEBMLisalistofEBMLelements.Eachelementhasthreeparts;anelementID,asizedescriptorandtheelementdatapayload.Theelementdatapayloadistheneitherdata,implicitlytypedbytheelementID,oralistofEBMLelements.=====EBMLusesbigendian/networkorderbyteorder,i.e.mostsignificantbitfirst.Allofthetokensabovearebytealigned.ForbothelementIDandsizedescriptorEBMLusesavariablesizeinteger,codedaccordingtoaschemasimilartothatofUTF-8[UTF-8]encoding.Thevariablesizeintegerbeginswithzeroormorezerobitstodefinethewidthoftheinteger.Zerozeroesmeansawidthofonebyte,onezeroawidthoftwobytesetc.Thezeroesarefollowedbyamarkerofonesetbitandthenfollowstheactualintegerdata.Theintegerdataconsistsofalignmentdataandtaildata.Thealignmentdatatogetherwiththewidthdescriptorandthemarkermakesuponeormorecompletebytes.Thetaildataisasmanybytesastherewerezeroesinthewidthdescriptor,i.e.width-=VINT_WIDTHVINT_MARKER===VINT_ALIGNMENT==Analternatewayofexpressingthisisthefollowingdefinition,wherethewidthisthenumberoflevelsofexpansion.VINT=(%b0VINT7BIT)/(%b1Someexamplesoftheencodingofintegersofwidth1to4.Thex:representbitswheretheactualintegervaluewouldbestored. 11xxx201xxxxxxxxxx3001xxxxxxxxxxxxxxxxx40001xxxxxxxxxxxxxxxxxxxxxxxxElementTheEBMLelementIDisencodedasavariablesizeintegerwith,bydefault,widthsup4.AnotherumwidthvaluecanbesetbysettinganothervaluetoEBMLMaxIDWidthintheEBMLheader.Seesection5.1.IDsarealwaysencodedintheirshortestform,e.g.1isalwaysencodedas0x81andneveras0x4001.ThislimitsthenumberofIDsineveryclasswiththenumberofIDsinthepreviousclasses.Furthermore,valueswithalldatabitssetto1andalldatabitssetto0are,hencetheeffectivenumberofIDsareasfollowsfordifferentwidths.Notethattheshortestencodingformfor127is0x407fsince0x7fis. A1=B2=16C3=2080D4=2663382.3.ElementdataTheEBMLelementdatasizeisencodedasavariablesizeintegerwith,bydefault,widthsupto8.AnotherumwidthvaluecanbesetbysettinganothervaluetoEBMLMaxSizeWidthintheEBMLheader.Seesection5.1.Thereisarangeoverlapbetweenalldifferentwidths,sothat1encodedwithwidth1issemanticallyequalto1encodedwithwidth8.Thisallowsfortheelementdatatoshrinkwithouthavingtoshrinkthewidthofthesizedescriptor.Valueswithalldatabitssetto1meanssizeunknown,whichallowsfordynamicallygeneratedEBMLstreamswherethefinalsizeisn’tknownbeforehand.TheelementwithunknownsizeMUSTbeanelementwithanelementlistasdatapayload.TheendoftheelementlistisdeterminedbytheIDoftheelement.Whenanelementthatisn'tasub-elementoftheelementwithunknownsizearrives,theelementlistisSincethehighestvalueisusedforunknownsizetheeffectiveumdatasizeis2^56-2,usingvariablesizeintegerwidth8.2.4.Besideshavinganelementlistasdatapayloadanelementcanhaveitsdatatypedwithanyofsevenpredefineddatatypes.Theactualtypeinformationisn'tstoredinEBMLbutisinferredfromthe typedefinitionthroughtheelementID.Thedefineddatatypesaresignedinteger,unsignedinteger,float,ASCIIstring,UTF-8string,dateandbinarydata.INT=Signedinteger,representedintwo'scomplementnotation,sizesfrom0-8bytes.Azerobyteintegerrepresentstheintegervalue0.UINT=Unsignedinteger,sizesfrom0-8bytes.AzerobyteintegerrepresentstheintegervalueFLOAT=*1(4BYTE/8BYTE/IEEEfloat[FLOAT],sizes0,4,8or10bytes.AzerobytefloatrepresentsthefloatPADDING=%x00STRING=*BYTEUTF-8[UTF-8]encodedUnicode[UNICODE]string.AstringMAYbezeropaddedattheend.Notethatastringcanbeofzerolength.Signed,64-bit(8byte)integerdescribingthedistanceinnanosecondstothebeginningofthemillennium(2001-01-0100:00:00UTC).Binarydata,i.e.notinterpretedattheEBMLSemanticEveryelementhasseveralpropertiesdefinedinthetypedefinition,whichareneededforthecorrectsyntacticalandsemantichandlingoftheinformation.Thesepropertiesarename,parent,ID,cardinality,valuerestrictions,defaultvalue,valuetypeandchildorder.TosyntacticallyparseEBMLdataweneedtoknowtheelementvaluetypes,andtosemanticallyinterpretthatdatawealsoneedtoknowtheelementIDsandelementnames.Elementscanhaveadefaultvalue,soforthefinalpresentationoftheparsedEBMLdataelementsthatwasn'tstoredinthedatamayshowup.Finallyelementsmayhaverestrictionsintermsofwhichparentorparentstheymayhave,thenumberoftimestheymayoccurintheEBMLdata,theirorderinthe andvariousadditionalrestrictionsoftheirdatapayload.NameThenameisthesymbolicidentifierofanelementandhasa1:1maptotheelementID.Onlyalphanumericcharactersandunderscoresmaybeusedforthename.Itmaynotstartwithnumber.Namesaretreatedcaseinsensitive,i.e."Name"isthesameidentifieras"name".ThereisnowayofknowingwhetherornottolookforsubelementswithonlytheinformationpresentedintheEBMLdata.HencetheelementvaluetypeisthemostimportantinformationintheEBMLDTD.Inadditiontothevaluetypesdefinedinsection2.4anelementcanalsobeofthetype"container",whichsimplymeansthatitscontentismoreelements.IDEveryelementmusthaveanIDassociated,asdefinedinsection2.2.TheseIDsareexpressedinthehexadecimalrepresentationoftheirencodedform,e.g.1a45dfa3.ID=DefaultvalueEverynon-containerMAYbeassignedadefaultvalue.Ifso,itsvaluewillbeaddedtotheinterpretationoftheEBMLdataifnoelementwithanothervalueexistsinthedata.Asanexample,considerthisEBMLDTD:Weight:=4101{WeightValue:=41a1WeightUnit:=41a2string[def:}IftheWeightelementonlycontainstheWeightValueelement,theWeightUnitelementwithvalue"kilogram"willbeaddedwhentheinformationissemanticallyprocessed.AWeightUnitelementwithanothervaluewouldofcourseoverridethedefault.Thedefaultvaluecanalsobeasymbolreferringbacktoapreviouslyseensymbol.Ifhowevernosuchsymbolhasbeensenile.IthasnotbeenencodedintotheEBMLdataandhasnodefaultvalue,theelementwillnotbeaddedasachildonthesemanticlevel.Weight:=4101WeightValue:=41a1WeightUnit:=41a2string[def:}InthisexampleallWeightelementswillusethesameweightunitesthepreviousone.Toensurethatthefirstonehasavalueitscardinalityshouldbesetto"1".Seesection3.6.DEFAULT=INT_DEF/UINT_DEF/FLOAT_DEF/STRING_DEF/DATE_DEF/BINARY_DEF/NAMEDATE_VALUE=*1DIGIT2DIGIT2DIGIT*1(%x542DIGIT":"2DIGIT":"2DIGIT*1(“."*1DIGIT))INT_DEF=*1"-"1*DIGITUINT_DEF=1*DIGITFLOAT_DEF=INT"."STRING_DEF=("0x"1*(2HEXDIG))/(%x22*(%x20-7e)%x22)BINARY_DEF=ThedatedefaultvalueiseitherdescribedastheintegerinitsencodedformorintheISOshortformat;YYYYMMDDfollowedbythestringlilT,thetimeasHH:MM:DDandfinallyandoptionallythefractionsas.FwithanoptionalnumbersofFforprecision.SomeExampling:=c0into[def:-114;]ExampleUInt:=c1uint[def:0;]ExampleFloat:=c2float[def:6.022E23]ExampleDate:=c3date[def: T15:00:03.21;]ExampleBinary:=c5binary[def:0x ;]ExampleString:=c6string[def:"Sweden";]ParentTocetheelementsinahierarchicalstructureweneedrelationalinformationabouttheelements.IntheEBMLDTDthisisexpressedasthepossibleparentsanelementmayhave.Thiscanbeexpressedintwoways:anexplicitlistofallowedparentsorgenericdefinitionofallowedinsertiondepth.AnelementwithneitherparentsnorleveldefinedisassumedtoexistonthetoplevelintheEBML.Anelementcannothavebothaparentandalevelproperty.Thefollowingexamplecontainstwoelements,EnvelopeandLetter.TheLettermust,ifitexistsinthe,beachildofEnvelopeandEnvelopmust,ifitexistsinthe,resideatthetoplevel.Envelope:=a0container;Letter:=b0string[parent:Thefollowingexampleexpressestheexactsamerelationships,butinanabbreviatedEnvelope:=a0container{Letter:=b0stringThefollowingexampleshowsthattheabbreviatedsyntaxcan'tbeusedtosolveallrelations.HeretheLetterelementcanbeachildinboththeEnvelopeelementandtheTrashcanelement.TheexplicitparentinformationismergedwiththeoneexpressedwiththeabbreviatedEnvelope:=a0container{Letter:=b0string[parent:Trashcan;];}Trashcan:=a1Thefollowingexampledemonstratestheusageoflevelinsteadofparent.TheelementVoidmayoccuratanyceintheEBML.Void:=ecbinary[level:1..;card:*;Thisisanexamplesimilartotheoneabove,butusingcontainersinstead.ThechildrenoftheparenttotheSHA1elementmaybepusheddowntothelevelwhere"%children;"is,i.e.ifusedwiththefirstLetter-EnvelopeexampletheEnvelopemaycontainaSHA1elementwhichmaycontainaSHA1ContentelementwhichmaycontainLetterelement.AcontainerelementwithalevelpropertyMUSTNOTuseundefinedsizeasdescribedinsection2.3,sincethentheendoftheelementcannotbedeterminedinallcases.SHA1:=190babe5container[level:1..;card:*;]{SHA1Content:=20110fThecardinalityofanelementdeclareshowmanytimesanelementmayoccurinitscurrentscope.Bydefaultanelementmayonlyoccuratmostonceinascope,e.g.iftheelementWeighthasbeendefinedasachildtoBrick,nomorethanoneWeightelementcanbeusedineveryBrickelement.Thecardinalitycanhoweverbealteredfromthedefaulttoanyofthefollowing.Notethatthisaffectsallscopesthattheelementcanbeinsertedinto.SymbolInterpretation*Zeroormoreoccurrences.Zerooroneoccurrence(default).1exactlyoneoccurrence.+Oneormoreoccurrences.CARDINALITY="*"/"?"/"1"/ChildorderThechildorderpropertyonlyappliestocontainerelements.Itsimplydeclaresifthechildrenoftheelementmustappearintheordertheyaredefinedinornot.Bydefaultthisrestrictionisimposedonallchildrentoallelements.TheadvantageoforderedelementsincombinationwithdefaultvaluesisthattheEBMLdecoderwillknowimmediayonceanelementisskippedandcanoutputtheappropriatedefaultvalueinstead.YES="yes"/"1"NO="no"/"0"ORDERED=YES/Everyelementmayimposeadditionalconstraintsuponitsvalue.Theseconstraintsareonlyusedtovalidatedataduringencodingandmakesnodifferenceforthedecodingorinterpretationoftheencodeddata.TheavailableconstraintsandsyntaxdiffersbetweendifferenttypesofTherangeofanelementvaluedeterminestheallowedvaluesthattheelementvaluemayhave.Therangeisexpressedasoneormorespecificvaluesorspansofallowedvalues,withtheexceptionoffloatsanddateswhereonlyspansareallowed.RANGE_LIST=RANGE_ITEM/(RANGE_ITEMS","SRANGE_LIST)RANGE_ITEM=INT_RANGE/UINT_RANGE/FLOAT_RANGE/Forintegerstherangeisalistofvaluesandopenorclosedranges,e.g."0,1","1...5"and"...-1,1...”.Thefinalallowedrangeisaunionofalllistedranges.Ifavaluematchesanyofthelistedrangesitisconsideredvalid.INT_RANGE=INT_DEF/(INT_DEF"...”)/(“...”INT_DEF)/(INT_DEF"...”Unsignedintegersissimilar,butcannothaveitsrangeopentitheleft.UINT_RANGE=UINT_DEF*1(“...”UINT_DEF)Floatscanhavebothinclusiveandexclusiveendpointsofits"<"/"<="FLOAT_DEF)Daterangeshasthesamesyntaxandsemanticsasintegerranges,exceptthattheactualdatecanbedescribedeitherasanintegerorinISOshortformat.Stringandbinaryrangeslimitstherangeforeachcharacter/byteinthestring.NotethatinthestringcasethisisfortheuuencodedUnicodedata,i.e.thepossiblerangeislargerthan0-255,whichistheboundingrangeforbinarydata.ThesizeofanelementvalueissimplythenumberofbytesitoccupiesinitsencodedThatmeansthatthesizeofastringelementvalueneednotbethesameasthestringSIZE_LIST=UINT_RANGE/(UINT_RANGES","STheEBMLtypedefinition,EDTD,isanASCIIbasedlanguagethatallowsfortheconstraintsandrelationsdescribedinchapter3tobedescribedinawaythatisbothhumanandcomputerreadable.Syntacticallyitconsistsofblocks,notunlikemostprogramminglanguages,whichcontainsdefinitions/declarationssimilartoBNF.Theformatislargelywhitespaceinsensitive,caseinsensitiveandsupportsbothC-style(LCOMMENT)andC++-style(BCOMMENT)comments.TheBNFlinesinthischapterissomewhatsimplifiedforreadabilitycomparedtothecompleteBNFinAppendix.COMMENT=LCOMMENT/BCOMMENTS=*WSP/(*WSPCOMMENTOptionalwhiteOnthetopleveloftheEDTDonlythreedifferentblocksarecurrentlydefined,headerdeclarations,typedefinitionsandelementdefinitions.DTD=*(S/HBLOCK/TBLOCK/HeaderThemeaningoftheheaderdeclarationistodeclarewhatvaluesshouldbeputintotheelementsoftheheader,shouldtheydifferfromthedefaultvalues.Theheaderdeclarationblockiswrittenas“declareheader"followedbycurlybracketsthatenclosestheblockofstatements.Theactualstatementsareverystraightforward,theelementnamefollowedby":="followedbythevalue,asdescribedinsection3.4,followedby";".ThereMUSTonlybeoneheaderdeclarationblockinaDTD.HBLOCK="declare"WSP"header"S"{"*(S/STATEMENT)"}"STATEMENT=NAMES":="SDEFSS";"SincetheDocTypeelementhasnodefaultvalueitMUSTbedeclaredintheEDTD.ItisMENDEDthattheEBMLVersionisalsodeclared.SuchadeclarationcouldlookTypedefinitionsisawaytocreatetypeswithmoremnemonicnames,makingtheDTDbothsmallerandeasiertoread.Thetypedefinitionsblockiswrittenas"definetypes"followedbyablockofstatementsenclosedincurlybrackets.Eachstatementisatypenamefollowedby":="followedbythetypeonwhichthistypeshouldbebasedon,optionallyfollowedbyalistofproperties,enclosedinanglebrackets.Thetypenamesfollowsthesamerulesaselementnames,butlivesinanothernamespace,i.e.theremaybeanelementwiththesamenameasaTBLOCK="define"SWSP"types"S"{"*(S/DTYPE)"}"DTYPE=NAMES":="STYPES(PROPERTIESS*1";")/";"Thebasetypemaybeanotherdefinedtype,aslongasthedefinitionsaremadeinorder,asshowninthefollowingexample.definetypes{digits:=int;number:=Thetypedefinitionthenbothallowsfortypesasdescribedinsection2.4andNAME,whichreferstotypespreviouslydefinedinthe.TYPE=VTYPE/CTYPEVTYPE="int"/"uint"/"float"/"string"/"date"/"binary"/NAMECTYPE="conainer"/NAMEIfthetypedefinitionhasnolistofproperties,thestatementisendedwith";".Iftheithasapropertylist,endingthestatementwith";"isoptional.PROPERTIES="["S1*PROPERTYS"]"PROPERTY=PROP_NAMES":"SPROP_VALUES";"Somecrc32:=binary[size:4;]sha1:=binary[size:20;]bool:=uint[range:0..1;]us_printable:=binary[range:32..126;]4.2.ElementTheelementdefinitionsistherealpurposeoftheDTD.Theelementdefinitionsblockiswrittenas"defineelements"followedbyablockofstatementsenclosedincurlybrackets.Eachstatementcanbeeitherasimplestatementsimilartothetypedefinitionstatements,orablockstatement,containingmorestatements.EBLOCK="define"WSP"elements"S"{"*(S/ELEMENT)"}"DELEMENTVELEMENT/CELEMENT/Thesimplestatementsaretypicallyusedforvalueelementsandconsistsofanamefollowedby":=",id,typeandoptionallyproperties.VELEMENT=NAMES":="SIDWSPSTYPES(PROPERTIESSTheblockversionoftheelementstatementsareonlyusedtoexpressparent-relations.SeesectionCELEMENT=NAMES":="SIDWSPS"container"S*1PROPERTIESSEBMLdefinesasmallsetofelementsthatcanbeusedinanyEBMLapplication.AnEBMLMUSTbeginwithanEBMLheaderconsistingoftheEBMLelement.Generallyspeakingitwouldb
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 维修技能鉴定笔试试题及答案(维修岗位)
- 防腐工程人有必要了解的五种施工方法
- 招标采购从业人员专业技术能力考试(招标采购项目管理中级)冲刺试题及答案(2026年青海海东地区)
- 视频监控系统售后服务方案
- 建筑工程照明动力配电箱安装施工技术
- 2026年检测工作年终总结
- 钢材供货方案及保证措施
- 2026年民政项目管理真题试卷及参考答案
- 冬季施工专项方案
- 2026年亳州蒙城县鲲鹏食材供应链管理有限公司公开招聘劳务外包工作人员48名笔试备考题库与答案解析
- 雨课堂学堂在线学堂云《园艺植物研究法( 宁夏)》单元测试考核答案
- 雨课堂在线学堂《医学实验技术与方法新进展》单元考核测试答案
- 2025年陕西省公务员行测(A类)真题及答案
- 国家基本公共卫生服务项目培训课件
- 2025年ISO90012015内审员培训测试卷含答案
- 《江苏省城镇排水管道非开挖修复工程估价表》2025
- 2025年中考数学总复习《二次函数压轴题(角度问题)》专项测试卷(附参考答案)
- 电子电气员英语考试题库(浓缩300题)
- GB/T 8574-2024复合肥料中钾含量的测定
- 产品外观检验标准通用
- 华为HRBP赋能手册
评论
0/150
提交评论