Skip to Content.
Sympa Menu

xom-interest - Re: [XOM-interest] How to add a xmlns:prefix attribute to an element

xom-interest AT lists.ibiblio.org

Subject: XOM API for Processing XML with Java

List archive

Chronological Thread  
  • From: Imran M Yousuf <imyousuf AT gmail.com>
  • To: XOM API for Processing XML with Java <xom-interest AT lists.ibiblio.org>
  • Subject: Re: [XOM-interest] How to add a xmlns:prefix attribute to an element
  • Date: Wed, 11 Aug 2010 16:45:29 +0600

Thanks a a lot Micheal! Thats exactly what I was looking for and it works :).

Best regards,

Imran

On Wed, Aug 11, 2010 at 2:23 PM, Michael Kay <mike AT saxonica.com> wrote:
> Have you tried
>
> Element.addNamespaceDeclaration("custom",
> "http://example.com/opensearchextensions/1.0/";);
>
> Michael Kay
> Saxonica
>
>
> On 11/08/2010 07:49, Imran M Yousuf wrote:
>>
>> Hi,
>>
>> I am facing a little problem :).
>>
>> http://www.opensearch.org/Specifications/OpenSearch/1.1#OpenSearch_Query_element
>> I am trying to implement a DOM serialization and deserialization api
>> for this specification. A part of is to be able to write -
>> <Query xmlns:custom="http://example.com/opensearchextensions/1.0/";
>>         role="custom:example"
>>         searchTerms="cat"
>>         title="Sample search" />
>> The problem is I can not add xmlns:* attributes as it rightly
>> identifies it as NS and throws an exception. But if I do provide an
>> URI for the role attribute that would behave wrongly as it will make
>> 'role' under that NS with empty prefix. One way I am currently
>> employing to get around it is to use another dummy attribute, such as
>> custom:add="val" with the custom's NS, then it adds the xmlns
>> automatically. But I would not want to do it always.
>>
>> Can you please suggest me how I could achieve just achieving the
>> following?
>> <Query xmlns:custom="http://example.com/opensearchextensions/1.0/";
>>         role="custom:example"
>>         searchTerms="cat"
>>         title="Sample search" />
>>
>> Thank you,
>>
>>
>
> _______________________________________________
> XOM-interest mailing list
> XOM-interest AT lists.ibiblio.org
> http://lists.ibiblio.org/mailman/listinfo/xom-interest
>



--
Imran M Yousuf
Entrepreneur & Software Engineer
Smart IT Engineering
Dhaka, Bangladesh
Email: imran AT smartitengineering.com
Blog: http://imyousuf-tech.blogs.smartitengineering.com/
Mobile: +880-1711402557




Archive powered by MHonArc 2.6.24.

Top of Page