I am an xmlbeans newbie myself but I know you can add the
schemaLocation attribute as follows:
protected void addSchemaLocation(XmlObject xmlObject, String location) {
XmlCursor cursor = xmlObject.newCursor();
if (cursor.toFirstChild()) {
cursor.setAttributeText(
new
QName("http://www.w3.org/2001/XMLSchema-instance","schemaLocation"),
location);
}
}
Maarten
[EMAIL PROTECTED] wrote:
Hi Serge,
Thanks for identifying the point.
The
real problem was tht when XMLBean writes the file, it does not include
the "xsi:SchemaLocation" and "xmlns:xsi" in the definition
of the root element. I had to write another function to write back
these
information into the XML file. Now the SAXParser validates against a
schema.
Is there any XMLBean options to
write
these two information along with the root tag.
Thanks in advance.
Warm Regards,
Sujoy Banerjee
Tata Consultancy Services Limited
Plot B-1, Block EP & GP
Sector - V, Salt Lake Electronics Complex
Kolkata - 700 091,West Bengal
India
Mailto: [EMAIL PROTECTED]
Website: http://www.tcs.com
Hi.
I don't see 'xmlns:mon' attribute that declares your
namespace in your <mon:Item ...> element. I think, problem
is here, because Xerces needs schema to validate document
before parsing and he doesn't know which schema to use for
namespace 'mon'.
>
> Hi all,
> I am facing a bizarre problem. I am using XMLBean ver 2.0
> to write a xml
> file conforming some a given xsd. The XML file that is
> generated, is as
> follows:
> <?xml version="1.0"?>
> <mon:Item
> ....xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>
>
xsi:SchemaLocation="C:\XMLSchema\
> Item.xsd">
> <mon:Text>
> .....
> </mon:Text>
> <mon:Art>
> .....
> </mon:Art>
> </mon:Item>
> Now for some reason I can not use XMLBean again to read
> the generated XML
> file, here we have to use SAX Parser. The SAXparser
> throws an exception
> that it can not find the Namespace and so it can not
> parse the file. I am
> using the latest version of xerces.jar.
>
> However if I use the XMLBean to read the file(for testing
> only that there
> something went wrong while writing the xml file), there
> is no problem in
> reading the file.
> Is there any incompatibility issue..? If so, what is the
> way around?
>
> Thanks in advance.
> Warm Regards,
> Sujoy Banerjee
> Tata Consultancy Services Limited
> Plot B-1, Block EP & GP
> Sector - V, Salt Lake Electronics Complex
> Kolkata - 700 091,West Bengal
> India
> Mailto: [EMAIL PROTECTED]
> Website: http://www.tcs.com
>
> Notice: The information contained in this e-mail message
> and/or attachments to it may contain confidential or
> privileged information. If you are not the intended
> recipient, any dissemination, use, review, distribution,
> printing or copying of the information contained in this
> e-mail message and/or attachments to it are strictly
> prohibited. If you have received this communication in
> error, please notify us by reply e-mail or telephone and
> immediately and permanently delete the message and any
> attachments. Thank you
_____
Best Regards, Serge.
mailto:[EMAIL PROTECTED]
ICQ 315293596
"СОЛО на клавиатуре" - обучение слепому
десятипальцевому
набору
Для получения информации посетите, пожалуйста,
сайт
http://www.ergosolo.ru
----------------------------------------------------
Треть суток на треть дешевле!
МАРК-ИТТ ввёл льготные цены на ночной трафик
в Народном Интернете
цены на трафик на 30% ниже дневных в период
с 1:00 до 9:00.
600-й - 1.75р, Профессиональный - 1.89р, Деловой
- 1.96р, 5-ка - 2,03р, Домашний - 2,10р
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
ForwardSourceID:NT0000D672
Notice: The
information contained in this e-mail message and/or attachments to it
may contain confidential or privileged information. If you are not the
intended recipient, any dissemination, use, review, distribution,
printing or copying of the information contained in this e-mail message
and/or attachments to it are strictly prohibited. If you have received
this communication in error, please notify us by reply e-mail or
telephone and immediately and permanently delete the message and any
attachments. Thank you
|
|