You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-users@xerces.apache.org by Joep De Vocht <Jo...@brion.com> on 2010/12/07 19:51:56 UTC

DOM header: how to skip writing the standalone property in the header (Schema validation)

Dear all,

I'm using xercesc createDocument and serializer to create and write an XML document that is meant to be parsed using a schema for validation.

I'm using (sorry for the layout):
adel_impl_module = DOMImplementationRegistry::getDOMImplementation(XMLString::transcode("Core"));
adel_module_doc = adel_impl_module->createDocument(     XMLString::transcode("http://www.asml.com/XMLSchema/MT/Generic/ADELcalibrationModuleLayout/v1.0
        xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"
        xsi:schemaLocation=\"http://www.asml.com/XMLSchema/MT/Generic/ADELcalibrationModuleLayout/v1.0  ADELcalibrationModuleLayout_PKNE.xsd"),
        XMLString::transcode("ADELcalibrationModuleLayout:ModuleLayout"), 0);
adel_module_doc->setEncoding(X("UTF-8"));
adel_module_doc->setVersion(X("1.0"));

This creates a document with header
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>

I've been told that:
"please don't use the 'standalone' declaration. It is only usefull when DTD's are used. We don't use DTD but XML-schema (XSD). Some parsers even get confused (even crash) when using this declaration."

How do I force DOM to NOT write the "standalone" property in the header.
Can't seem to find the answer to this anywhere.

Kind Regards,

Joep.



________________________________
-- The information contained in this communication and any attachments is confidential and may be privileged, and is for the sole use of the intended recipient(s). Any unauthorized review, use, disclosure or distribution is prohibited. Unless explicitly stated otherwise in the body of this communication or the attachment thereto (if any), the information is provided on an AS-IS basis without any express or implied warranties or liabilities. To the extent you are relying on this information, you are doing so at your own risk. If you are not the intended recipient, please notify the sender immediately by replying to this message and destroy all copies of this message and any attachments. ASML is neither liable for the proper and complete transmission of the information contained in this communication, nor for any delay in its receipt.

Re: DOM header: how to skip writing the standalone property in the header (Schema validation)

Posted by Boris Kolpackov <bo...@codesynthesis.com>.
Hi Joep,

Joep De Vocht <Jo...@brion.com> writes:

> How do I force DOM to NOT write the "standalone" property in the header.

I don't think you can instruct Xerces-C++ not to write the standalone
attribute in the XML declaration. What you can do, is disable the
XML declaration altogether. If needed, you can then output it
yourself without the standalone attribute.

Boris

-- 
Boris Kolpackov, Code Synthesis        http://codesynthesis.com/~boris/blog
Compiler-based ORM system for C++      http://codesynthesis.com/products/odb
Open-source XML data binding for C++   http://codesynthesis.com/products/xsd
XML data binding for embedded systems  http://codesynthesis.com/products/xsde

Re: DOM header: how to skip writing the standalone property in the header (Schema validation)

Posted by Vitaly Prapirny <ma...@mebius.net>.
Hi,

Joep De Vocht wrote:
> I've been told that:
> "please don't use the 'standalone' declaration. It is only usefull when DTD's are used. We don't use DTD but XML-schema (XSD). Some parsers even get confused (even crash) when using this declaration."

These parsers are not XML parsers so (or are buggy XML parsers).

> How do I force DOM to NOT write the "standalone" property in the header.
> Can't seem to find the answer to this anywhere.

Xerces-C++ has no such feature.

Good luck!
	Vitaly