Load portion of xml file [message #425199] |
Wed, 19 November 2008 05:20  |
Eclipse User |
|
|
|
Hi All,
Is there any way to load portion/partial xml file with EMF?
Say for example,
<person>
<name>XYZ</name>
<address>
<houseNo>1</houseNo>
<streetNo>4</streetNo>
<society>ABC</society>
<city>Bangalore</city>
<state>Karnataka</state>
</address>
</person>
How can I load just <address> portion of the xml? The reason is there is
no schema definition for the rest of the xml document. And entire document
is very large. The above is just example for simplicity.
Thanks in Advance.
Sun
|
|
|
|
|
Re: Load portion of xml file [message #425228 is a reply to message #425227] |
Thu, 20 November 2008 03:22  |
Eclipse User |
|
|
|
This is a multi-part message in MIME format.
--------------060105060302050303040509
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit
Sun,
You just register it and use it like any other resource factory, i.e.,
just like the one that's generated for your schema-based model. Have a
look at its createResource method and compare that to the one for your
generated model. And yes, it will serialize changes properly. Have a
loot at this article to understand how it works:
Binding XML to Java
< http://www.theserverside.com/tt/articles/article.tss?l=Bindi ngXMLJava>
Sun wrote:
> Ed,
>
> Can you give some example code for using the
> GenericXMLResourceFactoryImpl?
>
> For this example lets say there is a file called address.ecore which
> define the schema. And person.xml is the xml file from which address
> needs to be loaded. After modification when I save the resource, will
> it update appropriate portion automatically?
>
> Regards
> Sun
>
--------------060105060302050303040509
Content-Type: text/html; charset=ISO-8859-15
Content-Transfer-Encoding: 8bit
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-15"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Sun,<br>
<br>
You just register it and use it like any other resource factory, i.e.,
just like the one that's generated for your schema-based model.
|
|
|
Powered by
FUDForum. Page generated in 0.13304 seconds