Información:
- XML
- DTD
Código:
http://es.wikipedia.org/wiki/Definici%C3%B3n_de_tipo_de_documento
http://www.w3schools.com/dtd/dtd_intro.asp
Ejemplo:
Agregamos un TextBox con Multiline=True y le ponemos esto:
Código:
<?xml version="1.0"?>
<!DOCTYPE DatabaseInventory SYSTEM "DatabaseInventory.dtd">
<DatabaseInventory>
<DatabaseName>
<GlobalDatabaseName>production.iDevelopment.info</GlobalDatabaseName>
<OracleSID>production</OracleSID>
<DatabaseDomain>iDevelopment.info</DatabaseDomain>
<Administrator EmailAlias="jhunter" Extension="6007">Jeffrey Hunter</Administrator>
<DatabaseAttributes Type="Production" Version="9i"/>
<Comments>
The following database should be considered the most stable for
up-to-date data. The backup strategy includes running the database
in Archive Log Mode and performing nightly backups. All new accounts
need to be approved by the DBA Group before being created.
</Comments>
</DatabaseName>
<DatabaseName>
<GlobalDatabaseName>development.iDevelopment.info</GlobalDatabaseName>
<OracleSID>development</OracleSID>
<DatabaseDomain>iDevelopment.info</DatabaseDomain>
<Administrator EmailAlias="jhunter" Extension="6007">Jeffrey Hunter</Administrator>
<Administrator EmailAlias="mhunter" Extension="6008">Melody Hunter</Administrator>
<DatabaseAttributes Type="Development" Version="9i"/>
<Comments>
The following database should contain all hosted applications. Production
data will be exported on a weekly basis to ensure all development environments
have stable and current data.
</Comments>
</DatabaseName>
<DatabaseName>
<GlobalDatabaseName>testing.iDevelopment.info</GlobalDatabaseName>
<OracleSID>testing</OracleSID>
<DatabaseDomain>iDevelopment.info</DatabaseDomain>
<Administrator EmailAlias="jhunter" Extension="6007">Jeffrey Hunter</Administrator>
<Administrator EmailAlias="mhunter" Extension="6008">Melody Hunter</Administrator>
<Administrator EmailAlias="ahunter">Alex Hunter</Administrator>
<DatabaseAttributes Type="Testing" Version="9i"/>
<Comments>
The following database will host more than half of the testing
for our hosting environment.
</Comments>
</DatabaseName>
</DatabaseInventory>
Llamamos a la función así:
Código
Option Explicit Private Sub Form_Load() Dim sDTD As String GetDTD_Psyke1_I Text1.Text, sDTD Debug.Print sDTD End Sub
Y nos devolvería algo similar a esto:
Código:
<?xml version="1.0" encoding="UTF-8"?>
<!ELEMENT DatabaseInventory (DatabaseName+)>
<!ELEMENT DatabaseName ( GlobalDatabaseName
, OracleSID
, DatabaseDomain
, Administrator+
, DatabaseAttributes
, Comments)
>
<!ELEMENT GlobalDatabaseName (#PCDATA)>
<!ELEMENT OracleSID (#PCDATA)>
<!ELEMENT DatabaseDomain (#PCDATA)>
<!ELEMENT Administrator (#PCDATA)>
<!ELEMENT DatabaseAttributes EMPTY>
<!ELEMENT Comments (#PCDATA)>
<!ATTLIST Administrator EmailAlias CDATA #REQUIRED>
<!ATTLIST Administrator Extension CDATA #IMPLIED>
<!ATTLIST DatabaseAttributes Type (Production|Development|Testing) #REQUIRED>
<!ATTLIST DatabaseAttributes Version (7|8|8i|9i) "9i">
<!ENTITY AUTHOR "Jeffrey Hunter">
<!ENTITY WEB "www.iDevelopment.info">
<!ENTITY EMAIL "jhunter@iDevelopment.info">
Otro ejemplo más sencillo:
Código:
http://www.comptechdoc.org/independent/web/xml/guide/xmlexample.html
Normas:
Formato (obligatorio):
Código
Public Sub GetDTD_{tu nick}_{versión en números romanos}(ByRef sXML As String, ByRef sDTDOutPut As String)
- El XML ingresado no se debe modificar a lo largo de la función.
- El más rápido y más completo gana.
- Sin límite de entrega.
- No se pueden utilizar clases hechas que faciliten el trabajo.
- Damos por hecho que el XML está bien formateado.
¡Suerte!
DoEvents!