com.google.caja.parser.html
Class AttributeNameFixup

java.lang.Object
  extended by com.google.caja.parser.html.AttributeNameFixup

final class AttributeNameFixup
extends java.lang.Object

Maps XML qualified names like prefix:localName including ones in the special xmlns:namespaceName namespace to valid XML local names f:fixupName.

This lets us shuttle names through several stages:

  1. From the Html5ElementStack where we know attribute names but not where elements begin and end.

    In this stage, XML elements and attributes have a no namespace and a local name containing a colon.

  2. Through the CajaTreeBuilder which builds a DOM that cannot have attributes whose names start with xmlns:. At this stage, we do not have all the parent context to make namespace declarations, so we shuttle names outside the default HTML namespace into non namespaced elements.

    The Xerces DOM implementation can deal with ':'s in local names for non-namespaced elements and attributes, but rejects any attributes whose names start with xmlns:.

    In this stage, XML elements and attributes have a no namespace and a local name containing a colon.

  3. To the DomParser which walks the resulting DOM to find elements and attributes with namespace prefixes that need to be fixed and rewrites them.

    After this stage finishes, all elements and attributes are properly namespaced.

Author:
mikesamuel@gmail.com
See Also:
DomParser.fixup(org.w3c.dom.Node, com.google.caja.parser.html.Namespaces)

Field Summary
(package private) static java.lang.String PREFIX
          A prefix of all names of attributes that need to be fixed up.
(package private) static java.lang.String XMLNS_PREFIX
          A prefix of all fixup names that are encoded namespace declarations.
 
Constructor Summary
AttributeNameFixup()
           
 
Method Summary
(package private) static java.lang.String fixupNameFromQname(java.lang.String qname)
           
(package private) static java.lang.String qnameFromFixupName(java.lang.String fixupName)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PREFIX

static final java.lang.String PREFIX
A prefix of all names of attributes that need to be fixed up.

See Also:
Constant Field Values

XMLNS_PREFIX

static final java.lang.String XMLNS_PREFIX
A prefix of all fixup names that are encoded namespace declarations.

Constructor Detail

AttributeNameFixup

AttributeNameFixup()
Method Detail

fixupNameFromQname

static java.lang.String fixupNameFromQname(java.lang.String qname)

qnameFromFixupName

static java.lang.String qnameFromFixupName(java.lang.String fixupName)


Copyright (C) 2008 Google Inc.
Licensed under the Apache License, Version 2.0