XML Tags

 

Composed of:
Prolog
  • <?xml version="1.0" encoding="utf-8" standalone="yes" ?>
  • basic version: <?xml version="1.0" encoding="utf-8" ?>
  • must be listed in this order
  • watch front and back spaces
  • version is required, and must be 1.0 for now
  • (if standalone="no" then a dtd is required)
  • (encoding see IANA Character Set Names,) inline encoding see Processing Instructions
  • Connecting
      from XML to XSL
        <?xml-stylesheet type="text/xsl" href="Root.xsl"?>
      from XML to ASP
        <?xml-stylesheet type="text/xsl" href="propertiesdemo.asp"?>
      from XML to CSS
        <?xml-stylesheet type="text/css" href="mystyle.css"?>
      transform all to html use an asp function:
        <%
        set xml = Server.CreateObject("Microsoft.XMLDOM")
        xml.async = false
        xml.load(Server.MapPath("data.xml"))
        set xsl = Server.CreateObject("Microsoft.XMLDOM")
        xsl.async = false
        xsl.load(Server.MapPath("data.xsl"))
        Response.Write(xml.transformNode(xsl))
        %>
    Elements Can be html or your own tags that you name
    Attributes Describe the tags you set up
    URL hyperlinks here
    Comments
  • <!--your text goes here-->
  • Within the comment section - nothing is interpreted -- all is just for your information
  • Processing Instructions <?target ....instructions..... ?>
    • no space between the <&target
    • no space between the final ?>
    Markup characters must be properly escaped String Literals--Entity References -- CDATA section
  • These are the strings that go between your tags -- this will be displayed on your page
  • escape characters Use for <,&,>, ', ", and empty spaces (plus whatever else you assign)
  • Unicode specs --Character References

    used to substitute characters that violate the syntax rules (like the & character) in your tags

    Notation **** Only in Attributes
    non XML data (like applications and binary image data)

     

     

    To verify your data:
    Type Link
    DTD

    <!DOCTYPE DOCUMENT SYSTEM "data.dtd">

    Schema

    <products xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xmlns='schema.xsd'>

    namespace tags

    can be inline anywhere on your document --used with various schemas

    Standalone

    no DTD or schema needed

    <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>

      the parser will still ignore tags that are not validated



    Validating with the XML Parser
    If you try to open an XML document, the XML Parser might generate an error. By accessing the parseError object, the exact error code, the error text, and even the line that caused the error can be retrieved:

    var xmlDoc = new ActiveXObject("Microsoft.XMLDOM")
    xmlDoc.async="false"
    xmlDoc.validateOnParse="true"
    xmlDoc.load("note_dtd_error.xml")

    document.write("<br>Error Code: ")
    document.write(xmlDoc.parseError.errorCode)
    document.write("<br>Error Reason: ")
    document.write(xmlDoc.parseError.reason)
    document.write("<br>Error Line: ")
    document.write(xmlDoc.parseError.line)

    Turning Validation off
    Validation can be turned off by setting the XML parser's validateOnParse="false