具体报酬:10元人民币
支付方式:支付宝,微信均可
联系方式:QQ20147578
有效期限:3月底之前
需求描述:
(1)系统环境(XP/Win2003/Vista/Win7,中文版/英文版,专业版/家庭版/精简版,等)
以下是 1.xsd 1.xml 1.vbs 文件
- <?xml version="1.0" encoding="GB2312"?>
- <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
-
- <xs:element name="n">
- <xs:complexType>
- <xs:all>
- <xs:element name="s">
- <xs:complexType>
- <xs:simpleContent>
- <xs:extension base="xs:string">
- <xs:attribute name="NOTATION">
- <xs:simpleType>
- <xs:restriction base="xs:NOTATION">
- <xs:enumeration value="jpg"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:attribute>
- <xs:attribute name="ENTITY1" type="xs:ENTITY"/>
- <xs:attribute name="ENTITIES1" type="xs:ENTITIES"/>
- </xs:extension>
- </xs:simpleContent>
- </xs:complexType>
- </xs:element>
- </xs:all>
- </xs:complexType>
- </xs:element>
-
- <xs:notation name="jpg" public="image/jpeg" system="viewer.exe"/>
- <xs:notation name="mp3" public="image/jpeg" system="viewer.exe"/>
-
- </xs:schema>
复制代码
- <?xml version="1.0" encoding="utf-8"?>
- <!DOCTYPE n [
- <!NOTATION jpg SYSTEM "image/jpeg">
- <!NOTATION mp3 SYSTEM "wmplayer.exe">
- <!ENTITY f1 SYSTEM "1.jpg" NDATA jpg>
- <!ENTITY f2 SYSTEM "1.mp3" NDATA mp3>
- <!ELEMENT n ANY>
- <!ELEMENT s ANY>
- <!ATTLIST s NOTATION (jpg) #REQUIRED
- ENTITY1 ENTITY #REQUIRED
- ENTITIES1 ENTITIES #REQUIRED>
- ]>
- <n>
- <s NOTATION="jpg"
- ENTITY1="f1"
- ENTITIES1="f1 f2"/>
- </n>
复制代码
- Option Explicit
- Dim oDOMDocument, oXSD, oXMLDOMElement
-
- Set oXSD = CreateObject("Msxml2.XMLSchemaCache.6.0")
- oXSD.add "", "1.xsd"
-
- Set oDOMDocument = CreateObject("Msxml2.DOMDocument.6.0")
- oDOMDocument.setProperty "ProhibitDTD", "false"
- oDOMDocument.setProperty "ResolveExternals", "True"
- oDOMDocument.validateOnParse = True
- oDOMDocument.schemas = oXSD
- oDOMDocument.load "1.xml"
- If oDOMDocument.parseError.errorCode <> 0 Then '如果加载xml出错
- MsgBox oDOMDocument.parseError.reason & vbLf & _
- "第 " & oDOMDocument.parseError.line & " 行"
- WScript.Quit()
- End If
- MsgBox oDOMDocument.xml
- Set oXMLDOMElement = oDOMDocument.documentElement '根节点
-
- MsgBox oXMLDOMElement.SelectNodes("s")(0).getAttribute("NOTATION") & vbLf & _
- oXMLDOMElement.SelectNodes("s")(0).getAttribute("ENTITY1") & vbLf & _
- oXMLDOMElement.SelectNodes("s")(0).getAttribute("ENTITIES1")
复制代码
dtd里是没问题的,vbs中取消xsd可以通过
|