Tecnologías XML / SVG / SVG y XML / Soluciones

(Extracto de «Das Einsteigerseminar SVG — Webgrafiken mit XML» de Helma Spona)

  1. Un espacio de nombres XML determina qué órdenes y atributos se conocen y pueden utilizarse. El espacio SVG proporciona sus etiquetas; el espacio XHTML proporciona las etiquetas XHTML.

  2. La declaración xmlns:html="http://www.w3.org/1999/xhtml" define el espacio XHTML e indica que sus órdenes comienzan con html:.

  3. Una vez definido el espacio XHTML, cree un encabezado con <foreignObject><html:h1>Überschrift 1</html:h1></foreignObject>.

  4. El archivo XML debe tener este aspecto:

<?xml version="1.0" encoding="iso-8859-1"?>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:html="http://www.w3.org/1999/xhtml">
  <circle cx="10" cy="10" r="4" style="fill:red;stroke:black"/>
  <text x="10" y="30" style="fill:black;font-size:10px">test</text>
</svg>

  1. Cree el texto con el espacio HTML y la etiqueta <foreignObject> correspondiente.

<foreignObject>
  <html:p>text</html:p>
</foreignObject>

  1. Sitúelo con los atributos x e y de la etiqueta <foreignObject>: <foreignObject x="20" y="0">.

   

<< atrás

siguiente >>

 

 

 

volver arriba