Skip to Content.
Sympa Menu

xom-interest - [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-interest AT lists.ibiblio.org
  • Subject: [XOM-interest] How to add a xmlns:prefix attribute to an element
  • Date: Wed, 11 Aug 2010 12:49:21 +0600

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,

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




Archive powered by MHonArc 2.6.24.

Top of Page