You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-users@xalan.apache.org by Ilian Iliev <il...@wizcom.bg> on 2003/05/13 10:43:15 UTC
Validating XML and namespace prefixes
Hi all,
I need to transform a XML document created by an UML case tool. I have
a UML1.4 DTD file from OMG and I want to do a validation of XML file
with this DTD. Here is an excerpt from XML file
<?xml version="1.0" encoding= "ISO-8859-1"?>
<!DOCTYPE XMI SYSTEM "uml14.dtd">
<XMI xmi.version="1.1" xmlns:UML = 'href://org.omg/UML/1.3'>
<XMI.header>
<XMI.metamodel xmi.name="UML" xmi.version="1.4" />
</XMI.header>
<XMI.content>
<UML:Model>
<UML:Namespace.ownedElement>
<UML:Stereotype xmi.id = 'STID_1'
name = 'UserInput'>
</UML:Stereotype>
</UML:Namespace.ownedElement>
</UML:Model>
</XMI.content>
</XMI>
The transformation (and validation) has to be performed by calling
command-line utility Xalan.exe. The problem is that it raises the
following error:
Fatal Error at (file C:\temp\uml14.dtd, line 187, column 31): Colons are
not allowed in this name when namespaces are enabled
SAXParseException: Colons are not allowed in this name when namespaces
are enabled (C:\temp\uml14.dtd, line 187, column 31)
On the line 187 in uml14.dtd, there is a following:
<!ENTITY % UML:AggregationKind '(none|aggregate|composite)'>
If I remove UML: prefix from both DTD and XML file, validation is OK.
My questions are:
- Does Xalan support validation when there is namespace prefixes in
DTD?
- If yes, what can I do with Xalan.exe to enable it? Should I modify
code in XalanExe.cpp?
Thanks in advance,
Ilian
Re: Validating XML and namespace prefixes
Posted by da...@us.ibm.com.
Hi Ilian,
This is actual an issue with Xerces-C, and not with Xalan-C. However, the
parser is correct and the DTD you are trying to process does not conform to
the namespace recommendation:
http://www.w3.org/TR/REC-xml-names/#Conformance
So, there is really nothing to do but modify the DTD. XSLT is a
namespace-aware application, so XML documents processed by XSLT must
conform to the namespaces recommendation. If this DTD is generated by a
tool, I suggest you contact the vendor of the tool. Otherwise, contact the
source of the DTD and ask them to change it, or issue a new version which
is namespace-conformant.
Dave
"Ilian Iliev"
<ilian.iliev@wiz To: xalan-c-users@xml.apache.org
com.bg> cc: (bcc: David N Bertoni/Cambridge/IBM)
Subject: Validating XML and namespace prefixes
05/13/2003 01:43
AM
Hi all,
I need to transform a XML document created by an UML case tool. I have
a UML1.4 DTD file from OMG and I want to do a validation of XML file
with this DTD. Here is an excerpt from XML file
<?xml version="1.0" encoding= "ISO-8859-1"?>
<!DOCTYPE XMI SYSTEM "uml14.dtd">
<XMI xmi.version="1.1" xmlns:UML = 'href://org.omg/UML/1.3'>
<XMI.header>
<XMI.metamodel xmi.name="UML" xmi.version="1.4" />
</XMI.header>
<XMI.content>
<UML:Model>
<UML:Namespace.ownedElement>
<UML:Stereotype xmi.id = 'STID_1'
name = 'UserInput'>
</UML:Stereotype>
</UML:Namespace.ownedElement>
</UML:Model>
</XMI.content>
</XMI>
The transformation (and validation) has to be performed by calling
command-line utility Xalan.exe. The problem is that it raises the
following error:
Fatal Error at (file C:\temp\uml14.dtd, line 187, column 31): Colons are
not allowed in this name when namespaces are enabled
SAXParseException: Colons are not allowed in this name when namespaces
are enabled (C:\temp\uml14.dtd, line 187, column 31)
On the line 187 in uml14.dtd, there is a following:
<!ENTITY % UML:AggregationKind '(none|aggregate|composite)'>
If I remove UML: prefix from both DTD and XML file, validation is OK.
My questions are:
- Does Xalan support validation when there is namespace prefixes in
DTD?
- If yes, what can I do with Xalan.exe to enable it? Should I modify
code in XalanExe.cpp?
Thanks in advance,
Ilian