eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'XML::Element':

Home

Documentation
www.exept.de
Everywhere
for:
[back]

Class: Element (in XML)


Inheritance:

   Object
   |
   +--XML::Node
      |
      +--XML::Element

Package:
stx:goodies/xml/vw
Category:
XML-VW-Nodes
Version:
rev: 1.63 date: 2018/11/02 00:32:55
user: cg
file: Element.st directory: goodies/xml/vw
module: stx stc-classLibrary: vw

Description:


XML document element boundaries are either delimited by start-tags and end-tags, or, for empty elements, by an empty-element tag. Each element has a type, identified by name, sometimes called its "generic identifier" (GI), and may have a set of attribute specifications. Each attribute specification has a name and a value.

Instance Variables:
	tag     <String | NodeTag>  the identifier for the element
	attributes      <Collection>  the element's attributes
	namespaces      <Dictionary>  a mapping of tag qualifiers to namespace URIs
	elements        <SequenceableCollection>  child text, comments, PIs and elements
	userData        <Object>  extra space for a client program to add annotations
	definition      <XML.Pattern>  defines the type constraints for the content


Class protocol:

instance creation
o  new

o  tag: tag
Modified (format): / 18-07-2018 / 11:53:15 / Claus Gittinger

o  tag: tag attributes: attributes

o  tag: tag attributes: attributes elements: elements
Modified (format): / 18-07-2018 / 11:53:10 / Claus Gittinger

o  tag: tag elements: elements
Modified (format): / 18-07-2018 / 11:53:02 / Claus Gittinger


Instance protocol:

accessing
o  anyElementNamed: elementName
Answer the one and only element named elementName.
Raise an error, if there is not exactly one element.
This will return the receiver if its name matches the requirement.

o  anyElementsNamed: elementName
Traverse the tree and return all the elements named elementName

o  attributeNamed: attributeName
##add MU 11/7/2000 13:38

o  attributes

o  characterData
return all concatenated character data

o  characterDataDo: aBlock
recursively apply aBlock for every characterdata piece

o  characterDataOnto: str

o  childNodes
##add -umejava

o  definition

o  definition: aPattern

o  description

o  elementNamed: elementName

o  elementNamed: elementName ifAbsent: exceptionValue

o  elements

o  elementsNamed: elementName

o  elementsWithTextDo: aBlock
return all text elements

o  elementsWithTexts
return all text elements

o  elementsWithoutTexts
return a collection of all non-text elements

o  elementsWithoutTextsDo: aBlock
evaluate a block for all non-text elements

o  expandedName

o  hasElementNamed: elementName

o  hasElementsWithoutText
answer true, if there is a subelement, which is not text

o  indexOf: aChild

o  localName
for compatibility with YAXO nodes

o  namespaces: aDictionary

o  selectNodes: aBlock

o  tag

o  tagName

o  valueOfAttribute: attributeName ifAbsent: aBlock

accessing - xpath like
o  / anElementName
XPath like processing - answer all the elements named anElementName

o  // anElementName
XPath like processing - traverse the tree and answer all the elements named anElementName

o  /@ anAttributeName
XPath like processing - answer a nodeSet with attributes named anAttributeName

o  @ anAttributeName
XPath like processing - answer the attribute named anAttributeName

o  addAllAttributesNamed: attributeName to: aCollection
Recursively (depth-first) traverse the element tree and add any
sub-elements atributes named attributeName to aCollection

o  addAllElementsNamed: elementName to: aCollection
Recursively (depth-first) traverse the element tree and add any
sub-element named elementName to aCollection

o  addAttributesNamed: anAttributeName to: aCollection
XPath like processing - add attributes named anAttributeName to aCollection

o  addElementsNamed: elementName to: aCollection
Traverse the tree and add the direct child elements named elementName to aCollection

o  allAttributesNamed: attributeName do: aBlock
Recursively (depth-first) traverse the element tree and evaluate aBlock for each

o  allElementsNamed: elementName do: aBlock
Recursively (depth-first) traverse the element tree and evaluates aBlock for each

o  attributesNamed: anAttributeName do: aBlock
XPath like processing - evaluate aBlock for all attributes named anAttributeName

comparing
o  = anXmlElement

o  hash

copying
o  cloneTree
answer a copy of the tree, so that removal of child elements
from the copy does not affect the original node.

enumerating
o  childElementsDo: aBlock
enumerate my direct child-elements and
evaluate aBlock for each.

o  elementsDo: aBlock
recursively (depth-first) descend into my child-elements and
evaluate aBlock for each sub-element.
Bad naming: should be called allElementsDo:

o  nodesDo: aBlock
Evaluate aBlock for myself and recursively (depth-first) descend into my child-nodes and
evaluate aBlock for each sub-node.
Enumerates both attributes and elements

o  nodesReverseDo: aBlock

o  saxDo: aDriver forBodyDo: aBlock
a variation on #saxDo: that lets the client
control how the body of the element is to be
printed.

initialization
o  initialize

modifying
o  addNode: aNode
the following might look ugly, but saves a lot of memory,

o  removeAllNodes
##add -umejava

o  removeNode: aNode
remove a child node; raises an error if the given argument is
not a child of the receiver

namespaces
o  namespaceAt: qualifier

o  qualifierAtNamespace: ns

printing
o  prettyPrintColorizedOn: aStream depth: indent

o  prettyPrintOn: aStream depth: indent
(comment from inherited method)
self subclassResponsibility

o  printAsOneLineOn: aStream

o  printCanonicalOn: aStream
reject: [:str | str isBlankText]

o  printHTMLOn: aStream
reject: [:str | str isBlankText]

o  printNoIndentOn: aStream endSpacing: endSpacingBlock spacing: spacingBlock
(comment from inherited method)
Print myself on the stream with line breaks between adjacent
elements, but no indentation.

o  simpleDescription

private
o  attributes: a

o  condenseList
condense the elements list;
if it is empty, make it nil;
otherwise, make it an array

o  condenseText
concatenate text elements into the smallest number of elements.
Return the receiver

o  elements: e

o  setAttributes: aCollection
private entries to set the attributes without reparenting

o  setElements: aCollection
private entries to set the elements without condensing

o  setTag: t attributes: a elements: e

private helpers
o  treePositionOf: aNode

testing
o  hasSubNodes

o  isContent

o  isElement

o  isEmpty

o  isHTMLBlock

o  isLike: aNode

o  verifyContents

visiting
o  acceptVisitor: aVisitor
Double dispatch back to the visitor, passing my type encoded in
the selector (visitor pattern)



ST/X 7.2.0.0; WebServer 1.670 at bd0aa1f87cdd.unknown:8081; Thu, 14 Nov 2019 18:57:17 GMT