xml.dom --- ããã¥ã¡ã³ããªããžã§ã¯ãã¢ãã« API¶
ãœãŒã¹ã³ãŒã: Lib/xml/dom/__init__.py
ææžãªããžã§ã¯ãã¢ãã« (Document Object Model)ãããªãã¡ "DOM" ã¯ãã¯ãŒã«ãã¯ã€ããŠã§ãã³ã³ãœãŒã·ã¢ã (World Wide Web Consortium, W3C) ã«ãããXML ããã¥ã¡ã³ãã«ã¢ã¯ã»ã¹ããã倿Žãå ãããããããã®ãããã°ã©ãã³ã°èšèªéå ±éã® API ã§ããDOM å®è£ ã«ãã£ãŠãXML ããã¥ã¡ã³ãã¯ããªãŒæ§é ãšããŠè¡šçŸãããŸãããŸããã¯ã©ã€ã¢ã³ãã³ãŒãåŽã§ããªãŒæ§é ããŒãããæ§ç¯ã§ããããã«ãªããŸããããã«ãåè¿°ã®æ§é ã«å¯ŸããŠãããç¥ãããã€ã³ã¿ãŒãã§ãŒã¹ããã€äžé£ã®ãªããžã§ã¯ããéããã¢ã¯ã»ã¹ææ®µãæäŸããŸãã
DOM ã¯ã©ã³ãã ã¢ã¯ã»ã¹ãè¡ãã¢ããªã±ãŒã·ã§ã³ã§éåžžã«æçšã§ããSAX ã§ã¯ãäžåºŠã«é²èЧããããšãã§ããã®ã¯ããã¥ã¡ã³ãã®ã»ãã®äžéšåã§ãããã SAX èŠçŽ ã«æ³šç®ããŠããéã«ã¯ãå¥ã®èŠçŽ ãã¢ã¯ã»ã¹ããããšã¯ã§ããŸããããŸãããã¹ãããŒãã«æ³šç®ããŠãããšãã«ã¯ããã®äžã«å ¥ã£ãŠããèŠçŽ ãã¢ã¯ã»ã¹ããããšãã§ããŸãããSAX ã«ããã¢ããªã±ãŒã·ã§ã³ãæžããšãã«ã¯ãããã°ã©ã ãããã¥ã¡ã³ãå ã®ã©ããåŠçããŠããã®ãã远跡ãããããã³ãŒãã®ã©ããã«èšè¿°ããå¿ èŠããããŸããSAX èªäœããã®äœæ¥ãè¡ã£ãŠãããããšã¯ãããŸãããããã«ãXML ããã¥ã¡ã³ãã«å¯Ÿããå èªã¿ (look ahead) ãå¿ èŠã ãšãããšäžéãªããšã«ãªããŸãã
ã¢ããªã±ãŒã·ã§ã³ã«ãã£ãŠã¯ãããªãŒã«ã¢ã¯ã»ã¹ã§ããªããã°ã€ãã³ãé§åã¢ãã«ãå®çŸã§ããŸããããã¡ãããäœããã®ããªãŒã SAX ã€ãã³ãã«å¿ããŠèªåã§æ§ç¯ããããšãã§ããã§ãããããDOM ã§ã¯ãã®ãããªã³ãŒããæžããªããŠããããªããŸããDOM 㯠XML ããŒã¿ã«å¯ŸããæšæºçãªããªãŒè¡šçŸãªã®ã§ãã
ææžãªããžã§ã¯ãã¢ãã«ã¯ãW3C ã«ãã£ãŠããã€ãã®æ®µéãW3C ã®çšèªã§èšãã° "ã¬ãã« (level)" ã§å®çŸ©ãããŠããŸããPython ã«ãããŠã¯ãDOM API ãžã®å¯Ÿå¿ä»ãã¯å®è³ªçã«ã¯ DOM ã¬ãã« 2 å§åã«åºã¥ããŠããŸãã
DOM ã¢ããªã±ãŒã·ã§ã³ã¯ãæ®é㯠XML ã DOM ã«è§£æãããšããããå§ãŸããŸããã©ã®ããã«ããŠè§£æãè¡ããã«ã€ããŠã¯ DOM ã¬ãã« 1 ã§ã¯å
šãã«ããŒããŠããããã¬ãã« 2 ã§ã¯éå®çãªæ¹è¯ã ããè¡ãããŸãã: ã¬ãã« 2 ã§ã¯ Document ãçæããã¡ãœãããæäŸãã DOMImplementation ãªããžã§ã¯ãã¯ã©ã¹ããããŸãããå®è£
ã«äŸåããªãæ¹æ³ã§ XML ãªãŒã(reader)/ããŒã¶(parser)/ææžãã«ã (Document builder) ã«ã¢ã¯ã»ã¹ããæ¹æ³ã¯ãããŸããããŸããæ¢åã® Document ãªããžã§ã¯ããªãã«ãããã®ã¡ãœããã«ã¢ã¯ã»ã¹ãããããªãããå®çŸ©ãããæ¹æ³ããããŸããã Python ã§ã¯ãåã
ã® DOM å®è£
ã§ getDOMImplementation() ãå®çŸ©ãããŠããã¯ãã§ãã DOM ã¬ãã« 3 ã§ã¯ããŒã(Load)/ã¹ãã¢(Store) 仿§ã远å ããããªãŒãã®ã€ã³ã¿ãŒãã§ãŒã¹ã«ãå®çŸ©ããŠããŸãããPython æšæºã©ã€ãã©ãªã§ã¯ãŸã å©çšããããšãã§ããŸããã
DOM ææžãªããžã§ã¯ããçæãããããã®ããããã£ãšã¡ãœããã䜿ã£ãŠ XML ææžã®äžéšã«ã¢ã¯ã»ã¹ã§ããŸãããããã®ããããã£ã¯ DOM 仿§ã§å®çŸ©ãããŠããŸã; æ¬ãªãã¡ã¬ã³ã¹ããã¥ã¢ã«ã§ã¯ãPython ã«ãã㊠DOM 仿§ãã©ã®ããã«è§£éãããŠããããèšè¿°ããŠããŸãã
W3C ããæäŸãããŠãã仿§ã¯ã DOM API ã JavaãECMAScriptãããã³ OMG IDL ã§å®çŸ©ããŠããŸããããã§å®çŸ©ãããŠãã Python ã§ã®å¯Ÿå¿ã¥ãã¯ã倧éšåããã®ä»æ§ã® IDL çã«åºã¥ããŠããŸãããå³å¯ãªæºæ ã¯å¿ èŠãšãããŠããŸãã (å®è£ ã§ IDL ã®å³å¯ãªå¯Ÿå¿ä»ãããµããŒãããã®ã¯èªç±ã§ãã)ãAPI ãžã®å¯Ÿå¿ä»ãã«é¢ãã詳现ãªè°è«ã¯ é©åæ§ ãåç §ããŠãã ããã
åè
- Document Object Model (DOM) Level 2 Specification
Python DOM API ãæºæ ããŠãã W3C å§åã
- Document Object Model (DOM) Level 1 Specification
xml.dom.minidomã§ãµããŒããããŠãã W3C ã® DOM ã«é¢ããå§åã- Python Language Mapping Specification
ãã®ããã¥ã¡ã³ãã§ã¯ OMG IDL ãã Python ãžã®å¯Ÿå¿ä»ããèšè¿°ããŠããŸãã
ã¢ãžã¥ãŒã«ã³ã³ãã³ã¶
The xml.dom contains the following functions:
- xml.dom.registerDOMImplementation(name, factory)¶
ãã¡ã¯ããªé¢æ° (factory function) factory ãåå name ã§ç»é²ããŸãããã¡ã¯ããªé¢æ°ã¯
DOMImplementationã€ã³ã¿ãŒãã§ãŒã¹ãå®è£ ãããªããžã§ã¯ããè¿ããªããã°ãªããŸãããç¹å®ã®å®è£ (äŸãã°å®è£ ãäœããã®ã«ã¹ã¿ãã€ãºããµããŒãããŠããå Žå) ã«é©åãšãªãããã«ããã¡ã¯ããªé¢æ°ã¯æ¯ååããªããžã§ã¯ããè¿ããããåŒã³åºãããšã«æ°ãããªããžã§ã¯ããè¿ãããããããšãåºæ¥ãŸãã
- xml.dom.getDOMImplementation(name=None, features=())¶
Return a suitable DOM implementation. The name is either well-known, the module name of a DOM implementation, or
None. If it is notNone, imports the corresponding module and returns aDOMImplementationobject if the import succeeds. If no name is given, and if the environment variablePYTHON_DOMis set, this variable is used to find the implementation. The only well-known name in the standard library is'minidom', forxml.dom.minidom.If name is not given, this examines the available implementations to find one with the required feature set. If no implementation can be found, raise an
ImportError. The features list must be a sequence of(feature, version)pairs which are passed to thehasFeature()method on availableDOMImplementationobjects.
ããã€ãã®äŸ¿å©ãªå®æ°ãæäŸãããŠããŸã:
- xml.dom.EMPTY_NAMESPACE¶
The value used to indicate that no namespace is associated with a node in the DOM. This is typically found as the
namespaceURIof a node, or used as the namespaceURI parameter to a namespaces-specific method.
- xml.dom.XML_NAMESPACE¶
Namespaces in XML (4 ç¯) ã§å®çŸ©ãããŠãããäºçŽæžã¿ãã¬ãã£ã¯ã¹ (reserved prefix)
xmlã«é¢é£ä»ããããåå空é URI ã§ãã
- xml.dom.XMLNS_NAMESPACE¶
Document Object Model (DOM) Level 2 Core Specification (1.1.8 ç¯) ã§å®çŸ©ãããŠãããåå空é宣èšãžã®åå空é URI ã§ãã
- xml.dom.XHTML_NAMESPACE¶
XHTML 1.0: The Extensible HyperText Markup Language (3.1.1 ç¯) ã§å®çŸ©ãããŠãããXHTML åå空é URI ã§ãã
In addition, xml.dom contains a base Node class and the DOM
exception classes. The Node class provided by this module does not
implement any of the methods or attributes defined by the DOM specification;
concrete DOM implementations must provide those. The Node class
provided as part of this module does provide the constants used for the
nodeType attribute on concrete Node objects; they are located
within the class rather than at the module level to conform with the DOM
specifications.
DOM å ã®ãªããžã§ã¯ã¶
DOM ã«ã€ããŠæãæç¢ºã«éå®ããŠããããã¥ã¡ã³ã㯠W3C ã«ãã DOM 仿§ã§ãã
The names documented in this section are DOM interfaces.
With the exception of Node and the exception classes,
they are not provided by the xml.dom module itself,
but by concrete DOM implementations, such as xml.dom.minidom.
DOM 屿§ã¯åçŽãªæååãšããŠã ãã§ã¯ãªããããŒããšããŠæäœããããããããªãã®ã§æ³šæããŠãã ããããšã¯ãããããããªããã°ãªããªãå Žåã¯ããªãçšãªã®ã§ãä»ã®ãšããèšè¿°ãããŠããŸããã
ã€ã³ã¿ãŒãã§ãŒã¹ |
ç¯ |
ç®ç |
|---|---|---|
æ ¹åºã«ããå®è£ ãžã®ã€ã³ã¿ãŒãã§ãŒã¹ã |
||
ããã¥ã¡ã³ãå ã®å€§éšåã®ãªããžã§ã¯ãã«å¯Ÿããåºåºã€ã³ã¿ãŒãã§ãŒã¹ã |
||
ããŒãåã«å¯Ÿããã€ã³ã¿ãŒãã§ãŒã¹ã |
||
ããã¥ã¡ã³ãã®åŠçã«å¿ èŠãªå®£èšã«ã€ããŠã®æ å ±ã |
||
ããã¥ã¡ã³ãå šäœã衚çŸãããªããžã§ã¯ãã |
||
ããã¥ã¡ã³ãéå±€å ã®èŠçŽ ããŒãã |
||
èŠçŽ ããŒãäžã®å±æ§å€ããŒãã |
||
ãœãŒã¹ããã¥ã¡ã³ãå ã®ã³ã¡ã³ã衚çŸã |
||
Text ãªããžã§ã¯ãããã³ CDATASection ãªããžã§ã¯ã |
ããã¥ã¡ã³ãå ã®ããã¹ãèšè¿°ãå«ãããŒãã |
|
åŠçåœä»€ (processing instruction) 衚çŸã |
ããã«è¿œå ã®ç¯ãšããŠãPython ã§ DOM ãå©çšããããã«å®çŸ©ãããŠããäŸå€ã«ã€ããŠèšè¿°ããŠããŸãã
DOMImplementation ãªããžã§ã¯ã¶
DOMImplementation ã€ã³ã¿ãŒãã§ãŒã¹ã¯ãå©çšããŠãã DOM å®è£
ã«ãããŠç¹å®ã®æ©èœãå©çšå¯èœãã©ãããæ±ºå®ããããã®æ¹æ³ãã¢ããªã±ãŒã·ã§ã³ã«æäŸããŸããDOM ã¬ãã« 2 ã§ã¯ã DOMImplementation ã䜿ã£ãŠæ°ã㪠Document ãªããžã§ã¯ãã DocumentType ãªããžã§ã¯ããçæããæ©èœã远å ããŠããŸãã
- DOMImplementation.hasFeature(feature, version)¶
æ©èœå feature ãšããŒãžã§ã³çªå· version ã§èå¥ãããæ©èœïŒfeatureïŒãå®è£ ãããŠããã°
Trueãè¿ããŸãã
- DOMImplementation.createDocument(namespaceUri, qualifiedName, doctype)¶
æ°ããª(DOMã®ã¹ãŒããŒã¯ã©ã¹ã§ãã)
Documentã¯ã©ã¹ã®ãªããžã§ã¯ããè¿ããŸãããã®ã¯ã©ã¹ã¯ namespaceUri ãš qualifiedName ãèšå®ãããåã¯ã©ã¹Elementã®ãªããžã§ã¯ããææããŠããŸãã doctype ã¯createDocumentType()ã«ãã£ãŠçæãããDocumentTypeã¯ã©ã¹ã®ãªããžã§ã¯ãããŸãã¯Noneã§ããå¿ èŠããããŸãã Python DOM APIã§ã¯ãåã¯ã©ã¹ã§ããElementãäœæããªãããšã瀺ãããã«ãã¯ããã®ïŒã€ã®åŒæ°ãNoneã«èšå®ããããšãã§ããŸãã
- DOMImplementation.createDocumentType(qualifiedName, publicId, systemId)¶
æ°ããª
DocumentTypeã¯ã©ã¹ã®ãªããžã§ã¯ããè¿ããŸãããã®ãªããžã§ã¯ã㯠qualifiedName ã publicId ããã㊠systemId æååããµããã§ãããXMLææžã®åœ¢åŒæ å ±ã衚çŸããŠããŸãã
Node ãªããžã§ã¯ã¶
XML ææžã®å
šãŠã®æ§æèŠçŽ ã¯ Node ã®ãµãã¯ã©ã¹ã§ãã
Only nodes of the following types can have children, and only children of the listed types:
Documentat most one
Element, at most oneDocumentType,ProcessingInstructionandCommentDocumentFragmentandElementElement,Text,CDATASection,ProcessingInstructionandCommentAttr
Nodes of other types cannot have children.
Inserting a child of a not allowed type raises HierarchyRequestErr.
- Node.nodeType¶
An integer representing the node type. Symbolic constants for the types are on the
Nodeobject. This is a read-only attribute.
- Node.ELEMENT_NODE¶
- Node.ATTRIBUTE_NODE¶
- Node.TEXT_NODE¶
- Node.CDATA_SECTION_NODE¶
- Node.ENTITY_REFERENCE_NODE¶
- Node.ENTITY_NODE¶
- Node.PROCESSING_INSTRUCTION_NODE¶
- Node.COMMENT_NODE¶
- Node.DOCUMENT_NODE¶
- Node.DOCUMENT_TYPE_NODE¶
- Node.DOCUMENT_FRAGMENT_NODE¶
- Node.NOTATION_NODE¶
Integer constants for the possible values of the
nodeTypeattribute.
- Node.parentNode¶
çŸåšã®ããŒãã®èŠªããŒãããææžããŒãã®å Žåã«ã¯
Noneã«ãªããŸãããã®å€ã¯åžžã«Nodeãªããžã§ã¯ããNoneã«ãªããŸããElementããŒãã®å Žåããã®å€ã¯ã«ãŒãèŠçŽ (root element) ã®å Žåãé€ã芪èŠçŽ (parent element) ãšãªããã«ãŒãèŠçŽ ã®å Žåã«ã¯Documentãªããžã§ã¯ããšãªããŸããAttrããŒãã®å Žåããã®å€ã¯åžžã«NoneãšãªããŸããèªã¿åºãå°çšã®å±æ§ã§ãã
- Node.attributes¶
屿§ãªããžã§ã¯ãã®
NamedNodeMapã§ããèŠçŽ ã ãããã®å±æ§ã«å®éã®å€ãæã¡ãŸã; ãã®ä»ã®ãªããžã§ã¯ãã§ã¯ããã®å±æ§ãNoneã«ããŸããèªã¿åºãå°çšã®å±æ§ã§ãã
- Node.previousSibling¶
ãã®ããŒããšåã芪ããŒããæã¡ãçŽåã«ããããŒãã§ããäŸãã°ãself èŠçŽ ã®éå§ã¿ã°ã®çŽåã«ããçµäºã¿ã°ãæã€èŠçŽ ã§ãããã¡ãããXML ææžã¯èŠçŽ ã ãã§æ§æãããŠããã ãã§ã¯ãªãã®ã§ãçŽåã«ããå åŒé¢ä¿ã«ããèŠçŽ (sibling) ã¯ããã¹ããã³ã¡ã³ãããã®ä»ã«ãªãå¯èœæ§ããããŸãããã®ããŒãã芪ããŒãã«ãããå é ã®åããŒãã§ããå Žåã屿§å€ã¯
Noneã«ãªããŸããèªã¿åºãå°çšã®å±æ§ã§ãã
- Node.nextSibling¶
ãã®ããŒããšåã芪ããŒããæã¡ãçŽåŸã«ããããŒãã§ããäŸãã°ã
previousSiblingãåç §ããŠãã ããããã®ããŒãã芪ããŒãã«ãããæ«å°Ÿã®åããŒãã§ããå Žåã屿§å€ã¯Noneã«ãªããŸããèªã¿åºãå°çšã®å±æ§ã§ãã
- Node.childNodes¶
A
NodeListof the children of this node. If the node has no children, the list is empty. This is a read-only attribute.
- Node.firstChild¶
ãã®ããŒãã«åããŒããããå Žåããã®å é ã®ããŒãã§ããããã§ãªãå Žå
Noneã«ãªããŸããèªã¿åºãå°çšã®å±æ§ã§ãã
- Node.lastChild¶
ãã®ããŒãã«åããŒããããå Žåããã®æ«å°Ÿã®ããŒãã§ããããã§ãªãå Žå
Noneã«ãªããŸããèªã¿åºãå°çšã®å±æ§ã§ãã
- Node.localName¶
The part of the
tagNamefollowing the colon if there is one, else the entiretagName. The value is a string.
- Node.prefix¶
The part of the
tagNamepreceding the colon if there is one, else the empty string. The value is a string, orNone.
- Node.namespaceURI¶
èŠçŽ åã«é¢é£ä»ããããåå空éã§ããæååã
Noneã«ãªããŸããèªã¿åºãå°çšã®å±æ§ã§ãã
- Node.ownerDocument¶
The
Documentobject to which this node belongs, orNonefor a document itself. This is a read-only attribute.
- Node.isSupported(feature, version)¶
Return whether the DOM implementation supports a particular feature, as
DOMImplementation.hasFeature()does.
- Node.setUserData(key, data, handler)¶
Associate data with key on this node and return the data previously associated with key, or
None. If data isNone, the association is removed. handler is called when the node is cloned, imported, renamed or deleted; passNoneif no notification is needed.
- Node.getUserData(key)¶
Return the data associated with key on this node by
setUserData(), orNone.
- Node.nodeName¶
The name of this node, depending on its type; see the table below. You can always get the information you would get here from another property such as the
tagNameproperty for elements or thenameproperty for attributes. This is a read-only attribute.
- Node.nodeValue¶
The value of this node, depending on its type; see the table below. The value is a string or
None.
The values of nodeName and nodeValue
for each node type are:
Node type |
nodeName |
nodeValue |
|---|---|---|
|
the content |
|
|
the content |
|
|
|
|
|
|
|
|
||
|
||
the name of the entity |
|
|
the name of the notation |
|
|
|
the content |
- Node.hasAttributes()¶
ããŒããäœããã®å±æ§ãæã£ãŠããå Žåã«
Trueãè¿ããŸãã
- Node.hasChildNodes()¶
ããŒããäœããã®åããŒããæã£ãŠããå Žåã«
Trueãè¿ããŸãã
- Node.isSameNode(other)¶
other ããã®ããŒããšåãããŒããåç §ããŠããå Žåã«
Trueãè¿ããŸãããã®ã¡ãœããã¯ãäœããã®ãããã· (proxy) æ©æ§ãå©çšãããã㪠DOM å®è£ ã§ç¹ã«äŸ¿å©ã§ã (äžã€ä»¥äžã®ãªããžã§ã¯ããåãããŒããåç §ãããããããªãããã§ã)ãæ³šé
ãã®ã¡ãœãã㯠DOM ã¬ãã« 3 API ã®ææ¡ã«åºã¥ãããã®ã§ããŸã "ã¯ãŒãã³ã°ãã©ãã(working draft)" ã®æ®µéã§ãããããããã®ã€ã³ã¿ãŒãã§ãŒã¹ã«ã¯ç°è«ã¯åºãªããšèããããŸããW3C ã«ãã倿Žããã£ãŠããå¿ ããã Python DOM ã€ã³ã¿ãŒãã§ãŒã¹ã«ããããã®ã¡ãœããã«åœ±é¿ãããšã¯éããŸãã (ãã ããã®ã¡ãœããã«å¯Ÿããäœããã®æ°ãã W3C API ããµããŒãããããããããŸãã)ã
- Node.appendChild(newChild)¶
çŸåšã®ããŒãã®åããŒããªã¹ãã®æ«å°Ÿã«æ°ããªåããŒãã远å ããnewChild ãè¿ããŸããããããŒããæ¢ã«ããªãŒã«ããã°ãæåã«åé€ãããŸãã
- Node.insertBefore(newChild, refChild)¶
Insert a new child node before an existing child. It must be the case that refChild is a child of this node; if not,
NotFoundErris raised. newChild is returned. If refChild isNone, it inserts newChild at the end of the children's list.
- Node.removeChild(oldChild)¶
Remove a child node. oldChild must be a child of this node; if not,
NotFoundErris raised. oldChild is returned on success. If oldChild will not be used further, itsunlink()method should be called.
- Node.replaceChild(newChild, oldChild)¶
Replace an existing node with a new node. It must be the case that oldChild is a child of this node; if not,
NotFoundErris raised.
- Node.normalize()¶
äžç¶ãã®ããã¹ãå šäœãäžåã®
Textã€ã³ã¹ã¿ã³ã¹ãšããŠä¿åããããã«é£æ¥ããããã¹ãããŒããçµåããŸããããã«ãããå€ãã®ã¢ããªã±ãŒã·ã§ã³ã§ DOM ããªãŒããã®ããã¹ãåŠçãç°¡åã«ãªããŸãã
- Node.cloneNode(deep)¶
ãã®ããŒããè€è£œ (clone) ããŸããdeep ãèšå®ãããšãåããŒããåæ§ã«è€è£œããããšãæå³ããŸããè€è£œãããããŒããè¿ããŸãã
NodeList ãªããžã§ã¯ã¶
A NodeList represents a sequence of nodes. These objects are used in
two ways in the DOM Core recommendation: an Element object provides
one as its list of child nodes, and the getElementsByTagName()
and getElementsByTagNameNS() methods of Node return
objects with this interface to represent query results.
NodeList does not inherit from Node.
DOM ã¬ãã« 2 å§åã§ã¯ããããã®ãªããžã§ã¯ãã«å¯Ÿãã以äžã®ããã«ã¡ãœãããäžã€ã屿§ãäžã€å®çŸ©ããŠããŸãã
- NodeList.item(i)¶
Return the i'th item from the sequence, or
Noneif i is out of range. Negative indices are not supported.
- NodeList.length¶
ã·ãŒã±ã³ã¹äžã®ããŒãã®æ°ã§ãã
ãã®ä»ã«ãPython ã® DOM ã€ã³ã¿ãŒãã§ãŒã¹ã§ã¯ã NodeList ãªããžã§ã¯ãã Python ã®ã·ãŒã±ã³ã¹ãšããŠäœ¿ããããã«ãããµããŒãã远å ãããŠããããšãå¿
èŠã§ãã NodeList ã®å®è£
ã§ã¯ãå
šãŠ __len__() ãš __getitem__() ããµããŒãããªããã°ãªããŸãã; ãã®ãµããŒãã«ããã for æå
ã§ NodeList ã«ãããç¹°ãè¿ããšãçµã¿èŸŒã¿é¢æ° len() ã®é©åãªãµããŒããã§ããããã«ãªããŸãã
DOM å®è£
ãææžã®å€æŽããµããŒãããŠããå Žåã NodeList ã®å®è£
ã§ã __setitem__() ããã³ __delitem__() ã¡ãœããããµããŒãããªããã°ãªããŸããã
DocumentType ãªããžã§ã¯ã¶
Information about the notations and entities declared by a document (including
the external subset if the parser uses it and can provide the information) is
available from a DocumentType object. The DocumentType for a
document is available from the Document object's doctype
attribute; if there is no DOCTYPE declaration for the document, the
document's doctype attribute will be set to None instead of an
instance of this interface.
DocumentType 㯠Node ãç¹æ®åãããã®ã§ã以äžã®å±æ§ãå ããŠããŸã:
- DocumentType.publicId¶
The public identifier for the external subset of the document type definition, or
Noneif theDOCTYPEdeclaration does not specify it.
- DocumentType.systemId¶
The system identifier, a URI, for the external subset of the document type definition, or
Noneif theDOCTYPEdeclaration does not specify it.
- DocumentType.internalSubset¶
ããã¥ã¡ã³ãã®å®å šãªå éšãµãã»ãããäžããæååã§ãããµãã»ãããå²ããã©ã±ããã¯å«ã¿ãŸãããããã¥ã¡ã³ããå éšãµãã»ãããæããªãå Žåããã®å€ã¯
Noneã§ãã
- DocumentType.name¶
DOCTYPE宣èšã§ã«ãŒãèŠçŽ ã®ååãäžããããŠããå Žåããã®å€ã«ãªããŸãã
- DocumentType.entities¶
This is a
NamedNodeMapofEntitynodes giving the definitions of external entities. For entity names defined more than once, only the first definition is provided (others are ignored as required by the XML recommendation). This may beNoneif the information is not provided by the parser, or if no entities are defined.
- DocumentType.notations¶
This is a
NamedNodeMapofNotationnodes giving the definitions of notations. For notation names defined more than once, only the first definition is provided (others are ignored as required by the XML recommendation). This may beNoneif the information is not provided by the parser, or if no notations are defined.
Document ãªããžã§ã¯ã¶
Document 㯠XML ããã¥ã¡ã³ãå
šäœã衚çŸãããã®æ§æèŠçŽ ã§ããèŠçŽ ã屿§ãåŠçåœä»€ãã³ã¡ã³ãçãæã¡ãŸãã Document 㯠Node ããããããã£ãç¶æ¿ããŠããããšãæãåºããŠãã ããã
- Document.documentElement¶
ããã¥ã¡ã³ãã®å¯äžç¡äºã®ã«ãŒãèŠçŽ ã§ãã
- Document.doctype¶
The
DocumentTypenode of the document, orNone. This is a read-only attribute.
- Document.implementation¶
The
DOMImplementationobject which created this document. This is a read-only attribute.
- Document.strictErrorChecking¶
Whether error checking is enforced.
- Document.documentURI¶
The location of the document, or
Noneif it is unknown.
- Document.createDocumentFragment()¶
Create and return an empty
DocumentFragmentnode.
- Document.createCDATASection(data)¶
Create and return a
CDATASectionnode containing data.
- Document.importNode(importedNode, deep)¶
Return a copy of importedNode which belongs to this document. The original node is not removed from its document. If deep is true, the descendants of the node are copied too.
- Document.createElement(tagName)¶
Create and return a new element node. The element is not inserted into the document when it is created. You need to explicitly insert it with one of the other methods such as
insertBefore()orappendChild().
- Document.createElementNS(namespaceURI, tagName)¶
Create and return a new element with a namespace. The tagName may have a prefix. The element is not inserted into the document when it is created. You need to explicitly insert it with one of the other methods such as
insertBefore()orappendChild().
- Document.createTextNode(data)¶
åŒæ°ãšããŠæž¡ãããããŒã¿ã®å ¥ã£ãããã¹ãããŒããçæããŠè¿ããŸããä»ã®çæ (create) ã¡ãœãããšåããããã®ã¡ãœããã¯çæãããããŒããããªãŒã«æ¿å ¥ããŸããã
- Document.createComment(data)¶
åŒæ°ãšããŠæž¡ãããããŒã¿ã®å ¥ã£ãã³ã¡ã³ãããŒããçæããŠè¿ããŸããä»ã®çæ (create) ã¡ãœãããšåããããã®ã¡ãœããã¯çæãããããŒããããªãŒã«æ¿å ¥ããŸããã
- Document.createProcessingInstruction(target, data)¶
åŒæ°ãšããŠæž¡ããã target ããã³ data ã®å ¥ã£ãåŠçåœä»€ããŒããçæããŠè¿ããŸããä»ã®çæ (create) ã¡ãœãããšåããããã®ã¡ãœããã¯çæãããããŒããããªãŒã«æ¿å ¥ããŸããã
- Document.createAttribute(name)¶
Create and return an attribute node. This method does not associate the attribute node with any particular element. You must use
setAttributeNode()on the appropriateElementobject to use the newly created attribute instance.
- Document.createAttributeNS(namespaceURI, qualifiedName)¶
Create and return an attribute node with a namespace. The tagName may have a prefix. This method does not associate the attribute node with any particular element. You must use
setAttributeNode()on the appropriateElementobject to use the newly created attribute instance.
- Document.getElementById(id)¶
Return the element with the given ID, or
None. Only attributes declared as being of type ID in the DTD or byElement.setIdAttribute()are searched.
- Document.getElementsByTagName(tagName)¶
å šãŠã®äžäœèŠçŽ (çŽæ¥ã®åèŠçŽ ãåèŠçŽ ã®åèŠçŽ ç) ããç¹å®ã®èŠçŽ ååãæã€ãã®ãæ€çŽ¢ããŸãã
- Document.getElementsByTagNameNS(namespaceURI, localName)¶
å šãŠã®äžäœèŠçŽ (çŽæ¥ã®åèŠçŽ ãåèŠçŽ ã®åèŠçŽ ç) ããç¹å®ã®åå空é URI ãšããŒã«ã«å (local name) ãæã€ãã®ãæ€çŽ¢ããŸããããŒã«ã«åã¯åå空éã«ãããæ¥é èŸä»¥éã®éšåã§ãã
- Document.renameNode(n, namespaceURI, name)¶
Rename the element or attribute node n and return it. namespaceURI is the new namespace URI, or
EMPTY_NAMESPACEif the node does not belong to a namespace. name is the new qualified name.Raise
WrongDocumentErrif n was created by another document, andNotSupportedErrif it is neither an element nor an attribute.
Element ãªããžã§ã¯ã¶
Element 㯠Node ã®ãµãã¯ã©ã¹ã§ãããã®ãã Node ã¯ã©ã¹ã®å
šãŠã®å±æ§ãç¶æ¿ããŸãã
- Element.tagName¶
èŠçŽ ååã§ããåå空é䜿çšã®ææžã§ã¯ãèŠçŽ ååäžã«ã³ãã³ããããããããŸãããå€ã¯æååã§ãã
- Element.setIdAttribute(name)¶
Declare that the attribute name is of type ID, so that the element is found by
Document.getElementById(). RaiseNotFoundErrif the element has no such attribute.
- Element.setIdAttributeNS(namespaceURI, localName)¶
The same as
setIdAttribute(), but for an attribute specified by its namespace URI and local name.
- Element.setIdAttributeNode(idAttr)¶
The same as
setIdAttribute(), but for an already retrieved attribute node.
- Element.getElementsByTagName(tagName)¶
Documentã¯ã©ã¹å ã«ãããååã®ã¡ãœãããšåãã§ãã
- Element.getElementsByTagNameNS(namespaceURI, localName)¶
Documentã¯ã©ã¹å ã«ãããååã®ã¡ãœãããšåãã§ãã
- Element.hasAttribute(name)¶
æå®èŠçŽ ã« name ã§æž¡ããååã®å±æ§ãååšããŠããã°
Trueãè¿ããŸãã
- Element.hasAttributeNS(namespaceURI, localName)¶
æå®èŠçŽ ã« namespaceURI ãš localName ã§æå®ããååã®å±æ§ãååšããŠããã°
Trueãè¿ããŸãã
- Element.getAttribute(name)¶
name ã§æå®ãã屿§ã®å€ãæååãšããŠè¿ããŸããããã屿§ãååšããªãããããã¯å±æ§ã«å€ãèšå®ãããŠããªãå Žåãç©ºã®æååãè¿ãããŸãã
- Element.getAttributeNode(attrname)¶
attrname ã§æå®ããã屿§ã®
AttrããŒããè¿ããŸãã
- Element.getAttributeNS(namespaceURI, localName)¶
namespaceURI ãš localName ã«ãã£ãŠæå®ãã屿§ã®å€ãæååãšããŠè¿ããŸããããã屿§ãååšããªãããããã¯å±æ§ã«å€ãèšå®ãããŠããªãå Žåãç©ºã®æååãè¿ãããŸãã
- Element.getAttributeNodeNS(namespaceURI, localName)¶
æå®ãã namespaceURI ããã³ localName ãæã€å±æ§å€ãããŒããšããŠè¿ããŸãã
- Element.removeAttribute(name)¶
Remove an attribute by name.
- Element.removeAttributeNode(oldAttr)¶
oldAttr ã屿§ãªã¹ãã«ããå Žåãåé€ããŠè¿ããŸãã oldAttr ãååšããªãå Žåã
NotFoundErrãéåºãããŸãã
- Element.removeAttributeNS(namespaceURI, localName)¶
Remove an attribute by name. Note that it uses a localName, not a qname.
- Element.setAttribute(name, value)¶
æååã䜿ã£ãŠå±æ§å€ãèšå®ããŸãã
- Element.setAttributeNode(newAttr)¶
Add a new attribute node to the element, replacing an existing attribute if necessary if the
nameattribute matches. If a replacement occurs, the old attribute node will be returned. If newAttr is already in use,InuseAttributeErrwill be raised.
- Element.setAttributeNodeNS(newAttr)¶
Add a new attribute node to the element, replacing an existing attribute if necessary if the
namespaceURIandlocalNameattributes match. If a replacement occurs, the old attribute node will be returned. If newAttr is already in use,InuseAttributeErrwill be raised.
- Element.setAttributeNS(namespaceURI, qname, value)¶
æå®ããã namespaceURI ããã³ qname ã§äžãããã屿§ã®å€ãæååã§èšå®ããŸããqname ã¯å±æ§ã®å®å šãªååã§ããããã®ç¹ãäžèšã®ã¡ãœãããšéãã®ã§æ³šæããŠãã ããã
Attr ãªããžã§ã¯ã¶
Attr 㯠Node ãç¶æ¿ããŠãããå
šãŠã®å±æ§ãç¶æ¿ããŠããŸãã
Attribute nodes are not part of the document tree.
They are contained in the attributes map of an element,
not in its children,
and their parentNode, previousSibling
and nextSibling are always None.
- Attr.name¶
èŠçŽ ååã§ããåå空é䜿çšã®ææžã§ã¯ãèŠçŽ ååäžã«ã³ãã³ãå«ãŸãããããããŸããã
- Attr.localName¶
ååã«ã³ãã³ãããã°ã³ãã³ä»¥éã®éšåã«ããªããã°ååå šäœã«ãªããŸãã
- Attr.prefix¶
ååã«ã³ãã³ãããã°ã³ãã³ä»¥åã®éšåã«ããªããã°ç©ºæååã«ãªããŸãã
- Attr.isId¶
Whether this attribute is of type ID, either because it is declared as such in the DTD or because
Element.setIdAttribute()was used. This is a read-only attribute.
- Attr.ownerElement¶
The
Elementnode to which this attribute belongs, orNoneif it is not used. This is a read-only attribute.
- Attr.specified¶
Whether the value of the attribute was explicitly set in the document, as opposed to being defaulted from the DTD. This is a read-only attribute.
NamedNodeMap Objects¶
NamedNodeMap 㯠Node ãç¶æ¿ã㊠ããŸãã ã
- NamedNodeMap.length¶
屿§ãªã¹ãã®é·ãã§ãã
- NamedNodeMap.item(index)¶
Return an attribute with a particular index. The order you get the attributes in is arbitrary but will be consistent for the life of a DOM. Each item is an attribute node. Get its value with the
valueattribute.
- NamedNodeMap.getNamedItem(name)¶
Return the node with the given
name, orNoneif there is no such node.
- NamedNodeMap.getNamedItemNS(namespaceURI, localName)¶
Return the node with the given namespace URI and local name, or
Noneif there is no such node.
- NamedNodeMap.setNamedItem(node)¶
Add node to the map, using its
nameas the key. Return the node which it replaces, orNoneif it replaces no node.
- NamedNodeMap.setNamedItemNS(node)¶
Add node to the map, using its namespace URI and local name as the key. Return the node which it replaces, or
Noneif it replaces no node.
- NamedNodeMap.removeNamedItem(name)¶
Remove and return the node with the given
name. RaiseNotFoundErrif there is no such node.
- NamedNodeMap.removeNamedItemNS(namespaceURI, localName)¶
Remove and return the node with the given namespace URI and local name. Raise
NotFoundErrif there is no such node.
You can also use the standardized getAttribute*() family of methods
on the Element objects.
DocumentFragment Objects¶
DocumentFragment is a lightweight container of nodes.
It is a subclass of Node.
When it is inserted into the document tree,
its children are inserted instead of it,
and it becomes empty.
CharacterData Objects¶
CharacterData represents text-like data in the XML document.
It is a subclass of Node, and the base class
of Text, CDATASection and Comment.
Such nodes cannot have child nodes.
- CharacterData.data¶
The content of the node as a string.
Text ãªããžã§ã¯ãããã³ CDATASection ãªããžã§ã¯ã¶
The Text interface represents text in the XML document. If the parser
and DOM implementation support the DOM's XML extension, portions of the text
enclosed in CDATA marked sections are stored in CDATASection objects.
These two interfaces are identical, but provide different values for the
nodeType attribute.
Text extends the CharacterData interface,
and CDATASection extends Text.
- Text.data¶
æååã«ããããã¹ãããŒãã®å 容ã§ãã
- Text.wholeText¶
The text of all
Textnodes logically adjacent to this node, concatenated in document order. This is a read-only attribute.
- Text.replaceWholeText(content)¶
Replace the text of all
Textnodes logically adjacent to this node with content, removing the other nodes. Return this node, orNoneif content is empty.
- Text.splitText(offset)¶
Split this node into two nodes at offset, keeping the first part in this node and returning a new sibling node with the rest.
泚é
CDATASection ããŒãã®å©çšã¯ãããŒããå®å
šãª CDATA ããŒã¯åºåã衚çŸãããšããæå³ã§ã¯ãªããããŒãã®å
容ã CDATA åºåã®äžéšã§ãããšããããšãæå³ããã ãã§ããåäžã® CDATA ã»ã¯ã·ã§ã³ã¯ææžããªãŒå
ã§è€æ°ã®ããŒããšããŠè¡šçŸãããããšããããŸããäºã€ã®é£æ¥ãã CDATASection ããŒãããç°ãªã CDATA ããŒã¯åºåãã©ãããæ±ºå®ããæ¹æ³ã¯ãããŸããã
ProcessingInstruction ãªããžã§ã¯ã¶
XML ææžå
ã®åŠçåœä»€ã衚çŸããŸã; Node ã€ã³ã¿ãŒãã§ãŒã¹ãç¶æ¿ããŠããŸãããåããŒããæã€ããšã¯ã§ããŸããã
- ProcessingInstruction.target¶
æåã®ç©ºçœæåãŸã§ã®åŠçåœä»€ã®å 容ã§ããèªã¿åºãå°çšã®å±æ§ã§ãã
- ProcessingInstruction.data¶
æåã®ç©ºçœæå以éã®åŠçåœä»€ã®å 容ã§ãã
Entity Objects¶
Entity represents a parsed or unparsed entity declared in the DTD.
It is a subclass of Node.
Entity nodes are contained in DocumentType.entities
and cannot be inserted into the document tree.
The name of the entity is its nodeName.
- Entity.publicId¶
The public identifier of the entity, or
Noneif it is not specified. This is a read-only attribute.
- Entity.systemId¶
The system identifier of the entity, or
Noneif it is not specified. This is a read-only attribute.
- Entity.notationName¶
The name of the notation for an unparsed entity, or
Nonefor a parsed entity. This is a read-only attribute.
Notation Objects¶
Notation represents a notation declared in the DTD.
It is a subclass of Node and cannot have child nodes.
Notation nodes are contained in DocumentType.notations
and cannot be inserted into the document tree.
The name of the notation is its nodeName.
- Notation.publicId¶
The public identifier of the notation, or
Noneif it is not specified. This is a read-only attribute.
- Notation.systemId¶
The system identifier of the notation, or
Noneif it is not specified. This is a read-only attribute.
äŸå€Â¶
DOM ã¬ãã« 2 å§åã§ã¯ãåäžã®äŸå€ DOMException ãšãã©ã®çš®ã®ãšã©ãŒãçºçããããã¢ããªã±ãŒã·ã§ã³ã決å®ã§ããããã«ããå€ãã®å®æ°ãå®çŸ©ããŠããŸãã DOMException ã€ã³ã¹ã¿ã³ã¹ã¯ãç¹å®ã®äŸå€ã«é¢ããé©åãªå€ãæäŸãã code 屿§ã䌎ã£ãŠããŸãã
Python DOM ã€ã³ã¿ãŒãã§ãŒã¹ã§ã¯ãäžèšã®å®æ°ãæäŸããŠããŸãããåæã«äžé£ã®äŸå€ãæ¡åŒµããŠãDOM ã§å®çŸ©ãããŠããåäŸå€ã³ãŒãã«å¯ŸããŠç¹å®ã®äŸå€ãååšããããã«ããŠããŸãã DOM ã®å®è£
ã§ã¯ãé©åãªç¹å®ã®äŸå€ãéåºããªããã°ãªãããåäŸå€ã¯ code 屿§ã«å¯Ÿå¿ããé©åãªå€ã䌎ããªããã°ãªããŸããã
- exception xml.dom.DOMException¶
å šãŠã®ç¹å®ã® DOM äŸå€ã§äœ¿ãããŠããåºåºäŸå€ã¯ã©ã¹ã§ãããã®äŸå€ã¯ã©ã¹ãçŽæ¥ã€ã³ã¹ã¿ã³ã¹åããããšã¯ã§ããŸããã
- exception xml.dom.DomstringSizeErr¶
æå®ãããç¯å²ã®ããã¹ããæååã«åãŸããªãå Žåã«éåºãããŸãããã®äŸå€ã¯ Python ã® DOM å®è£ ã§äœ¿ããããã©ããã¯å€ã£ãŠããŸããããPython ã§æžãããŠããªã DOM å®è£ ããéåºãããå ŽåããããŸãã
- exception xml.dom.HierarchyRequestErr¶
æ¿å ¥ã§ããªãåã®ããŒããæ¿å ¥ããããšè©Šã¿ããšãã«éåºãããŸãã
- exception xml.dom.IndexSizeErr¶
ã¡ãœããã«äžããã€ã³ãã¯ã¹ããµã€ãºãã©ã¡ã¿ãè² ã®å€ã蚱容ç¯å²ã®å€ãè¶ ããéã«éåºãããŸãã
- exception xml.dom.InuseAttributeErr¶
ææžäžã«ãã§ã«ååšãã
AttrããŒããæ¿å ¥ããããšè©Šã¿ãéã«éåºãããŸãã
- exception xml.dom.InvalidAccessErr¶
ãã©ã¡ã¿ãŸãã¯æäœãæ ¹åºã«ãããªããžã§ã¯ãã§ãµããŒããããŠããªãå Žåã«éåºãããŸãã
- exception xml.dom.InvalidCharacterErr¶
ãã®äŸå€ã¯ãæååãã©ã¡ã¿ããçŸåšäœ¿ãããŠããã³ã³ããã¹ãã§ XML 1.0 å§åã«ãã£ãŠèš±å¯ãããŠããªãå Žåã«éåºãããŸããäŸãã°ãèŠçŽ åã«ç©ºçœã®å ¥ã£ã
ElementããŒããçæããããšãããšããã®ãšã©ãŒãéåºãããŸãã
- exception xml.dom.InvalidModificationErr¶
ããŒãã®åã倿Žããããšè©Šã¿ãéã«éåºãããŸãã
- exception xml.dom.InvalidStateErr¶
å®çŸ©ãããŠããªããªããžã§ã¯ããããã¯ãå©çšã§ããªããªã£ããªããžã§ã¯ãã䜿ãããšè©Šã¿ãéã«éåºãããŸãã
- exception xml.dom.NamespaceErr¶
Namespaces in XML ã«ç §ãããŠèš±å¯ãããŠããªãæ¹æ³ã§ãªããžã§ã¯ãã倿Žããããšè©Šã¿ãå Žåããã®äŸå€ãéåºãããŸãã
- exception xml.dom.NotFoundErr¶
åç §ããŠããã³ã³ããã¹ãäžã«ç®çã®ããŒããååšããªãå Žåã«éåºãããäŸå€ã§ããäŸãã°ã
NamedNodeMap.removeNamedItem()ã¯æž¡ãããããŒããããŒããããäžã«ååšããªãå Žåã«ãã®äŸå€ãéåºããŸãã
- exception xml.dom.NotSupportedErr¶
èŠæ±ãããæ¹ã®ãªããžã§ã¯ããæäœãå®è£ ã§ãµããŒããããŠããªãå Žåã«éåºãããŸãã
- exception xml.dom.NoDataAllowedErr¶
ããŒã¿å±æ§ããµããŒãããªãããŒãã«ããŒã¿ãæå®ããéã«éåºãããŸãã
- exception xml.dom.NoModificationAllowedErr¶
ãªããžã§ã¯ãã«å¯Ÿã㊠(èªã¿åºãå°çšããŒãã«å¯Ÿããä¿®æ£ã®ããã«) èš±å¯ãããŠããªãä¿®æ£ãè¡ãããšè©Šã¿ãéã«éåºãããŸãã
- exception xml.dom.SyntaxErr¶
ç¡å¹ãŸãã¯äžæ£ãªæååãæå®ãããéã«éåºãããŸãã
- exception xml.dom.ValidationErr¶
Raised when an operation would make the document invalid with respect to partial validity. This is not known to be used in the Python DOM implementations, but may be received from DOM implementations not written in Python.
- exception xml.dom.WrongDocumentErr¶
ããŒããçŸåšå±ããŠããææžãšç°ãªãææžã«æ¿å ¥ããããã€ããææžããå¥ã®ææžãžã®ããŒãã®ç§»è¡ãå®è£ ã§ãµããŒããããŠããªãå Žåã«éåºãããŸãã
DOM å§åã§å®çŸ©ãããŠããäŸå€ã³ãŒãã¯ã以äžã®ããŒãã«ã«åŸã£ãŠäžèšã®äŸå€ãšå¯Ÿå¿ä»ããããŸã:
宿° |
äŸå€ |
|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
é©åæ§Â¶
ãã®ç¯ã§ã¯é©åæ§ã«é¢ããèŠæ±ãšãPython DOM APIãW3C DOM å§åãããã³ OMG IDL ã® Python API ãžã®å¯Ÿå¿ä»ããšã®éã®é¢ä¿ã«ã€ããŠè¿°ã¹ãŸãã
åã®å¯Ÿå¿ä»ã¶
DOM 仿§ã§äœ¿ãããŠãã IDL åã¯ã以äžã®ããŒãã«ã«åŸã£ãŠ Python ã®åã«å¯Ÿå¿ä»ããããŠããŸãã
IDL å |
Python ã®å |
|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
ã¢ã¯ã»ãµã¡ãœãã¶
OMG IDL ãã Python ãžã®å¯Ÿå¿ä»ãã¯ãIDL attribute 宣èšãžã®ã¢ã¯ã»ãµé¢æ°ã®å®çŸ©ããJava ã«ãã察å¿ä»ããè¡ãã®ãšã»ãšãã©åãããã«è¡ããŸããIDL 宣èšã®å¯Ÿå¿ä»ã
readonly attribute string someValue;
attribute string anotherValue;
yields three accessor functions: a "get" method for someValue
(_get_someValue()), and "get" and "set" methods for anotherValue
(_get_anotherValue() and _set_anotherValue()). The mapping, in
particular, does not require that the IDL attributes are accessible as normal
Python attributes: object.someValue is not required to work, and may
raise an AttributeError.
ããããªãããPython DOM API ã§ã¯ãéåžžã®å±æ§ã¢ã¯ã»ã¹ãåäœããããšãå¿
é ã§ããããã¯ãPython IDL ã³ã³ãã€ã©ã«ãã£ãŠçæãããå
žåçãªä»£çšç©ã¯ãŸãåäœããããšã¯ãªããDOM ãªããžã§ã¯ãã CORBA ãä»ããŠã¢ã¯ã»ã¹ãããå Žåã«ã¯ãã¯ã©ã€ã¢ã³ãäžã§ã©ãããŒãªããžã§ã¯ããå¿
èŠã§ããããšãæå³ããŸããCORBA DOM ã¯ã©ã€ã¢ã³ãã§ã¯ä»ã«ãããã€ãèæ
®ãã¹ãããšãããäžæ¹ã§ãPython ãã CORBA ãä»ã㊠DOM ã䜿ã£ãçµéšãæã€å®è£
è
ã¯ãã®ããšãåé¡èŠããŠããŸãããreadonly ã§ãããšå®£èšããã屿§ã¯ãå
šãŠã® DOM å®è£
ã§æžã蟌ã¿ã¢ã¯ã»ã¹ãå¶éããŠãããšã¯éããŸããã
Python DOM API ã§ã¯ãã¢ã¯ã»ãµé¢æ°ã¯å¿
é ã§ã¯ãããŸãããã¢ã¯ã»ãµé¢æ°ãæäŸãããå ŽåãPython IDL 察å¿ä»ãã«ãã£ãŠå®çŸ©ããã圢åŒããšããªããã°ãªããŸãããã屿§ã¯ Python ããçŽæ¥ã¢ã¯ã»ã¹ããããšãã§ããã®ã§ããããã®ã¡ãœããã¯å¿
é ã§ã¯ãªããšèããããŸããreadonly ã§ãããšå®£èšããã屿§ã«å¯ŸããŠã¯ã "set" ã¢ã¯ã»ãµãæäŸããŠã¯ãªããŸããã
The IDL definitions do not fully embody the requirements of the W3C DOM API,
such as the notion of certain objects, such as the return value of
getElementsByTagName(), being "live". The Python DOM API does
not require implementations to enforce such requirements.
Comment ãªããžã§ã¯ã¶
Commentrepresents a comment in the XML document. It is a subclass ofCharacterData.æååã«ããã³ã¡ã³ãã®å 容ã§ãããã®å±æ§ã«ã¯ãã³ã¡ã³ãã®å é ã«ãã
<!--ãšæ«å°Ÿã«ãã-->éã®å šãŠã®æåãå ¥ã£ãŠããŸããã<!--ãš-->èªäœã¯å«ã¿ãŸããã