xml, dtd y xsd
authordanigm <dani@danigm.net>
Sun, 12 Oct 2008 13:09:26 +0000 (15:09 +0200)
committerdanigm <dani@danigm.net>
Sun, 12 Oct 2008 13:09:26 +0000 (15:09 +0200)
29 files changed:
dtd-example01.png [new file with mode: 0644]
dtd-example02.png [new file with mode: 0644]
dtd01.dtd [new file with mode: 0644]
dtd02.dtd [new file with mode: 0644]
dtd03.dtd [new file with mode: 0644]
dtd04.dtd [new file with mode: 0644]
dtd05.dtd [new file with mode: 0644]
dtd06.dtd [new file with mode: 0644]
note.xsd [new file with mode: 0644]
pelicula.xsd [new file with mode: 0644]
plantilla.otp [new file with mode: 0644]
presentacion1.odp [new file with mode: 0644]
presentacion2.odp [new file with mode: 0644]
validate.py [new file with mode: 0644]
xml-dtd.xml [new file with mode: 0644]
xml-dtd02.xml [new file with mode: 0644]
xml-dtd03.xml [new file with mode: 0644]
xml-dtd04.xml [new file with mode: 0644]
xml-dtd05.xml [new file with mode: 0644]
xml-dtd06.xml [new file with mode: 0644]
xml-example01.png [new file with mode: 0644]
xml-example02.png [new file with mode: 0644]
xml-example03.png [new file with mode: 0644]
xml-mal.xml [new file with mode: 0644]
xml-xsd-ejemplo1.xml [new file with mode: 0644]
xml-xsd.xml [new file with mode: 0644]
xml01.xml [new file with mode: 0644]
xml02.xml [new file with mode: 0644]
xsd.txt [new file with mode: 0644]

diff --git a/dtd-example01.png b/dtd-example01.png
new file mode 100644 (file)
index 0000000..4d07945
Binary files /dev/null and b/dtd-example01.png differ
diff --git a/dtd-example02.png b/dtd-example02.png
new file mode 100644 (file)
index 0000000..49b6516
Binary files /dev/null and b/dtd-example02.png differ
diff --git a/dtd01.dtd b/dtd01.dtd
new file mode 100644 (file)
index 0000000..45a17e4
--- /dev/null
+++ b/dtd01.dtd
@@ -0,0 +1,6 @@
+<!ELEMENT lista_de_personas (persona*)>
+<!ELEMENT persona (nombre, fechanacimiento?, sexo?, numeroseguridadsocial?)>
+<!ELEMENT nombre (#PCDATA) >
+<!ELEMENT fechanacimiento (#PCDATA) >
+<!ELEMENT sexo (#PCDATA) >
+<!ELEMENT numeroseguridadsocial (#PCDATA)>
diff --git a/dtd02.dtd b/dtd02.dtd
new file mode 100644 (file)
index 0000000..0555e21
--- /dev/null
+++ b/dtd02.dtd
@@ -0,0 +1,4 @@
+<!ELEMENT tag (tagA, tagB)+>
+<!ELEMENT tagA (tagB* | tagC)>
+<!ELEMENT tagB (#PCDATA| tagC)*>
+<!ELEMENT tagC (#PCDATA)>
diff --git a/dtd03.dtd b/dtd03.dtd
new file mode 100644 (file)
index 0000000..aaadc5f
--- /dev/null
+++ b/dtd03.dtd
@@ -0,0 +1,4 @@
+<!ELEMENT XXX (AAA+, BBB+)>
+<!ELEMENT AAA (BBB | CCC)>
+<!ELEMENT BBB (#PCDATA | CCC)*>
+<!ELEMENT CCC (#PCDATA)>
diff --git a/dtd04.dtd b/dtd04.dtd
new file mode 100644 (file)
index 0000000..1358bb0
--- /dev/null
+++ b/dtd04.dtd
@@ -0,0 +1,5 @@
+<!ELEMENT atributos (#PCDATA)>
+<!ATTLIST atributos 
+      aaa CDATA #IMPLIED
+      bbb NMTOKEN #REQUIRED
+      ccc NMTOKENS #REQUIRED>
diff --git a/dtd05.dtd b/dtd05.dtd
new file mode 100644 (file)
index 0000000..5a07a8c
--- /dev/null
+++ b/dtd05.dtd
@@ -0,0 +1,12 @@
+<!ELEMENT tag (tagA+ , tagB+ , tagC+)>
+<!ELEMENT tagA (#PCDATA)>
+<!ELEMENT tagB (#PCDATA)>
+<!ELEMENT tagC (#PCDATA)>
+<!ATTLIST tagA 
+      id ID #REQUIRED>
+<!ATTLIST tagB 
+      code ID #IMPLIED
+      list NMTOKEN #IMPLIED>      
+<!ATTLIST tagC 
+      X ID #REQUIRED
+      Y NMTOKEN #IMPLIED>
diff --git a/dtd06.dtd b/dtd06.dtd
new file mode 100644 (file)
index 0000000..1e1aa4d
--- /dev/null
+++ b/dtd06.dtd
@@ -0,0 +1,7 @@
+<!ELEMENT XXX (AAA+, BBB+)>
+<!ELEMENT AAA (#PCDATA)>
+<!ELEMENT BBB (#PCDATA)>
+<!ATTLIST AAA 
+         true ( yes | no ) "yes">
+<!ATTLIST BBB 
+   month NMTOKEN "1">
diff --git a/note.xsd b/note.xsd
new file mode 100644 (file)
index 0000000..3b18ce9
--- /dev/null
+++ b/note.xsd
@@ -0,0 +1,18 @@
+<?xml version="1.0"?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
+targetNamespace="http://www.w3schools.com"
+xmlns="http://www.w3schools.com"
+elementFormDefault="qualified">
+
+<xs:element name="note">
+    <xs:complexType>
+      <xs:sequence>
+       <xs:element name="to" type="xs:string"/>
+       <xs:element name="from" type="xs:string"/>
+       <xs:element name="heading" type="xs:string"/>
+       <xs:element name="body" type="xs:string"/>
+      </xs:sequence>
+    </xs:complexType>
+</xs:element>
+
+</xs:schema>
diff --git a/pelicula.xsd b/pelicula.xsd
new file mode 100644 (file)
index 0000000..9a714a2
--- /dev/null
@@ -0,0 +1,29 @@
+<?xml version="1.0"?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
+targetNamespace="http://www.w3schools.com"
+xmlns="http://www.w3schools.com"
+elementFormDefault="qualified">
+
+<xs:element name="pelicula">
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element name="titulo" type="xs:string"/>
+        <xs:element name="director" type="xs:string"/>
+        <xs:element name="fecha" type="xs:date"/>
+        <xs:element name="actores">
+            <xs:complexType>
+              <xs:sequence>
+                <xs:element name="actor" minOccurs="1" maxOccurs="unbounded">
+                    <xs:complexType>
+                        <xs:attribute name="nombre" type="xs:string"/>
+                        <xs:attribute name="personaje" type="xs:string"/>
+                    </xs:complexType>
+                </xs:element>
+              </xs:sequence>
+            </xs:complexType>
+        </xs:element>
+      </xs:sequence>
+    </xs:complexType>
+</xs:element>
+
+</xs:schema>
diff --git a/plantilla.otp b/plantilla.otp
new file mode 100644 (file)
index 0000000..c463573
Binary files /dev/null and b/plantilla.otp differ
diff --git a/presentacion1.odp b/presentacion1.odp
new file mode 100644 (file)
index 0000000..3566eb5
Binary files /dev/null and b/presentacion1.odp differ
diff --git a/presentacion2.odp b/presentacion2.odp
new file mode 100644 (file)
index 0000000..95cf4fd
Binary files /dev/null and b/presentacion2.odp differ
diff --git a/validate.py b/validate.py
new file mode 100644 (file)
index 0000000..8819ec2
--- /dev/null
@@ -0,0 +1,16 @@
+#!/usr/bin/python
+
+import sys
+from minixsv import pyxsval as xsv
+
+if len(sys.argv) != 3:
+    print "help:"
+    print sys.argv[0], "fichero.xml", "fichero.xsd"
+    sys.exit()
+
+try:
+    etw = xsv.parseAndValidateXmlInput( sys.argv[1], sys.argv[2], xmlIfClass=xsv.XMLIF_ELEMENTTREE)
+    et = etw.getTree()
+    root = et.getroot()
+except xsv.XsvalError,errstr:
+    print errstr 
diff --git a/xml-dtd.xml b/xml-dtd.xml
new file mode 100644 (file)
index 0000000..4f1a067
--- /dev/null
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE lista_de_personas SYSTEM "dtd01.dtd">
+<lista_de_personas>
+  <persona>
+    <nombre>José García</nombre>
+    <fechanacimiento>25/04/1984</fechanacimiento>
+    <sexo>Varón</sexo>
+  </persona>
+</lista_de_personas>
+
diff --git a/xml-dtd02.xml b/xml-dtd02.xml
new file mode 100644 (file)
index 0000000..59ea884
--- /dev/null
@@ -0,0 +1,9 @@
+<!DOCTYPE tag SYSTEM "dtd02.dtd">
+<tag>
+    <tagA/>
+    <tagB>
+        <tagC>textoc</tagC>
+        Textob
+    </tagB>
+
+</tag>
diff --git a/xml-dtd03.xml b/xml-dtd03.xml
new file mode 100644 (file)
index 0000000..2eee033
--- /dev/null
@@ -0,0 +1,20 @@
+<!DOCTYPE XXX SYSTEM "dtd03.dtd">
+<XXX>
+   <AAA>
+      <CCC>Exactamente un elemento.</CCC> 
+   </AAA>
+   <AAA>
+      <BBB>
+         <CCC/>
+         <CCC/>
+         <CCC/>
+      </BBB>
+   </AAA>
+   <BBB/>
+   <BBB>
+      Esta es <CCC/> una combinacion <CCC/> de <CCC> elementos CCC </CCC> y texto <CCC/>. 
+   </BBB>
+   <BBB>
+      Sólo texto. 
+   </BBB>
+</XXX>
diff --git a/xml-dtd04.xml b/xml-dtd04.xml
new file mode 100644 (file)
index 0000000..0654e94
--- /dev/null
@@ -0,0 +1,2 @@
+<!DOCTYPE atributos SYSTEM "dtd04.dtd">
+<atributos aaa="texto#" bbb="ta" ccc="x x"/>
diff --git a/xml-dtd05.xml b/xml-dtd05.xml
new file mode 100644 (file)
index 0000000..04f3e37
--- /dev/null
@@ -0,0 +1,9 @@
+ <!DOCTYPE tag SYSTEM "dtd05.dtd">
+
+<tag>
+   <tagA id="a1"/>
+   <tagA id="a2"/>
+   <tagA id="a3"/>
+   <tagB code="QWQ-123-14-6" list="14:5"/>
+   <tagC X="zero" Y="16" />
+</tag>
diff --git a/xml-dtd06.xml b/xml-dtd06.xml
new file mode 100644 (file)
index 0000000..803c3e4
--- /dev/null
@@ -0,0 +1,10 @@
+<!DOCTYPE XXX SYSTEM "dtd06.dtd">
+
+<XXX>
+   <AAA true="yes"/>
+   <AAA true="no"/>
+   <AAA/>
+   <BBB month="8" />
+   <BBB month="2" />
+   <BBB/>
+</XXX>
diff --git a/xml-example01.png b/xml-example01.png
new file mode 100644 (file)
index 0000000..bcbe9c6
Binary files /dev/null and b/xml-example01.png differ
diff --git a/xml-example02.png b/xml-example02.png
new file mode 100644 (file)
index 0000000..8b47e6e
Binary files /dev/null and b/xml-example02.png differ
diff --git a/xml-example03.png b/xml-example03.png
new file mode 100644 (file)
index 0000000..d969d30
Binary files /dev/null and b/xml-example03.png differ
diff --git a/xml-mal.xml b/xml-mal.xml
new file mode 100644 (file)
index 0000000..a057285
--- /dev/null
@@ -0,0 +1,19 @@
+
+<?xml version="1.0"?>
+<documento tipo=XML>
+    <!-- esta línea será ignorada -->
+       <autor>
+               <nombre>Daniel</nombre>
+               <apellidos>García Moreno</apellidos>
+       </autor>
+
+    <nombre>xml01.xml</nombre>
+    <fecha> sáb oct  4 11:06:55 CEST 2008 </fecha>
+
+    <etiqueta_padre>
+        <etiqueta_abierta>
+    </etiqueta_padre>
+        </etiqueta_abierta>
+
+    <validado>
+</documento>
diff --git a/xml-xsd-ejemplo1.xml b/xml-xsd-ejemplo1.xml
new file mode 100644 (file)
index 0000000..ad989ef
--- /dev/null
@@ -0,0 +1,14 @@
+
+<pelicula
+xmlns="http://www.w3schools.com"
+xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+xsi:schemaLocation="http://www.w3schools.com pelicula.xsd">
+
+    <titulo>Torrente, el brazo tonto de la ley</titulo>
+    <director>Santiago Segura</director>
+    <fecha>1998-03-13</fecha>
+    <actores>
+        <actor nombre="Santiago Segura" personaje="Torrente"/>
+        <actor nombre="Javier Cámara" personaje="Rafi"/>
+    </actores>
+</pelicula>
diff --git a/xml-xsd.xml b/xml-xsd.xml
new file mode 100644 (file)
index 0000000..662319a
--- /dev/null
@@ -0,0 +1,12 @@
+<?xml version="1.0"?>
+
+<note
+xmlns="http://www.w3schools.com"
+xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+xsi:schemaLocation="http://www.w3schools.com note.xsd">
+
+<to>Tove</to>
+    <from>Jani</from>
+    <heading>Reminder</heading>
+    <body>Don't forget me this weekend!</body>
+</note>
diff --git a/xml01.xml b/xml01.xml
new file mode 100644 (file)
index 0000000..b2d5398
--- /dev/null
+++ b/xml01.xml
@@ -0,0 +1,6 @@
+<documento>
+    <autor>Daniel García Moreno</autor>
+    <tipo>XML</tipo>
+    <nombre>xml01.xml</nombre>
+    <fecha> sáb oct  4 11:06:55 CEST 2008 </fecha>
+</documento>
diff --git a/xml02.xml b/xml02.xml
new file mode 100644 (file)
index 0000000..aa3d7b6
--- /dev/null
+++ b/xml02.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0"?>
+<documento tipo="XML">
+    <!-- esta línea será ignorada -->
+       <autor>
+               <nombre>Daniel</nombre>
+               <apellidos>García Moreno</apellidos>
+       </autor>
+
+    <nombre>xml01.xml</nombre>
+    <fecha> sáb oct  4 11:06:55 CEST 2008 </fecha>
+    <validado/>
+</documento>
diff --git a/xsd.txt b/xsd.txt
new file mode 100644 (file)
index 0000000..61fae8e
--- /dev/null
+++ b/xsd.txt
@@ -0,0 +1 @@
+http://www.w3schools.com/Schema/schema_intro.asp
\ No newline at end of file