< prev index next >

src/java.xml.bind/share/classes/com/sun/xml/internal/bind/marshaller/NamespacePrefixMapper.java

Print this page

        

*** 123,141 **** * <p> * By default, the JAXB RI 1.0.x produces namespace declarations only when * they are necessary, only at where they are used. Because of this * lack of look-ahead, sometimes the marshaller produces a lot of * namespace declarations that look redundant to human eyes. For example, ! * <pre><xmp> * <?xml version="1.0"?> * <root> * <ns1:child xmlns:ns1="urn:foo"> ... </ns1:child> * <ns2:child xmlns:ns2="urn:foo"> ... </ns2:child> * <ns3:child xmlns:ns3="urn:foo"> ... </ns3:child> * ... * </root> ! * </xmp></pre> * * <p> * The JAXB RI 2.x mostly doesn't exhibit this behavior any more, * as it declares all statically known namespace URIs (those URIs * that are used as element/attribute names in JAXB annotations), --- 123,141 ---- * <p> * By default, the JAXB RI 1.0.x produces namespace declarations only when * they are necessary, only at where they are used. Because of this * lack of look-ahead, sometimes the marshaller produces a lot of * namespace declarations that look redundant to human eyes. For example, ! * <pre>{@code * <?xml version="1.0"?> * <root> * <ns1:child xmlns:ns1="urn:foo"> ... </ns1:child> * <ns2:child xmlns:ns2="urn:foo"> ... </ns2:child> * <ns3:child xmlns:ns3="urn:foo"> ... </ns3:child> * ... * </root> ! * }</pre> * * <p> * The JAXB RI 2.x mostly doesn't exhibit this behavior any more, * as it declares all statically known namespace URIs (those URIs * that are used as element/attribute names in JAXB annotations),
*** 150,168 **** * declare those namespace URIs at the root element. * * <p> * For example, by returning <code>new String[]{"urn:foo"}</code>, * the marshaller will produce: ! * <pre><xmp> * <?xml version="1.0"?> * <root xmlns:ns1="urn:foo"> * <ns1:child> ... </ns1:child> * <ns1:child> ... </ns1:child> * <ns1:child> ... </ns1:child> * ... * </root> ! * </xmp></pre> * <p> * To control prefixes assigned to those namespace URIs, use the * {@link #getPreferredPrefix(String, String, boolean)} method. * * @return --- 150,168 ---- * declare those namespace URIs at the root element. * * <p> * For example, by returning <code>new String[]{"urn:foo"}</code>, * the marshaller will produce: ! * <pre>{@code * <?xml version="1.0"?> * <root xmlns:ns1="urn:foo"> * <ns1:child> ... </ns1:child> * <ns1:child> ... </ns1:child> * <ns1:child> ... </ns1:child> * ... * </root> ! * }</pre> * <p> * To control prefixes assigned to those namespace URIs, use the * {@link #getPreferredPrefix(String, String, boolean)} method. * * @return
*** 230,248 **** * <p> * It is <b>NOT</b> OK to return the same binding, or give * the receiver a conflicting binding information. * It's a responsibility of the caller to make sure that this doesn't happen * even if the ancestor elements look like: ! * <pre><xmp> * <foo:abc xmlns:foo="abc"> * <foo:abc xmlns:foo="def"> * <foo:abc xmlns:foo="abc"> * ... JAXB marshalling into here. * </foo:abc> * </foo:abc> * </foo:abc> ! * </xmp></pre> * * @return * always return a non-null (but possibly empty) array. The array stores * data like (prefix1,nsUri1,prefix2,nsUri2,...) Use an empty string to represent * the empty namespace URI and the default prefix. Null is not allowed as a value --- 230,248 ---- * <p> * It is <b>NOT</b> OK to return the same binding, or give * the receiver a conflicting binding information. * It's a responsibility of the caller to make sure that this doesn't happen * even if the ancestor elements look like: ! * <pre>{@code * <foo:abc xmlns:foo="abc"> * <foo:abc xmlns:foo="def"> * <foo:abc xmlns:foo="abc"> * ... JAXB marshalling into here. * </foo:abc> * </foo:abc> * </foo:abc> ! * }</pre> * * @return * always return a non-null (but possibly empty) array. The array stores * data like (prefix1,nsUri1,prefix2,nsUri2,...) Use an empty string to represent * the empty namespace URI and the default prefix. Null is not allowed as a value
< prev index next >