Skip to main content



      Home
Home » Modeling » EMF » Cannot find the declaration of element ...
Cannot find the declaration of element ... [message #392101] Fri, 01 April 2005 15:06 Go to next message
Eclipse UserFriend
Ed,

Let me wrap up my previous questions there were about the same questions and
articulate my problem:

See the code below - I am creating an instance document of this extract.xsd
schema which makes use of two namespaces.
The instance document is written into c:\temp where the schema is in a
different directory.
The instance documnet now declares the namespaces and the schema location

<ClinicalDocument
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://www.ibm.com/research/hii/extract" x
mlns:hl7="urn:hl7-org:v3"
xsi:schemaLocation="http://www.ibm.com/research/hii/extract
extract.xsd">

But when I select it using from the eclipse Resource persective, right click
on it, and select "validate xml file" I get the error message

cvc-elt.1: Cannot find the declaration of element 'ClinicalDocument'.

You insights are highly appricaited :-)

- Iris

----------------------------------------- code to set DocumentRoot and write
the Resource -------------------------
String targetFile = "c:\temp\test.xml";

com.ibm.research.hii.extract.DocumentRoot dstRoot =
ExtractFactory.eINSTANCE.createDocumentRoot();
dstRoot.getXMLNSPrefixMap().put("",
"http://www.ibm.com/research/hii/extract");
dstRoot.getXMLNSPrefixMap().put("hl7", "urn:hl7-org:v3");
dstRoot.getXSISchemaLocation().put("http://www.ibm.com/research/hii/extract"
, "extract.xsd");

Map options = new HashMap();
options.put(XMLResource.OPTION_SCHEMA_LOCATION, Boolean.TRUE);

Resource eResources = (new ExtractResourceFactoryImpl()
.createResource(URI.createURI(targetXMLfile)));
eResources.getContents().add(dstRoot);
eResources.save(new FileOutputStream(targetXMLfile), options);
eResources.unload();
Re: Cannot find the declaration of element ... [message #392106 is a reply to message #392101] Fri, 01 April 2005 15:23 Go to previous message
Eclipse UserFriend
Iris,

This is really a question for WTP. You need to give the full absolute
address of extract.xsd. A relative URI is resolved against the URI of
the document containing it, so if the document's URI is
file:/c:/somewhere/file.xml, this .xsd will resolve to
file:/c:/somewhere/extract.xsd. If that's not where the schema is, it
will fail. So you should use something like
file:/c:/whereTheSchemaReallyIs/extract.xsd as the URI.

Iris Eiron wrote:

>Ed,
>
>Let me wrap up my previous questions there were about the same questions and
>articulate my problem:
>
>See the code below - I am creating an instance document of this extract.xsd
>schema which makes use of two namespaces.
>The instance document is written into c:\temp where the schema is in a
>different directory.
>The instance documnet now declares the namespaces and the schema location
>
><ClinicalDocument
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>xmlns="http://www.ibm.com/research/hii/extract" x
> mlns:hl7="urn:hl7-org:v3"
> xsi:schemaLocation="http://www.ibm.com/research/hii/extract
>extract.xsd">
>
>But when I select it using from the eclipse Resource persective, right click
>on it, and select "validate xml file" I get the error message
>
>cvc-elt.1: Cannot find the declaration of element 'ClinicalDocument'.
>
>You insights are highly appricaited :-)
>
>- Iris
>
>----------------------------------------- code to set DocumentRoot and write
>the Resource -------------------------
>String targetFile = "c:\temp\test.xml";
>
>com.ibm.research.hii.extract.DocumentRoot dstRoot =
>ExtractFactory.eINSTANCE.createDocumentRoot();
>dstRoot.getXMLNSPrefixMap().put("",
>"http://www.ibm.com/research/hii/extract");
>dstRoot.getXMLNSPrefixMap().put("hl7", "urn:hl7-org:v3");
>dstRoot.getXSISchemaLocation().put("http://www.ibm.com/research/hii/extract"
>, "extract.xsd");
>
>Map options = new HashMap();
>options.put(XMLResource.OPTION_SCHEMA_LOCATION, Boolean.TRUE);
>
>Resource eResources = (new ExtractResourceFactoryImpl()
> .createResource(URI.createURI(targetXMLfile)));
>eResources.getContents().add(dstRoot);
>eResources.save(new FileOutputStream(targetXMLfile), options);
>eResources.unload();
>
>
>
>
Previous Topic:XMLResource.OPTION_SCHEMA_LOCATION
Next Topic:Searching EMF Objects
Goto Forum:
  


Current Time: Tue Oct 28 00:10:09 EDT 2025

Powered by FUDForum. Page generated in 0.85124 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top