File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes XML and Related Technologies and the fly likes importing a schema into another Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "importing a schema into another" Watch "importing a schema into another" New topic
Author

importing a schema into another

Enrico Scantamburlo
Greenhorn

Joined: Apr 09, 2008
Posts: 7
I would like to import some elements of another schema into a new one, they have different namespaces. I can do it successfully, however, I have problems validating the xml. The xml will be elaborated by an external program and there should not be any prefixes before the name of the tag (pe <tns:root> ... </tns:root> ) or xmlns attributes in nodes other than the root.

Example: this works

this works too

but i want this

Is this feasible? I have tried many combinations of elementFormDefault in both the schemas but I could not pull it off. thanks in advance
Nitesh Kant
Bartender

Joined: Feb 25, 2007
Posts: 1638

In the example that you want to work, the element imported_element will belong to "no namespace", is that what you want? (This article has more on namespaces)
If not, then you must specify the namespace of this element in the root (because according to the rules you have specified, you can not have it in the child element.) and use the prefix of the namespace with this element.

Something like:


[ April 10, 2008: Message edited by: Nitesh Kant ]

apigee, a better way to API!
Enrico Scantamburlo
Greenhorn

Joined: Apr 09, 2008
Posts: 7
Thanks a lot this solved my problem
Raghavan Muthu
Ranch Hand

Joined: Apr 20, 2006
Posts: 3355

That's a good article. Thanks Nitesh Kant :thumb:


Everything has got its own deadline including one's EGO!
[CodeBarn] [Java Concepts-easily] [Corey's articles] [SCJP-SUN] [Servlet Examples] [Java Beginners FAQ] [Sun-Java Tutorials] [Java Coding Guidelines]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: importing a schema into another