[prev in list] [next in list] [prev in thread] [next in thread]
List: xmlbeans-user
Subject: Re: default namespace and empty namespace (xmlns="") during serialization.
From: Frank Z <fjz_2k_78 () yahoo ! com>
Date: 2008-10-06 20:30:41
Message-ID: 998112.59509.qm () web52602 ! mail ! re2 ! yahoo ! com
[Download RAW message or body]
Please ignore. I found the solution, albeit a little unclear
<xs:schema
elementFormDefault="qualified"
targetNamespace="customerror.xml.acmeweb.com" xmlns:tns="customerror.xml.acmeweb.com" xmlns:xs="http://www.w3.org/2001/XMLSchema">
By adding the 'elementFormDefault="qualified"' into my XSD
and calling xmlOptions.setUseDefaultNamespace(); prior to saving, I am able to get \
what I want. Hopefully this will help someone else in the future.
--- On Mon, 10/6/08, Frank Z <fjz_2k_78@yahoo.com> wrote:
> From: Frank Z <fjz_2k_78@yahoo.com>
> Subject: default namespace and empty namespace (xmlns="") during serialization.
> To: user@xmlbeans.apache.org
> Date: Monday, October 6, 2008, 12:13 PM
> Apologize in advance if this has been asked before. I am
> still a little confused as to how to serialize a document
> with basic namespace handling
>
> When I use the default option (ie. none), serializing my
> document yields
> the following
>
> <?xml version="1.0"
> encoding="UTF-8"?>
> <cus:CustomErrors
> xmlns:cus="http://customerror.xml.acmeweb.com">
> <WarningFlag>false</WarningFlag>
> <ErrorFlag>true</ErrorFlag>
> <FatalErrorFlag>false</FatalErrorFlag>
> <ErrorCount>2</ErrorCount>
>
> If I turn call xmlOptions.setUseDefaultNamespace() prior to
> serializing, I get
>
>
> <CustomErrors
> xmlns="http://customerror.xml.acmeweb.com">
> <WarningFlag
> xmlns="">false</WarningFlag>
> <ErrorFlag
> xmlns="">true</ErrorFlag>
> <FatalErrorFlag
> xmlns="">false</FatalErrorFlag>
> <ErrorCount xmlns="">2</ErrorCount>
> ...
>
> This is probably worse because most of our customers simply
> don't know how to handle xmlns="" in the child
> element.
>
> Is there a simple way to serialize my document and get
> somethign like this (ie. without any prefix?)
>
> <?xml version="1.0"
> encoding="UTF-8"?>
> <CustomErrors
> xmlns:"http://customerror.xml.acmeweb.com">
> <WarningFlag>false</WarningFlag>
> <ErrorFlag>true</ErrorFlag>
> <FatalErrorFlag>false</FatalErrorFlag>
> <ErrorCount>2</ErrorCount>
>
> I've searched FAQ and googled but found no simple
> answers for this question.
>
> Thanks in advance
> Frank.
>
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> user-unsubscribe@xmlbeans.apache.org
> For additional commands, e-mail:
> user-help@xmlbeans.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: user-help@xmlbeans.apache.org
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic