PreviousNextIndex

CREATE-NODE-NAMESPACE( ) method

Creates a namespace-aware XML node whose name can be either a single string y or an x:y combination.

Note: To ensure consistency across all nodes in an XML document, use either the CREATE-NODE-NAMESPACE( ) method or the CREATE-NODE( ) method to build an XML document; do not use both methods within a single document.

Return type: LOGICAL

Applies to: X-document object handle

Syntax
CREATE-NODE-NAMESPACE 
  ( x-node-handle , namespace-uri , qualified-name , type ) 

x-node-handle
namespace-uri
qualified-name
type

The following code fragment illustrates how to create a namespace-aware node in an XML document using either a specific namespace or the default namespace:

. . . 
/* Look for a colonized name in rootNodeName. */ 
found = INDEX(rootNodeName, ":"). 
IF found > 0 THEN DO: 
  /* Namespace declarations are special kinds of attributes that belong in 
     the http://www.w3.org/2000/xmlns/ namespace.*/ 
 errStat = hDocument:CREATE-NODE-NAMESPACE(hNsDecl, 
  "http://www.w3.org/2000/xmlns/", "xmlns:" +  
  SUBSTRING(rootNodeName, 1, found - 1), "attribute"). 
END. 
ELSE DO: 
 /* Use the default namespace, which does not need a namespace declaration 
     prefix, and assign it to the http://www.w3.org/2000/xmlns/ namespace.*/ 
 errStat = hDocument:CREATE-NODE-NAMESPACE(hNsDecl, 
  "http://www.w3.org/2000/xmlns/", "xmlns", "attribute"). 
END. 
IF NOT errStat THEN LEAVE. 
/* Set the value of the namespace attribute to the namespace URI. */ 
hNsDecl:NODE-VALUE = namespaceURI. 
. . . 


OpenEdge Release 10.2B
Copyright © 2009 Progress Software Corporation
PreviousNextIndex