notebook/notes/encoding/xml.md

9.5 KiB

title TARGET DECK FILE TAGS tags
XML Obsidian::STEM xml
xml

Overview

Extensible Markup Language (XML) is a markup language and file format for storing, transmitting, and reconstructing arbitrary data.

%%ANKI Basic What is XML an acronym for? Back: Extensible markup language. Reference: “XML,” in Wikipedia, November 2, 2024, https://en.wikipedia.org/w/index.php?title=XML.

END%%

An XML document is divided into markup and content. A tag is a markup construct beginning with < and ending with >. An element is a logical document component spanning a start and end tag or consisting of just an empty-element tag.

%%ANKI Cloze An XML document is divided into {markup} and {content}. Reference: “XML,” in Wikipedia, November 2, 2024, https://en.wikipedia.org/w/index.php?title=XML.

END%%

%%ANKI Basic What is an XML tag? Back: Markup beginning with a < and ending with a >. Reference: “XML,” in Wikipedia, November 2, 2024, https://en.wikipedia.org/w/index.php?title=XML.

END%%

%%ANKI Basic What is an XML element? Back: A logical document component spanning start and end tags or just an empty-element tag. Reference: “XML,” in Wikipedia, November 2, 2024, https://en.wikipedia.org/w/index.php?title=XML.

END%%

%%ANKI Basic What kind of tag is <foo>? Back: A start tag. Reference: “XML,” in Wikipedia, November 2, 2024, https://en.wikipedia.org/w/index.php?title=XML.

END%%

%%ANKI Basic What kind of tag is </foo>? Back: An end tag. Reference: “XML,” in Wikipedia, November 2, 2024, https://en.wikipedia.org/w/index.php?title=XML.

END%%

%%ANKI Basic What kind of tag is <foo />? Back: An empty-element tag. Reference: “XML,” in Wikipedia, November 2, 2024, https://en.wikipedia.org/w/index.php?title=XML.

END%%

%%ANKI Basic What does an XML tag begin with? Back: A < character. Reference: “XML,” in Wikipedia, November 2, 2024, https://en.wikipedia.org/w/index.php?title=XML.

END%%

%%ANKI Basic What does an XML element begin with? Back: A start tag or empty-element tag. Reference: “XML,” in Wikipedia, November 2, 2024, https://en.wikipedia.org/w/index.php?title=XML.

END%%

%%ANKI Basic What does an XML tag end with? Back: A > character. Reference: “XML,” in Wikipedia, November 2, 2024, https://en.wikipedia.org/w/index.php?title=XML.

END%%

%%ANKI Basic What does an XML element end with? Back: An end tag or empty-element tag. Reference: “XML,” in Wikipedia, November 2, 2024, https://en.wikipedia.org/w/index.php?title=XML.

END%%

Namespaces

Namespaces are declared using the reserved xmlns attribute. A declaration is formatted as follows: xmlns[:<prefix>]="<namespace name>". If no prefix is specified, the attribute defines the default namespace.

%%ANKI Basic What is the standard xmlns namespace an acronym for? Back: XML Namespace. Reference: Allemang, Dean, James A. Hendler, and Fabien L. Gandon. Semantic Web for the Working Ontologist. 3e ed. ACM Books 33. New York: Association for computing machinery, 2020.

END%%

%%ANKI Basic What attribute is used to introduce a new XML namespace? Back: xmlns Reference: “XML Namespace,” in Wikipedia, April 11, 2024, https://en.wikipedia.org/w/index.php?title=XML_namespace.

END%%

%%ANKI Basic Consider xmlns:<p>=<n>. What term is used to refer to <p>? Back: The prefix. Reference: “XML Namespace,” in Wikipedia, April 11, 2024, https://en.wikipedia.org/w/index.php?title=XML_namespace.

END%%

%%ANKI Basic Consider xmlns:<p>=<n>. What term is used to refer to <n>? Back: The namespace name. Reference: “XML Namespace,” in Wikipedia, April 11, 2024, https://en.wikipedia.org/w/index.php?title=XML_namespace.

END%%

%%ANKI Basic What namespace name is used in the following XML attribute?

<... xmlns:xhtml="http://www.w3.org/1999/xhtml">

Back: http://www.w3.org/1999/xhtml Reference: “XML Namespace,” in Wikipedia, April 11, 2024, https://en.wikipedia.org/w/index.php?title=XML_namespace.

END%%

%%ANKI Basic What prefix is used in the following XML attribute?

<... xmlns:xhtml="http://www.w3.org/1999/xhtml">

Back: xhtml Reference: “XML Namespace,” in Wikipedia, April 11, 2024, https://en.wikipedia.org/w/index.php?title=XML_namespace.

END%%

%%ANKI Basic What does it mean to use an xmlns attribute without a prefix? Back: This declares the default namespace of the associated tag. Reference: “XML Namespace,” in Wikipedia, April 11, 2024, https://en.wikipedia.org/w/index.php?title=XML_namespace.

END%%

%%ANKI Basic What does it mean to use an xmlns attribute without a namespace name? Back: N/A. This is invalid syntax. Reference: “XML Namespace,” in Wikipedia, April 11, 2024, https://en.wikipedia.org/w/index.php?title=XML_namespace.

END%%

%%ANKI Basic How do I declare a new XML namespace with prefix abc? Back: By including xmlns:abc=<namespace name> in the appropriate tag. Reference: “XML Namespace,” in Wikipedia, April 11, 2024, https://en.wikipedia.org/w/index.php?title=XML_namespace.

END%%

%%ANKI Basic Suppose there is no default namespace in scope. What namespace are elements assigned? Back: N/A. They are not considered members of any namespace. Reference: “XML Namespace,” in Wikipedia, April 11, 2024, https://en.wikipedia.org/w/index.php?title=XML_namespace.

END%%

%%ANKI Basic Which namespace is bar a member of?

<foo xmlns="ns1">
  <bar xmlns="ns2" />
</foo>

Back: ns2 Reference: “XML Namespace,” in Wikipedia, April 11, 2024, https://en.wikipedia.org/w/index.php?title=XML_namespace.

END%%

%%ANKI Basic Which namespace is bar a member of?

<foo xmlns="ns1">
  <bar />
</foo>

Back: ns1 Reference: “XML Namespace,” in Wikipedia, April 11, 2024, https://en.wikipedia.org/w/index.php?title=XML_namespace.

END%%

%%ANKI Basic Which namespace is attribute a a member of?

<foo xmlns="ns1">
  <bar a="1" b="2" />
</foo>

Back: N/A. a has no namespace. Reference: “XML Namespace,” in Wikipedia, April 11, 2024, https://en.wikipedia.org/w/index.php?title=XML_namespace.

END%%

%%ANKI Basic Which namespace is attribute b a member of?

<foo xmlns:p="ns1">
  <bar a="1" b="2" />
</foo>

Back: N/A. b has no namespace. Reference: “XML Namespace,” in Wikipedia, April 11, 2024, https://en.wikipedia.org/w/index.php?title=XML_namespace.

END%%

%%ANKI Basic Which namespace is attribute b a member of?

<foo xmlns:p="ns1">
  <bar a="1" p:b="2" />
</foo>

Back: p Reference: “XML Namespace,” in Wikipedia, April 11, 2024, https://en.wikipedia.org/w/index.php?title=XML_namespace.

END%%

Bibliography