attributes define characterestics of an element so try:
Element nextElem=null;
if (nextElem == null) nextElem = createNextElement(localName);
else nextElem.setLocalName(localName);
//set the namespace which will identify a schema which this element
must adhere to
nextElem.setNamespace(nextElem.findNamespace(namespaceURI, null));
int j = atts.getLength();
for (int i = 0; i < j; i++) {
// Note that some SAX parsers report namespace declarations as
attributes in addition
// to calling start/endPrefixMapping.
// NOTE: This filter was introduced to make SAXOMBuilder work with
some versions of
// XMLBeans (2.3.0). It is not clear whether this is a bug in
XMLBeans or not.
// See
http://forum.springframework.org/showthread.php?t=43958 for a discussion.
// If this test causes problems with other parsers, don't
hesitate to remove it.
if (!atts.getQName(i).startsWith("xmlns")) {
OMAttribute attr = nextElem.addAttribute(atts.getLocalName(i),
atts.getValue(i),
nextElem.findNamespace(atts.getURI(i), null));
//delivers back the OMAttribute that was added so we can modify the
type here
attr.setAttributeType(atts.getType(i));
}
}
hth
Martin Gainty
______________________________________________
Jogi és Bizalmassági kinyilatkoztatás/Verzicht und
Vertraulichkeitanmerkung/Note de déni et de confidentialité
Ez az
üzenet bizalmas. Ha nem ön az akinek szánva volt, akkor kérjük, hogy
jelentse azt nekünk vissza. Semmiféle továbbítása vagy másolatának
készítése nem megengedett. Ez az üzenet csak ismeret cserét szolgál és
semmiféle jogi alkalmazhatósága sincs. Mivel az electronikus üzenetek
könnyen megváltoztathatóak, ezért minket semmi felelöség nem terhelhet
ezen üzenet tartalma miatt.
Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger
sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung
oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem
Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung.
Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung
fuer den Inhalt uebernehmen.
Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le
destinataire prévu, nous te demandons avec bonté que pour satisfaire informez
l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est
interdite. Ce message sert à l'information seulement et n'aura pas n'importe
quel effet légalement obligatoire. Étant donné que les email peuvent facilement
être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité
pour le contenu fourni.
Date: Mon, 21 Mar 2011 15:21:32 +0530
Subject: Entity Reference node
From: [email protected]
To: [email protected]
Hello
I have been trying to add entity reference node to an elementCan any body
please guide me how to do thatMy code is as follows
Attr attr = doc.createAttributeNS("http://www.w3.org/2000/svg", "style");
org.w3c.dom.EntityReference er = doc.createEntityReference("background");
attr.appendChild(attr);
elem.setAttributeNode(attr);
Is it not the correct way to attach entity reference node?
Rgds
Goldi