|
举例一:
JSON的表示如下:- {
- "glossary": {
- "title": "example glossary",
- "GlossDiv": {
- "title": "S",
- "GlossList": {
- "GlossEntry": {
- "ID": "SGML",
- "SortAs": "SGML",
- "GlossTerm": "Standard Generalized Markup Language",
- "Acronym": "SGML",
- "Abbrev": "ISO 8879:1986",
- "GlossDef": {
- "para": "A meta-markup language, used to create markup languages such as DocBook.",
- "GlossSeeAlso": ["GML", "XML"]
- },
- "GlossSee": "markup"
- }
- }
- }
- }
- }
复制代码 XML表示如下:- <!DOCTYPE glossary PUBLIC "-//OASIS//DTD DocBook V3.1//EN">
- <glossary><title>example glossary</title>
- <GlossDiv><title>S</title>
- <GlossList>
- <GlossEntry ID="SGML" SortAs="SGML">
- <GlossTerm>Standard Generalized Markup Language</GlossTerm>
- <Acronym>SGML</Acronym>
- <Abbrev>ISO 8879:1986</Abbrev>
- <GlossDef>
- <para>A meta-markup language, used to create markup
- languages such as DocBook.</para>
- <GlossSeeAlso OtherTerm="GML">
- <GlossSeeAlso OtherTerm="XML">
- </GlossDef>
- <GlossSee OtherTerm="markup">
- </GlossEntry>
- </GlossList>
- </GlossDiv>
- </glossary>
复制代码
举例二:
JSON表示- {"menu": {
- "id": "file",
- "value": "File",
- "popup": {
- "menuitem": [
- {"value": "New", "onclick": "CreateNewDoc()"},
- {"value": "Open", "onclick": "OpenDoc()"},
- {"value": "Close", "onclick": "CloseDoc()"}
- ]
- }
- }}
复制代码 XML的表示- <menu id="file" value="File">
- <popup>
- <menuitem value="New" onclick="CreateNewDoc()" />
- <menuitem value="Open" onclick="OpenDoc()" />
- <menuitem value="Close" onclick="CloseDoc()" />
- </popup>
- </menu>
复制代码
举例三:
JSON表示:- {"widget": {
- "debug": "on",
- "window": {
- "title": "Sample Konfabulator Widget",
- "name": "main_window",
- "width": 500,
- "height": 500
- },
- "image": {
- "src": "Images/Sun.png",
- "name": "sun1",
- "hOffset": 250,
- "vOffset": 250,
- "alignment": "center"
- },
- "text": {
- "data": "Click Here",
- "size": 36,
- "style": "bold",
- "name": "text1",
- "hOffset": 250,
- "vOffset": 100,
- "alignment": "center",
- "onMouseUp": "sun1.opacity = (sun1.opacity / 100) * 90;"
- }
- }}
复制代码 XML表示:- <widget>
- <debug>on</debug>
- <window title="Sample Konfabulator Widget">
- <name>main_window</name>
- <width>500</width>
- <height>500</height>
- </window>
- <image src="Images/Sun.png" name="sun1">
- <hOffset>250</hOffset>
- <vOffset>250</vOffset>
- <alignment>center</alignment>
- </image>
- <text data="Click Here" size="36" style="bold">
- <name>text1</name>
- <hOffset>250</hOffset>
- <vOffset>100</vOffset>
- <alignment>center</alignment>
- <onMouseUp>
- sun1.opacity = (sun1.opacity / 100) * 90;
- </onMouseUp>
- </text>
- </widget>
复制代码
举例四:
JSON表示:- {"web-app": {
- "servlet": [
- {
- "servlet-name": "cofaxCDS",
- "servlet-class": "org.cofax.cds.CDSServlet",
- "init-param": {
- "configGlossary:installationAt": "Philadelphia, PA",
- "configGlossary:adminEmail": "ksm@pobox.com",
- "configGlossary:poweredBy": "Cofax",
- "configGlossary:poweredByIcon": "/images/cofax.gif",
- "configGlossary:staticPath": "/content/static",
- "templateProcessorClass": "org.cofax.WysiwygTemplate",
- "templateLoaderClass": "org.cofax.FilesTemplateLoader",
- "templatePath": "templates",
- "templateOverridePath": "",
- "defaultListTemplate": "listTemplate.htm",
- "defaultFileTemplate": "articleTemplate.htm",
- "useJSP": false,
- "jspListTemplate": "listTemplate.jsp",
- "jspFileTemplate": "articleTemplate.jsp",
- "cachePackageTagsTrack": 200,
- "cachePackageTagsStore": 200,
- "cachePackageTagsRefresh": 60,
- "cacheTemplatesTrack": 100,
- "cacheTemplatesStore": 50,
- "cacheTemplatesRefresh": 15,
- "cachePagesTrack": 200,
- "cachePagesStore": 100,
- "cachePagesRefresh": 10,
- "cachePagesDirtyRead": 10,
- "searchEngineListTemplate": "forSearchEnginesList.htm",
- "searchEngineFileTemplate": "forSearchEngines.htm",
- "searchEngineRobotsDb": "WEB-INF/robots.db",
- "useDataStore": true,
- "dataStoreClass": "org.cofax.SqlDataStore",
- "redirectionClass": "org.cofax.SqlRedirection",
- "dataStoreName": "cofax",
- "dataStoreDriver": "com.microsoft.jdbc.sqlserver.SQLServerDriver",
- "dataStoreUrl": "jdbc:microsoft:sqlserver://LOCALHOST:1433;DatabaseName=goon",
- "dataStoreUser": "sa",
- "dataStorePassword": "dataStoreTestQuery",
- "dataStoreTestQuery": "SET NOCOUNT ON;select test='test';",
- "dataStoreLogFile": "/usr/local/tomcat/logs/datastore.log",
- "dataStoreInitConns": 10,
- "dataStoreMaxConns": 100,
- "dataStoreConnUsageLimit": 100,
- "dataStoreLogLevel": "debug",
- "maxUrlLength": 500}},
- {
- "servlet-name": "cofaxEmail",
- "servlet-class": "org.cofax.cds.EmailServlet",
- "init-param": {
- "mailHost": "mail1",
- "mailHostOverride": "mail2"}},
- {
- "servlet-name": "cofaxAdmin",
- "servlet-class": "org.cofax.cds.AdminServlet"},
-
- {
- "servlet-name": "fileServlet",
- "servlet-class": "org.cofax.cds.FileServlet"},
- {
- "servlet-name": "cofaxTools",
- "servlet-class": "org.cofax.cms.CofaxToolsServlet",
- "init-param": {
- "templatePath": "toolstemplates/",
- "log": 1,
- "logLocation": "/usr/local/tomcat/logs/CofaxTools.log",
- "logMaxSize": "",
- "dataLog": 1,
- "dataLogLocation": "/usr/local/tomcat/logs/dataLog.log",
- "dataLogMaxSize": "",
- "removePageCache": "/content/admin/remove?cache=pages&id=",
- "removeTemplateCache": "/content/admin/remove?cache=templates&id=",
- "fileTransferFolder": "/usr/local/tomcat/webapps/content/fileTransferFolder",
- "lookInContext": 1,
- "adminGroupID": 4,
- "betaServer": true}}],
- "servlet-mapping": {
- "cofaxCDS": "/",
- "cofaxEmail": "/cofaxutil/aemail/*",
- "cofaxAdmin": "/admin/*",
- "fileServlet": "/static/*",
- "cofaxTools": "/tools/*"},
-
- "taglib": {
- "taglib-uri": "cofax.tld",
- "taglib-location": "/WEB-INF/tlds/cofax.tld"}}}
复制代码 XML表示:
举例五:
JSON表示:- {"menu": {
- "header": "SVG Viewer",
- "items": [
- {"id": "Open"},
- {"id": "OpenNew", "label": "Open New"},
- null,
- {"id": "ZoomIn", "label": "Zoom In"},
- {"id": "ZoomOut", "label": "Zoom Out"},
- {"id": "OriginalView", "label": "Original View"},
- null,
- {"id": "Quality"},
- {"id": "Pause"},
- {"id": "Mute"},
- null,
- {"id": "Find", "label": "Find..."},
- {"id": "FindAgain", "label": "Find Again"},
- {"id": "Copy"},
- {"id": "CopyAgain", "label": "Copy Again"},
- {"id": "CopySVG", "label": "Copy SVG"},
- {"id": "ViewSVG", "label": "View SVG"},
- {"id": "ViewSource", "label": "View Source"},
- {"id": "SaveAs", "label": "Save As"},
- null,
- {"id": "Help"},
- {"id": "About", "label": "About Adobe CVG Viewer..."}
- ]
- }}
复制代码 XML表示:(如果没有相同的“ID”key,则增加action和label KEY。- <menu>
- <header>Adobe SVG Viewer</header>
- <item action="Open" id="Open">Open</item>
- <item action="OpenNew" id="OpenNew">Open New</item>
- <separator/>
- <item action="ZoomIn" id="ZoomIn">Zoom In</item>
- <item action="ZoomOut" id="ZoomOut">Zoom Out</item>
- <item action="OriginalView" id="OriginalView">Original View</item>
- <separator/>
- <item action="Quality" id="Quality">Quality</item>
- <item action="Pause" id="Pause">Pause</item>
- <item action="Mute" id="Mute">Mute</item>
- <separator/>
- <item action="Find" id="Find">Find...</item>
- <item action="FindAgain" id="FindAgain">Find Again</item>
- <item action="Copy" id="Copy">Copy</item>
- <item action="CopyAgain" id="CopyAgain">Copy Again</item>
- <item action="CopySVG" id="CopySVG">Copy SVG</item>
- <item action="ViewSVG" id="ViewSVG">View SVG</item>
- <item action="ViewSource" id="ViewSource">View Source</item>
- <item action="SaveAs" id="SaveAs">Save As</item>
- <separator/>
- <item action="Help" id="Help">Help</item>
- <item action="About" id="About">About Adobe CVG Viewer...</item>
- </menu>
复制代码 |
扫描并关注51学通信微信公众号,获取更多精彩通信课程分享。
|