XML-Command to create a '<IDOC BEGIN="1">' n

RallnusRallnus Member Posts: 79
edited 2006-05-12 in Navision Attain
I am searching for a command which generates a node like: '<IDOC BEGIN="1">'. There are always problems with blanks and special characters if you use "CurrNode.ownerDocument.createNode".
Rallnus (Yamaha FJ1200 - '89 / 25th anniversary was great!)

Answers

  • pduckpduck Member Posts: 147
    Rallnus wrote:
    <IDOC BEGIN="1">

    The node is IDOC and BEGIN is an attribute, so their isn't any blank in your Nodename.

    You must first create your node and then add the attribute. Be careful while using the setAttribute method of them DOM objects (Elements 'n Nodes). In my case the repeated call of this method caused the client and the NAS to crash. Instead I use this function (I work with Elements instead of nodes):
    Var	Name	DataType	Subtype	Length
    Ja	rau_DomDoc	Automation	'Microsoft XML, v4.0'.DOMDocument	
    Ja	rau_Element	Automation	'Microsoft XML, v4.0'.IXMLDOMElement	
    Nein	vtx_AttributeName	Text		250
    Nein	vtx_AttributeValue	Text		250
    
    CreateAttributeForElement(VAR rau_DomDoc : Automation "'Microsoft XML, v4.0'.DOMDocument";VAR rau_Element : Automation "'Microsoft XML, [...])
    
    lau_Attribute := rau_DomDoc.createAttribute(vtx_AttributeName);
    IF ISCLEAR(lau_Attribute) THEN
      EXIT(FALSE);
    
    lau_Attribute.value(vtx_AttributeValue);
    rau_Element.setAttributeNode(lau_Attribute);
    CLEAR(lau_Attribute);
    
    IF FORMAT(rau_Element.getAttribute(vtx_AttributeName)) = vtx_AttributeValue THEN
      EXIT(TRUE)
    ELSE
      EXIT(FALSE);
    
Sign In or Register to comment.