[prev in list] [next in list] [prev in thread] [next in thread] 

List:       xmlbeans-dev
Subject:    RE: namespace issues
From:       "Eric Vasilik" <ericvas () bea ! com>
Date:       2004-02-18 8:17:33
Message-ID: 4B2B4C417991364996F035E1EE39E2E10D8E63 () uskiex01 ! amer ! bea ! com
[Download RAW message or body]

Hi Marius,

I took a look at the SAX saving code and it seems like it should utilize
suggested prefixes.  First, make sure that your prefix map has uri's as
keys and the prefix as the value.  Second, could you make sure that the
call to your ContentHandler is not passing a qualified name which
utilizes your prefix.

Also, the suggested prefix option is only used if a namespace attribute
for the given uri does not already exist in the context where the
elem/attr which uses that uri.  In other words, the existing namespace
attributes in your document have the highest priority, then the
suggested prefix map is used to synthesize namespace attributes as
needed.  This means that if you parse in an XML document, and then try
to save it out with a suggested prefix option, the prefixes will
effectively be ignored.  As I think about it, this is most likely the
problem/misunderstanding.

If this is the case, then to achieve what you want, you will need to
remove all namespace attributes from your document before attempting to
save it to make the saver take advantage of your suggested prefixes.

- Eric

-----Original Message-----
From: Marius Gleeson [mailto:mariusgleeson@audumla.net] 
Sent: Tuesday, February 17, 2004 8:41 PM
To: xmlbeans-dev@xml.apache.org
Subject: namespace issues

Hi there,

I am serializing xmlbeans back and forth between a few machines. As they
get sent they may go through a transformation using xsl or some other
parsing technology.

However when I run the serialized beans through the xsl, it seems to
ignore all the namespace/prefix settings that I have defined in the
XmlOptions. It always generates new prefixes regardless of what I have
set.

When I run the whole thing in local mode (ie no serialization) it all
works fine.

This is a code sample from within my sax XMLReader

            protected void parse() throws java.io.IOException,
            org.xml.sax.SAXException{
                org.apache.xmlbeans.XmlOptions options = new
                org.apache.xmlbeans.XmlOptions();
                options.setSaveSyntheticDocumentElement( mName );  
                options.setSaveOuter();
 
options.setSaveSuggestedPrefixes(au.com.str.xml.XMLParser.Namespaces.get
PrefixURIMap());
                mElement.save(getContentHandler(),mLexical,options);
            }
Any ideas?
Thanks,
Marius.

- ---------------------------------------------------------------------
To unsubscribe, e-mail:   xmlbeans-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xmlbeans-dev-help@xml.apache.org
Apache XMLBeans Project -- URL: http://xml.apache.org/xmlbeans/


- ---------------------------------------------------------------------
To unsubscribe, e-mail:   xmlbeans-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xmlbeans-dev-help@xml.apache.org
Apache XMLBeans Project -- URL: http://xml.apache.org/xmlbeans/


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic