|
[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: SAX Filters for Namespace Processing
On 01 Aug 2001 09:50:13 -0700, Jeff Rafter wrote: > Assuming you have encountered the above example, what was it that you > couldn't do because of the unqualified nature? For starters, I can't easily write processing in SAX that sends all content of a given (namespace-identified) vocabulary to appropriate processing. I have to start maintaining context explicitly in my code. (That happens within the filters of course, but at least it's isolated from other processing.) > Obviously there is a touchy > issue with unqualified elements being designed within a schema that > represents a namespace, while they are not, themselves, within that > namespace. This can make it difficult to process them, I suppose, but what > is the exact difficulty? The SAX-routing example is one part, but it has other ramifications. Moving pieces of documents from place to place becomes pretty tricky when there are unqualified elements. Context can disappear, and they unqualified parts may also pick up a namespace declaration from elsewhere in the destination tree if the processing isn't careful. (Aaron's talk did recommend the use of xmlns="" on explicitly unqualified content to ensure it stayed that way, if I remember correctly.) > >From a purely naive point of view (mine) I see XML as completely heirarchal; > where context is king. Processing elements rarely occurs outside of knowing > context (be it only the context of a specific document), so it would seem > that needing the context in the case of unqualified elements is perfectly > natural. If you have the context - you're working in DOM, XPath, or some variation - it's something you can deal with. If you're in a streaming environment, or move content between contexts, it gets ugly rapidly. > My second question revolves around the default namespace issue (which is > where this all got really contentios last time). I am wondering if you make > any special choices, or plan to regarding default namespaces: > > <root xmlns="http://simonstl.com/default"> > <p:person xmlns:p="http://simonstl.com/person"> > <givenName>Chip</givenName> > <familyName>Skillet</familyName> > <address> > <city>Ithaca</city> > </address> > </p:person> > </root> > > or > > <root xmlns="http://simonstl.com/default"> > <p:person xmlns:p="http://simonstl.com/person"> > <givenName>Chip</givenName> > <familyName>Skillet</familyName> > <address xmlns=""> > <city>Ithaca</city> > </address> > </p:person> > </root> > > I am not looking to say what would be right or wrong-- I am just wondering > how or if your filter handles these? The filter checks the namespace URI, not the prefix. So if something is in the default namespace and has a URI, the filter leaves it alone. If something is unqualified, then processing starts, determined by rules that work from the context. (The context is maintained as a stack to ensure to that hierarchy and not mere sequence sets the appropriate context.) Simon St.Laurent
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|
|||||||||

Cart








