[xmlsec] Signing a document with key and cert..

Aleksey Sanin aleksey@aleksey.com
Wed, 20 Nov 2002 09:35:45 -0800


Actually I never tried this myself. There is a function that looks like 
one you need:
    xmlAddAttributeDecl()
but it also looks related to DTD validation. Probably, it's a good idea 
to ask this question
in LibXML2 (http://xmlsoft.org) mailing list.

Aleksey

Marius Kjeldahl wrote:

> Aleksey Sanin wrote:
>
>>>
>>> My next challenge is to do this dynamically (so if anybody have 
>>> experience on how to do that using libxml, feel free to spill the 
>>> beans). 
>>
>>
>>
>> Check xmlCreateIntSubset() from th libxml/tree.h file.
>
>
> By using xmlCreateIntSubset, the following gets put into my document:
>
> <?xml version="1.0"?>
> <!DOCTYPE ThreeDSecure PUBLIC "" "">
> <ThreeDSecure>
> ...
>
> which seems ok. Now I need to add the the definitions, like:
>
> <!ATTLIST CRReq id ID #IMPLIED>
>
> so that the complete result becomes something like:
>
> <?xml version="1.0"?>
> <!DOCTYPE ThreeDSecure [
> <!ATTLIST CRReq id ID #IMPLIED>
> ]>
> <ThreeDSecure>
> ...
>
> which validates ok.
>
> I've googled around both the web and newsgroups, but have not found 
> the correct way to add the "attlist" nodes to the dtd. I've tried 
> xmlAddDocEntity with XML_INTERNAL_PARAMETER_ENTITY, but I can not seem 
> to get it work. In addition, I found something in valid.h which looks 
> promising - xmlAddAttributeDecl - but this one requires a 
> xmlValidCtxtPtr which I guess is necessary at the validation phase 
> (which I can not do, since I do not have a complete document yet).
>
> Any experts who want to give me a hint of what functions I need to 
> call to add ATTLIST (and similar) entries in libxml?
>