1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/content/xml/tests/docbooktest.xml Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,126 @@ 1.4 +<?xml version="1.0"?> 1.5 +<?xml-stylesheet href="docbook.css" type="text/css"?> 1.6 +<!DOCTYPE Book SYSTEM "docbook.dtd"> 1.7 +<Book xmlns:xlink="http://www.w3.org/1999/xlink"> 1.8 +<Title>SoftQuad 1.9 +Inc.</Title> 1.10 +<p xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://www.w3.org/1999/xhtml"> 1.11 +<h:img src="flamer.gif"/> 1.12 +<img src="flamer.gif"/> 1.13 +<button><b>some text</b></button> 1.14 +</p> 1.15 +<BookInfo> <BookBiblio> <Title>Demo Product Documentation</Title> 1.16 +<AuthorGroup><CorpAuthor>SoftQuad Inc.</CorpAuthor></AuthorGroup> 1.17 +</BookBiblio> </BookInfo> <Preface> <Title><Anchor 1.18 +Id="SDK3"/>Element Overview</Title> 1.19 +<BridgeHead>Introduction to Elements</BridgeHead> 1.20 +<Para>By far the vast majority of objects (apart from text) that authors 1.21 +encounter when traversing a document are Element nodes. </Para> </Preface> 1.22 +<Part> <Title><Anchor Id="SDK273"/>Element Interfaces</Title> 1.23 +<Chapter Label="1"> <Title><Anchor Id="SDK274"/>Elements and 1.24 +Attributes</Title> 1.25 +<Sect1> <Title><Anchor Id="SDK279"/>Introduction to Attributes 1.26 +</Title> 1.27 +<Para>Elements may have attributes associated with them; since the Element 1.28 +interface inherits from Node, the generic Node interface method 1.29 +<Function>getAttributes</Function> may be used to retrieve the set of all 1.30 +attributes for an element. </Para> 1.31 +<Para>There are methods on the Element interface to retrieve either an Attr 1.32 +object by name or an attribute value by name. In XML, where an attribute value 1.33 +may contain entity references, an Attr object should be retrieved to examine 1.34 +the possibly fairly complex sub-tree representing the attribute value. On the 1.35 +other hand, in HTML, where all attributes have simple string values, methods to 1.36 +directly access an attribute value can safely be used as a convenience. </Para> 1.37 + 1.38 +<Para>Before you can access an Attribute, you must first gain access to the 1.39 +associated Element.</Para> </Sect1> 1.40 +<Sect1> <Title><Anchor Id="SDK378"/>Setting the Attribute 1.41 +Values</Title> 1.42 +<Para>Attr objects inherit the Node interface, but since they are not actually 1.43 +child nodes of the element they describe, the DOM does not consider them part 1.44 +of the document tree. Thus, the Node attributes parentNode, previousSibling, 1.45 +and nextSibling have a null value for Attr objects. The DOM takes the view that 1.46 +attributes are properties of elements rather than having a separate identity 1.47 +from the elements they are associated with; this should make it more efficient 1.48 +to implement such features as default attributes associated with all elements 1.49 +of a given type. Furthermore, Attr nodes may not be immediate children of a 1.50 +DocumentFragment. However, they can be associated with Element nodes contained 1.51 +within a DocumentFragment. In short, users and implementors of the DOM need to 1.52 +be aware that Attr nodes have some things in common with other objects 1.53 +inheriting the Node interface, but they also are quite distinct. </Para> 1.54 +<Para>The attribute's effective value is determined as follows:</Para> 1.55 +<ItemizedList Mark="Bullet"> <ListItem> 1.56 +<Para>If this attribute has been explicitly assigned any value, that value is 1.57 +the attribute's effective value</Para></ListItem> <ListItem> 1.58 +<Para>Otherwise, if there is a declaration for this attribute, and that 1.59 +declaration includes a default value, then that default value is the 1.60 +attribute's effective value</Para></ListItem> <ListItem> 1.61 +<Para>Otherwise, the attribute does not exist on this element in the structure 1.62 +model until it has been explicitly added.</Para></ListItem> </ItemizedList> 1.63 +<Para>In XML, where the value of an attribute can contain entity references, 1.64 +the child nodes of the Attr node provide a representation in which entity 1.65 +references are not expanded. These child nodes may be either Text or 1.66 +EntityReference nodes. Because the attribute type may be unknown, there are no 1.67 +tokenized attribute values. </Para> 1.68 +<Para>The following topics describe DOM attributes: </Para> 1.69 +<ItemizedList Mark="Bullet"> <ListItem> 1.70 +<Para> 1.71 +<ULink xlink:type="simple" xlink:show="replace" 1.72 + xlink:href="http://www.w3.org/TR/REC-DOM-Level-1/level-one-core.html#ID-637646024">Interface 1.73 +Attr</ULink> </Para></ListItem> <ListItem> 1.74 +<Para> 1.75 +<ULink xlink:type="simple" xlink:show="new" 1.76 + xlink:href="http://www.w3.org/TR/REC-DOM-Level-1/level-one-core.html#ID-745549614"> 1.77 +Interface Element</ULink> </Para></ListItem> </ItemizedList> </Sect1></Chapter> 1.78 + 1.79 +<Chapter Label="26" Role="funcref"> <Title><Anchor 1.80 +Id="SDK48"/>DOM Level 1 Core: Element Functions</Title> 1.81 +<RefEntry> <RefMeta><RefEntryTitle> <Anchor Id="setAttribute"/>setAttribute 1.82 +</RefEntryTitle></RefMeta> <RefNameDiv> <RefName>setAttribute</RefName> 1.83 +<RefPurpose>Sets the Attributes on the associated Element object</RefPurpose> 1.84 +<RefClass>Fundamental</RefClass> </RefNameDiv> <RefSynopsisDiv> <Title> 1.85 +<Anchor Id="SDK85"/>Syntax</Title> 1.86 +<RefSect2> <Title>OMG IDL</Title> 1.87 +<Synopsis><Type>void</Type> <Function>setAttribute</Function> (in 1.88 +<Type>DOMString</Type> <Parameter>name</Parameter>, in <Type>DOMString</Type> 1.89 +<Parameter>value</Parameter>) raises (<ErrorType>DOMException</ErrorType>); 1.90 +</Synopsis></RefSect2><RefSect2> <Title><Anchor Id="SDK86"/>Java</Title> 1.91 +<Synopsis><Type>public void</Type> <Function>setAttribute</Function> ( 1.92 +<Type>String</Type> <Parameter>name</Parameter>, <Type>String</Type> 1.93 +<Parameter>value</Parameter>) throws (<ErrorType>DOMException</ErrorType>); 1.94 +</Synopsis> </RefSect2><RefSect2> <Title><Anchor Id="SDK87"/>ECMA Script 1.95 +</Title> 1.96 +<Synopsis> <Function>setAttribute</Function> (<Parameter>name, value 1.97 +</Parameter>)</Synopsis> </RefSect2></RefSynopsisDiv><RefSect1> <Title> 1.98 +<Anchor Id="SDK88"/>Parameters</Title> 1.99 +<VariableList> <VarListEntry><Term> <Parameter>name</Parameter></Term> 1.100 +<ListItem> 1.101 +<Para>(IN) The name of the attribute to create or alter.</Para> </ListItem> 1.102 +</VarListEntry><VarListEntry><Term> <Parameter>value</Parameter></Term> 1.103 +<ListItem> 1.104 +<Para>(IN) Value to set in string form</Para> </ListItem></VarListEntry> 1.105 +</VariableList></RefSect1><RefSect1> <Title><Anchor Id="SDK89"/>Exceptions 1.106 +</Title> 1.107 +<Para>These are the applicable exceptions. </Para> <InformalTable> <TGroup cols="2"> 1.108 +<colspec colname="1" colnum="1" colwidth="0.630in"/> 1.109 +<colspec colname="2" colnum="2" colwidth="5.203in"/> <tbody> 1.110 +<row> <entry colname="1"> 1.111 +<Para>INVALID_CHARACTER_ERR</Para></entry> <entry colname="2"> 1.112 +<Para>Raised if the specified name contains an invalid character.</Para> 1.113 +</entry></row> <row> <entry colname="1"> 1.114 +<Para> NO_MODIFICATION_ALLOWED_ERR</Para></entry> <entry colname="2"> 1.115 +<Para>Raised if this node is readonly.</Para></entry> </row> 1.116 +</tbody> 1.117 +</TGroup></InformalTable></RefSect1><RefSect1> <Title><Anchor 1.118 +Id="SDK90"/>Remarks</Title> 1.119 +<Para> <Function>setAttribute</Function> adds a new attribute. If an attribute 1.120 +with that name is already present in the element, its value is changed to be 1.121 +that of the value parameter. This value is a simple string, it is not parsed as 1.122 +it is being set. So any markup (such as syntax to be recognized as an entity 1.123 +reference) is treated as literal text, and needs to be appropriately escaped by 1.124 +the implementation when it is written out.</Para> 1.125 +<Para> In order to assign an attribute value that contains entity references, 1.126 +the user must create an Attr node plus any Text and EntityReference nodes, 1.127 +build the appropriate subtree, and use <Function>setAttributeNode</Function> to 1.128 +assign it as the value of an attribute. </Para> </RefSect1></RefEntry> 1.129 +</Chapter></Part></Book>