Re: schema service

"Edwin Dankert" <[email protected]> Fri, 21 Feb 2003 11:28:07 -0000
Newsgroups gmane.editors.xngr.general
Organization Cladonia
Message-ID <00af01c2d99c$5f9597c0$4439869f@windmill>
Hello Rado,

Thanks for your question.

> I tried xngr and schema service.
> When I press document->parse on xsd document, I get this  error message:
> Ln 3: cvc-elt.1: Cannot find the declaration of element 'xsd:schema'.

If I'm correct, you are trying to parse a schema with the validation option
turned on. There are 2 solutions:

[1] Make sure you include the schema/dtd

For validation to work you need to include a schema/dtd in your xml.

DTD:

  To validate against a DTD, the DTD needs to be defined in the
  DOCTYPE element, like this:

  <!DOCTYPE test PUBLIC "http://test.org//1.0" "http://test.org/test.dtd">

SCHEMA:

  To validate the XML against the defined XML Schema, for a Schema without
  namespaces:

  <test xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:noNamespaceSchemaLocation="http://test.org/test.xsd"/>

  For a schema with namespaces:

  <test xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://test.org/ http://test.org/test.xsd"
      xmlns="http://test.org/"/>

In this case, you could do this:

<?xml version="1.0" encoding="windows-1250"?>
<xsd:schema
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://www.w3.org/2001/XMLSchema
                      http://www.w3.org/2001/XMLSchema.xsd"
  xmlns:xsd="http://www.w3.org/2001/XMLSchema">
...........
</xsd:schema>


[2] Turn validation off

Turn the validation option off (Editor->Document->Validation), the XML will
now only be checked for well-formedness.

IMPORTANT:
In contrary to what the reviews say, the application allows for editing and
saving of non-valid/not well-formed XML.

Hope this answered the question?
Edwin



-------------------------------------------------------
This SF.net email is sponsored by: SlickEdit Inc. Develop an edge.
The most comprehensive and flexible code editor you can use.
Code faster. C/C++, C#, Java, HTML, XML, many more. FREE 30-Day Trial.
www.slickedit.com/sourceforge