Consultor Eletrônico



Kbase P50604: hDoc:load fails to load the valid XML document defined
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   13/07/2007
Status: Unverified

FACT(s) (Environment):

Progress 9.1D
Progress 9.1E
OpenEdge 10.x
Windows

SYMPTOM(s):

hDoc:load fails to load the valid XML document defined with URI

X-NODEREF or X-DOCUMET LOAD got an error: FATAL ERROR: File 'C:\WRK91D\test.xml', line '1', column '33', message 'The prefix 'xyz' has not been mapped to any URI', (9082)

Using a one line test.xml file with following content:

<test><level xyz:name="value" /></test>

The following code generates the above error.

DEFINE VARIABLE cFile AS CHARACTER NO-UNDO INITIAL "test.xml".
DEFINE VARIABLE hDoc AS HANDLE NO-UNDO.
DEFINE VARIABLE hRoot AS HANDLE NO-UNDO.

CREATE X-DOCUMENT hDoc.
CREATE X-NODEREF hRoot.

hDoc:LOAD("FILE",cFile,FALSE).

DELETE OBJECT hDoc NO-ERROR.
DELETE OBJECT hRoot NO-ERROR.

Microsoft XML parser loads the same document without error:

DEFINE VARIABLE xmlDoc AS COM-HANDLE NO-UNDO.
CREATE 'Msxml2.DOMDocument.3.0' xmlDoc.
xmlDoc:loadXML("c:\wrk91d\test.xml").

MESSAGE
"Text:" "~t" xmlDoc:TEXT "~n"
"Text Length:" "~t" LENGTH(xmlDoc:TEXT) "~n"
"Number of children:" "~t" xmlDoc:childNodes:length
VIEW-AS ALERT-BOX INFO BUTTONS OK.

CAUSE:

w3.org Common Syntactic Constructs specification located at:

http://www.w3.org/TR/REC-xml#sec-common-syn

state:

specify The Namespaces in XML Recommendation [XML Names] assigns a meaning to names containing colon characters. Therefore, authors should not use the colon in XML names except for namespace purposes, but XML processors must accept the colon as a name character.

FIX:

Add the following line before the load the document will load successfully:

xmlDoc:SUPPRESS-NAMESPACE-PROCESSING = YES.