Inkscape
Vector Graphics Editor
Inkscape::XML Namespace Reference

@Inkscape XML tree. More...

Classes

class  AttributeRecord
 Key-value pair representing an attribute. More...
 
struct  CommentNode
 Comment node, e.g. More...
 
class  CompositeNodeObserver
 An observer that relays notifications to multiple other observers. More...
 
struct  Document
 Interface for XML documents. More...
 
class  ElementNode
 Element node, e.g. More...
 
class  Event
 Enumeration of all XML event types. More...
 
class  EventAdd
 Object representing child addition. More...
 
class  EventChgAttr
 Object representing attribute change. More...
 
class  EventChgContent
 Object representing content change. More...
 
class  EventChgElementName
 Object representing element name change. More...
 
class  EventChgOrder
 Object representing child order change. More...
 
class  EventDel
 Object representing child removal. More...
 
class  InvalidOperationException
 
class  LogBuilder
 Event log builder. More...
 
class  Node
 Interface for refcounted XML nodes. More...
 
class  NodeObserver
 Interface for XML node observers. More...
 
struct  NodeParentIteratorStrategy
 
struct  NodeSiblingIteratorStrategy
 
struct  PINode
 Processing instruction node, e.g. More...
 
class  SignalObserver
 
class  SimpleDocument
 
class  SimpleNode
 Default implementation of the XML node stored in memory. More...
 
class  Subtree
 Represents a node and all its descendants. More...
 
struct  TextNode
 Text node, e.g. More...
 

Typedefs

typedef Inkscape::Util::ForwardPointerIterator< Node, NodeSiblingIteratorStrategyNodeSiblingIterator
 
typedef Inkscape::Util::ForwardPointerIterator< Node const, NodeSiblingIteratorStrategyNodeConstSiblingIterator
 
typedef Inkscape::Util::ForwardPointerIterator< Node, NodeParentIteratorStrategyNodeParentIterator
 
typedef Inkscape::Util::ForwardPointerIterator< Node const, NodeParentIteratorStrategyNodeConstParentIterator
 
using AttributeVector = std::vector< AttributeRecord, Inkscape::GC::Alloc< AttributeRecord > >
 

Enumerations

enum class  NodeType {
  DOCUMENT_NODE , ELEMENT_NODE , TEXT_NODE , COMMENT_NODE ,
  PI_NODE
}
 Enumeration containing all supported node types. More...
 

Functions

static CRXMLNodePtr get_parent (CRXMLNodePtr n)
 
static CRXMLNodePtr get_first_child (CRXMLNodePtr n)
 
static CRXMLNodePtr get_next (CRXMLNodePtr n)
 
static CRXMLNodePtr get_prev (CRXMLNodePtr cn)
 
static char * get_attr (CRXMLNodePtr n, char const *a)
 
static char const * get_local_name (CRXMLNodePtr n)
 
static gboolean is_element_node (CRXMLNodePtr n)
 
void replay_log_to_observer (Event const *log, NodeObserver &observer)
 
void undo_log_to_observer (Event const *log, NodeObserver &observer)
 
bool id_permitted (Node const *node)
 
Nodeprevious_node (Node *node)
 
Node const * next_node (Node const *node)
 
Node const * previous_node (Node const *node)
 
Node const * parent_node (Node const *node)
 
void rebase_hrefs (Inkscape::XML::Node *rootxml, gchar const *const old_base, gchar const *const new_base, bool const spns)
 Change relative hrefs in current root XML node (faster than full document generation) More...
 
void rebase_hrefs (SPDocument *doc, char const *new_base, bool spns)
 Change relative hrefs in doc to be relative to new_base instead of doc.base. More...
 
AttributeVector rebase_href_attrs (char const *old_abs_base, char const *new_abs_base, const AttributeVector &attributes)
 Change relative xlink:href attributes to be relative to new_abs_base instead of old_abs_base. More...
 
bool string_equal (const gchar *a, const gchar *b)
 

Variables

CRNodeIface const croco_node_iface
 Interface for XML nodes used by libcroco. More...
 

Detailed Description

@Inkscape XML tree.

This namespace contains classes and functions that comprise the XML tree of Inkscape documents.

SVG documents in Inkscape are represented as two parallel hierarchies of nodes: the object tree, which contains all information about the document's state when loaded, and the XML tree, which contains all information about the document's XML representation. For this reason this tree is also called the "repr tree", and XML nodes are called "reprs".

The central class is XML::Node, which provides all operations. It should be noted that nodes are currently typeless and operations not valid for their type simply do nothing (like trying to iterate over children of a text node). In addition to standard DOM operations, the XML tree supports observers - objects derived from Xml::NodeObserver which receive notifications about changes in the document tree.

Typedef Documentation

◆ AttributeVector

Definition at line 34 of file node.h.

◆ NodeConstParentIterator

◆ NodeConstSiblingIterator

◆ NodeParentIterator

◆ NodeSiblingIterator

Enumeration Type Documentation

◆ NodeType

enum class Inkscape::XML::NodeType
strong

Enumeration containing all supported node types.

Enumerator
DOCUMENT_NODE 

Top-level document node. Do not confuse with the root node.

ELEMENT_NODE 

Regular element node, e.g. <group />.

TEXT_NODE 

Text node, e.g. "Some text" in <group>Some text</group> is represented by a text node.

COMMENT_NODE 

Comment node, e.g. <!– some comment –>.

PI_NODE 

Processing instruction node, e.g. <?xml version="1.0" encoding="utf-8" standalone="no"?>.

Definition at line 39 of file node.h.

Function Documentation

◆ get_attr()

static char * Inkscape::XML::get_attr ( CRXMLNodePtr  n,
char const *  a 
)
static

Definition at line 47 of file croco-node-iface.cpp.

References Spiro::n.

◆ get_first_child()

static CRXMLNodePtr Inkscape::XML::get_first_child ( CRXMLNodePtr  n)
static

Definition at line 33 of file croco-node-iface.cpp.

References Spiro::n.

Referenced by Inkscape::UI::Widget::Bin::Bin().

◆ get_local_name()

static char const * Inkscape::XML::get_local_name ( CRXMLNodePtr  n)
static

Definition at line 52 of file croco-node-iface.cpp.

References local_part(), and Spiro::n.

◆ get_next()

static CRXMLNodePtr Inkscape::XML::get_next ( CRXMLNodePtr  n)
static

Definition at line 34 of file croco-node-iface.cpp.

References Spiro::n.

◆ get_parent()

◆ get_prev()

static CRXMLNodePtr Inkscape::XML::get_prev ( CRXMLNodePtr  cn)
static

Definition at line 36 of file croco-node-iface.cpp.

References Spiro::n.

◆ id_permitted()

bool Inkscape::XML::id_permitted ( Node const *  node)

◆ is_element_node()

static gboolean Inkscape::XML::is_element_node ( CRXMLNodePtr  n)
static

Definition at line 53 of file croco-node-iface.cpp.

References ELEMENT_NODE, and Spiro::n.

◆ next_node()

Node const * Inkscape::XML::next_node ( Node const *  node)
inline

◆ parent_node()

Node const * Inkscape::XML::parent_node ( Node const *  node)
inline

Definition at line 66 of file node-fns.h.

References node, and Inkscape::XML::Node::parent().

◆ previous_node() [1/2]

Node * Inkscape::XML::previous_node ( Node node)
related

◆ previous_node() [2/2]

Node const * Inkscape::XML::previous_node ( Node const *  node)
inline

Definition at line 51 of file node-fns.h.

References node, and previous_node().

◆ rebase_href_attrs()

AttributeVector Inkscape::XML::rebase_href_attrs ( char const *  old_abs_base,
char const *  new_abs_base,
const AttributeVector attributes 
)

Change relative xlink:href attributes to be relative to new_abs_base instead of old_abs_base.

Note that old_abs_base and new_abs_base must each be non-NULL, absolute directory paths.

Referenced by sp_repr_write_stream_element().

◆ rebase_hrefs() [1/2]

void Inkscape::XML::rebase_hrefs ( Inkscape::XML::Node rootxml,
gchar const *const  old_base,
gchar const *const  new_base,
bool const  spns 
)

Change relative hrefs in current root XML node (faster than full document generation)

to be relative to new_base instead of doc.base.

(NULL doc base or new_base is interpreted as current working directory.)

Parameters
spnsTrue if doc should contain sodipodi:absref attributes.

Definition at line 159 of file rebase-hrefs.cpp.

References Inkscape::XML::Node::name(), Inkscape::XML::Node::sp_repr_visit_descendants(), and Inkscape::URI::str().

Referenced by SPDocument::do_change_filename(), and file_import().

◆ rebase_hrefs() [2/2]

void Inkscape::XML::rebase_hrefs ( SPDocument doc,
char const *  new_base,
bool  spns 
)

Change relative hrefs in doc to be relative to new_base instead of doc.base.

(NULL doc base or new_base is interpreted as current working directory.)

Parameters
spnsTrue if doc should contain sodipodi:absref attributes.

◆ replay_log_to_observer()

void Inkscape::XML::replay_log_to_observer ( Event const *  log,
NodeObserver observer 
)

Definition at line 190 of file event.cpp.

References log(), and observer.

Referenced by sp_repr_debug_print_log(), and sp_repr_replay_log().

◆ string_equal()

bool Inkscape::XML::string_equal ( const gchar *  a,
const gchar *  b 
)

Definition at line 649 of file simple-node.cpp.

Referenced by Inkscape::XML::SimpleNode::equal().

◆ undo_log_to_observer()

void Inkscape::XML::undo_log_to_observer ( Event const *  log,
NodeObserver observer 
)

Definition at line 128 of file event.cpp.

References log(), and observer.

Referenced by sp_repr_undo_log().

Variable Documentation

◆ croco_node_iface

CRNodeIface const Inkscape::XML::croco_node_iface
Initial value:
= {
g_free,
}
static CRXMLNodePtr get_first_child(CRXMLNodePtr n)
static char * get_attr(CRXMLNodePtr n, char const *a)
static CRXMLNodePtr get_next(CRXMLNodePtr n)
static CRXMLNodePtr get_parent(CRXMLNodePtr n)
static char const * get_local_name(CRXMLNodePtr n)
static CRXMLNodePtr get_prev(CRXMLNodePtr cn)
static gboolean is_element_node(CRXMLNodePtr n)

Interface for XML nodes used by libcroco.

This structure defines operations on Inkscape::XML::Node used by the libcroco CSS parsing library.

Definition at line 62 of file croco-node-iface.cpp.

Referenced by SPDocument::getObjectsBySelector(), and sp_repr_sel_eng().