Chapter 32 BASIC CONCEPTS of XML
attribute
Name-value pairs of the following form:
ID="QD5690"
Copy the code
Attributes are located within elements, as shown below, and an element can have any number of attributes.
<Patient ID="QD5690">Cromley,Marcia N.</Patient>
Copy the code
CDATA section
Represents the text that should not be validated, as follows:
<myelementname><! [CDATA[ Non-validated data goes here. You can even have stray "<" or ">" symbols in it. ]]></myelementname>
Copy the code
A CDATA section cannot contain the string]]> because the string marks the end of the section. This also means that CDATA extents cannot be nested.
Note that the content of the CDATA section must conform to the encoding specified for the XML document, as does the rest of the XML document.
comment
Insert instructions that are not part of the main data of an XML document. Here’s the comment:
<! --Output for the class: GXML.PersonNS7-->
Copy the code
content model
An abstract description of the possible contents of an XML element. Possible content models are as follows:
- Empty content model (no child elements or text nodes allowed)
- Simple content model (only text nodes allowed)
- Complex content model (only child elements)
- Mixed content model (allows child elements and text nodes)
In all cases, elements may or may not have attributes; The phrase content model does not address the presence or absence of attributes in elements.
default namespace
Given the namespace to which any unqualified element in the context belongs. The default namespace added has no prefix. Such as:
<Person xmlns="http://www.person.org">
<Name>Isaacs,Rob G.</Name>
<DOB>1981-01-29</DOB>
</Person>
Copy the code
Because this namespace declaration does not use a prefix, the
, and
elements belong to this namespace.
Note that the XML below does not use the default namespace and is actually equivalent to the previous example:
<s01:Person s01:xmlns="http://www.person.org">
<s01:Name>Isaacs,Rob G.</s01:Name>
<s01:DOB>1981-01-29</s01:DOB>
</s01:Person>
Copy the code
DOM
The Document Object Model (DOM) is an object model that represents XML and related formats.
DTD(Document Type Definition)
A series of text instructions contained in an XML document or external file. It defines all valid elements and attributes that can be used in a document. The DTD itself does not use XML syntax.
element
An element typically consists of two tags (a start tag and an end tag), which may contain text and other elements. The content of the element is everything between the two tags, including text and any child elements. Here is a complete XML element containing the opening tag, text content, and closing tag:
<Patient>Cromley,Marcia N.</Patient>
Copy the code
An element can have any number of attributes and any number of child elements.
An empty element can contain a start tag and an end tag, or it can contain only one tag. The following example is equivalent:
<EndDate></EndDate>
<EndDate/>
Copy the code
In practice, elements are likely to refer to different parts of the data record, for example
<Student level="undergraduate">
<Name>Barnes,Gerry</Name>
<DOB>1981-04-23</DOB>
</Student>
Copy the code
entity
A text unit representing one or more characters (in an XML file). An entity has the following structure:
&characters;
Copy the code
global element
The concepts of global and local elements apply to documents that use namespaces. The names of global elements are placed in a separate symbolic space from the names of local elements. A global element is an element whose type has global scope, that is, an element whose type is defined at the top level of the corresponding XML schema. Element declarations that are children of < XS: SCHEMA > elements are considered global declarations. Any other element declaration is a local element unless it references the global declaration through the ref attribute, which effectively makes it a global element.
Properties can be global or local.
local element
Not a global XML element. Local elements do not explicitly belong to any namespace, unless the element is qualified. See qualified elements and global elements.
namespace
Namespaces are unique strings that define fields for identifiers so that XML-based applications do not confuse one type of document with another. It usually gives a URI(Uniform resource indicator) in the form of a URL(uniform resource Location), which may or may not correspond to the actual Web address. For example, “http://www.w3.org” is a namespace.
Include namespace declarations using one of the following syntax:
xmlns="your_namespace_here"
pre:xmlns="your_namespace_here"
Copy the code
In both cases, namespaces are used only in the context in which the namespace declaration is inserted. In the latter case, the namespace is associated with a given prefix (pre). An element or attribute belongs to the namespace if and only if it also has this prefix. Such as:
<s01:Person xmlns:s01="http://www.person.com">
<Name>Ravazzolo,Roberta X.</Name>
<DOB>1943-10-24</DOB>
</s01:Person>
Copy the code
Namespace declarations use the s01 prefix. The
and
elements do not explicitly belong to any namespace.
Processing instruction (PI)
An instruction (in the prologue) that tells the application how to use an XML document or how to process it. An example; This associates the stylesheet with the document.
Copy the code
prolog
The portion of the XML document before the root element. The prologue begins with an XML declaration (indicating the version of XML to use) and may then include a DTD or schema declaration as well as processing instructions. (Technically, you don’t need a DTD or schema. Also, it is technically possible to put both in the same file.)
root, root element, document element
Every XML document requires only one element in its outermost layer. This is called a root element, root element, or document element. The root element comes after the prologue.
qualified
An element or attribute is qualified if it is explicitly assigned to a namespace. Consider the following example, where the elements and attributes of
<Root>
<s01:Person xmlns:s01="http://www.person.com" GroupID="J1151">
<Name>Frost,Sally O.</Name>
<DOB>1957-03-11</DOB>
</s01:Person>
</Root>
Copy the code
Here, the namespace declaration uses the s01 prefix. There is no default namespace. The
and
elements or
attributes do not have prefixes, so they do not explicitly belong to any namespace.
Instead, consider the case where the elements and attributes of
<Root>
<Person xmlns="http://www.person.com" GroupID="J1151">
<Name>Frost,Sally O.</Name>
<DOB>1957-03-11</DOB>
</Person>
</Root>
Copy the code
In this case, the
Note: The XML schema attributes elementFormDefault and attributeFormDefault control whether elements and attributes are qualified in a given schema. In InterSystems IRIS XML support, class parameters are used to specify whether elements are qualified or not.
schema
A document that specifies meta information for a set of XML documents as an alternative to a DTD. As with DTDS, schemas can be used to validate the contents of a particular XML document. For some applications, XML schemas offer several advantages over DTDS, including:
- XML schemas are valid XML documents, making it easier to develop tools to manipulate schemas.
- XML schemas can specify a richer set of features and contain type information for values.
Is formally, schema documents conform to the W3 XML schema specification of the XML document on (https://www.w3.org/XML/Schema). It follows XML rules and uses some extra syntax. Typically, the file has a.xsd extension.
style sheet
A document written in XSLT that describes how to transform a given XML document into another XML or other “human-readable” document.
text node
One or more characters contained between the opening element and the corresponding closing element. Such as:
<SampleElement>
sample text node
</SampleElement>
Copy the code
type
Limitations on the interpretation of data. In AN XML schema, each element and attribute is defined according to a type.
Types can be simple or complex.
Each property has a simple type. Simple types also represent elements with no attributes and child elements (only text nodes). Complex types represent other elements.
The following schema fragment shows some type definitions:
<s:complexType name="Person">
<s:sequence>
<s:element name="Name" type="s:string" minOccurs="0" />
<s:element name="DOB" type="s:date" minOccurs="0" />
<s:element name="Address" type="s_Address" minOccurs="0" />
</s:sequence>
<s:attribute name="GroupID" type="s:string" />
</s:complexType>
<s:complexType name="s_Address">
<s:sequence>
<s:element name="City" type="s:string" minOccurs="0" />
<s:element name="Zip" type="s:string" minOccurs="0" />
</s:sequence>
</s:complexType>
Copy the code
unqualified
An element or attribute is unqualified if it is not explicitly assigned to a namespace.
well-formed XML
XML documents or fragments that follow XML rules, such as having an end tag to match a start tag.
XML declaration
A statement indicating the version of XML (and the optional character set) to be used in a given document. If it does, it must be the first line in the document. An example:
Copy the code
XPath
XPath (XML Path Language) is an XML-based expression language for retrieving data from XML documents. The result can be a scalar or an XML subtree of the original document.
XSLT
XSLT(Extensible Stylesheet Language Transformation) is an XML-based language that describes how to transform a given XML document into another XML or other “human-readable” document.